Difference between revisions of "Your First JUnit Test Case Run"

From CDOT Wiki
Jump to: navigation, search
(Created page with '== 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. [[Image:junit1.png|lef…')
(No difference)

Revision as of 09:33, 20 January 2011

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.

Junit1.png

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

Junit2.png

Select Java->JUnit and click OK

Junit3.png

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

Junit4.png

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

Junit5.png

Examine the testMultiply method in the Edit view.

Junit6.png

Run the method as JUnit Test

Junit7.png

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

Junit8.png

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

Junit9.png

Correct the error and save the file.

Junit10.png

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

Junit11.png

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