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?
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.
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:
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.
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.