Autograder/JUnit Tests are ways for students to test their code on their local machines so that they may receive instantaneous feedback on the correctness of their programs. There are three levels of autograding that a student may run on their local machines:
These tests are all run locally and differ from the runs we will run on our subversion repository after the deadline. This means that students are responsible for both checking their code into SVN and making sure that code is robust enough to handle a variety of test cases and not just system.out.println() the correct answer for the local test cases. For all the following examples, I will be using MP1: Debug Me. Please keep in mind that future MPs will not tell you what is wrong with your code in plain English so you will have to debug it traditionally by either looking through a stack trace or stepping through your code.
Every .java file will have a corresponding test.java file which contains all the test cases for that .java file. For example, factorial.java can be tested with factorialtest.java. You can run factorialtest.java by opening it up in your Java Prospective and running it with "Eclipse JUnit Launcher", resulting in the following UI.
Your score will be out of the number of test cases you pass, and the colors of each test will signal the status of that test. Notice how a "JUnit" tab has been added to your Java prospective.
If you would like to isolate a single case, you simply right click on a single test case in the JUnit tab and press "Run". You should see the following output.
Notice how only a single test ran, which means that my console only has output relevant to that test. I received this feedback in a fraction of the time it would have taken me to run all the test cases.
After you have finished all parts of an MP (or you just want to know how much progress you have made on the entire MP... or you just want to figure out which files will be tested), then you may run AutomaticScoreCheck.java. This .java file is included in every MP and essentially just runs all the test cases from all the test.java files simultaneously. After running AutomaticScoreCheck.java, you should see the following:
The way to interpret this is that in the entire MP there was a total of 15 test cases / 15 possible points to earn. I received 15 of these meaning my score is (15/15)% or 100%. After you see something like this you should commit to SVN and call it a night.