Go to Post I used to wonder if the FRC staff would read the CD game hint posts and just laugh to themselves..now I know they do. - rachelholladay [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 12-12-2013, 22:55
jfitz0807 jfitz0807 is offline
Registered User
FRC #2877 (Ligerbots)
Team Role: Parent
 
Join Date: Jan 2009
Rookie Year: 2009
Location: Newton, MA
Posts: 67
jfitz0807 is an unknown quantity at this point
Trying to use junit so I can test code without needing the cRIO

I haven't seen much about junit in here. The discussion on screenstepslive talks about using the Smart Dashboard with a Command Based robot. I would like to be able to test some of the code without needing to run it on the cRIO.

I am still using Netbeans 7.2 from last year's control system with our code from last year as well. I verified that I have the junit plugin installed. I was able to create the test classes, but they won't compile.

The problem is that Netbeans can't seem to find the junit package. For example, on the line:

import junit.framework.TestCase;

Netbeans complains the the package junit.framework does not exist. How could Netbeans have created all the test classes if it can't find the packages?

My junit code is located at

C:\Users\John\AppData\Roaming\NetBeans\7.2\docs\ju nit-3.8.2-api

I extracted the files from the zip delivered with the junit plugin.

Any thoughts? Is Netbeans looking somewhere else? Is there a setting I can use to tell Netbeans where to look?

Thanks.
Reply With Quote
  #2   Spotlight this post!  
Unread 13-12-2013, 00:39
dcarr's Avatar
dcarr dcarr is offline
#HoldStrong
AKA: David Carr
FRC #3309 (Friarbots)
Team Role: Mentor
 
Join Date: Dec 2010
Rookie Year: 2009
Location: Anaheim
Posts: 954
dcarr has a reputation beyond reputedcarr has a reputation beyond reputedcarr has a reputation beyond reputedcarr has a reputation beyond reputedcarr has a reputation beyond reputedcarr has a reputation beyond reputedcarr has a reputation beyond reputedcarr has a reputation beyond reputedcarr has a reputation beyond reputedcarr has a reputation beyond reputedcarr has a reputation beyond repute
Re: Trying to use junit so I can test code without needing the cRIO

I'm not as familiar with Netbeans as I am with Eclipse, but regardless, you need to configure your build path to include the JUnit library. Likely under project properties or similar. It should be part of a default JDK install.
__________________
Team 3309
2016 Los Angeles Chairman's Award Winner
2016 Orange County Regional Winner with 3476 & 6220
Team3309.org
Orange County Robotics Alliance
Reply With Quote
  #3   Spotlight this post!  
Unread 23-12-2013, 15:58
jfitz0807 jfitz0807 is offline
Registered User
FRC #2877 (Ligerbots)
Team Role: Parent
 
Join Date: Jan 2009
Rookie Year: 2009
Location: Newton, MA
Posts: 67
jfitz0807 is an unknown quantity at this point
Re: Trying to use junit so I can test code without needing the cRIO

I unzipped the junit-3.8.2-api.zip into a new directory which now contains a junit folder which itself contains a framework folder. I added the full path to this junit folder in the Java Sources Classpath of the Project Properties. The list now looks like this:

C:/Users/John/sunspotfrcsdk\lib\wpilibj.jar
C:/Users/John/sunspotfrcsdk\lib\networktables-crio.jar
C:\Users\John\AppData\Roaming\NetBeans\7.2\docs\ju nit-3.8.2-api\junit
C:\Users\John\.m2\repository\junit\junit\3.8.2\jun it-3.8.2.jar

I just noticed that the first two which were automatically installed use "/" in the path whereas the last two, which I installed, only use "\". Could this be a problem? If it is, I don't know how to fix it.

Any other thoughts?
Reply With Quote
  #4   Spotlight this post!  
Unread 27-12-2013, 12:30
Spaghetti's Avatar
Spaghetti Spaghetti is offline
Registered User
FRC #0488 (XBot)
Team Role: Mentor
 
Join Date: Apr 2012
Rookie Year: 2011
Location: Seattle
Posts: 13
Spaghetti is an unknown quantity at this point
Re: Trying to use junit so I can test code without needing the cRIO

The way we're tackling this is to have the meat of the robot logic in a separate, vanilla .jar. This core-code jar is then included in both the robot project and a separate JUnit project in netbeans. This way the code can be unit tested using the normal JUnit tooling and run on the robot.
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 22:34.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi