Open main menu

CDOT Wiki β

Your First JUnit Test Case Run

Your First JUnit Test Case Run

First, start with the "Basics Hello" folder you checked out of the Zenit SVN repository in the previous example.


We want to open the JUnit view so start with Window->Show View->Other


Select Java->JUnit and click OK


Notice the JUnit view on the bottom right side of the workbench.


Select the OperationsTest.java program from the Project Explorer view.


Examine the testMultiply method in the Edit view.


Run the method as JUnit Test


Notice the failure in the JUnit view. Specifically the line "Result expected: <50> but was: <2>"


Now bring the multiply method into the Edit window. Notice the method ACTUALLY performs a divide instead of a multiply.


Correct the error and save the file.


Again, run OperationsTest and notice that the number of errors is now zero signified by the GREEN bar.


Congratulations! You've successfully run your first JUnit test case.