Difference between revisions of "Team1/Writing and running JUnit tests"

From CDOT Wiki
Jump to: navigation, search
(Created page with ''''16. Writing and running JUnit tests''' 1. Writing Tests * a) Create a project named "JUnitTest". We can now write our first test. * b) Using the wizard, '''File -> New ->…')
 
 
Line 1: Line 1:
'''16. Writing and running JUnit tests'''
+
=== 16. Writing and running JUnit tests ===
  
1. Writing Tests
+
16.1. Writing Tests
 
   
 
   
 
* a) Create a project named "JUnitTest". We can now write our first test.
 
* a) Create a project named "JUnitTest". We can now write our first test.
Line 16: Line 16:
 
   
 
   
 
   
 
   
2. Running Tests
+
16.2. Running Tests
 
   
 
   
 
* a) To run a test case, simply hit the run button in the toolbar as it will automatically run as JUnit Test.
 
* a) To run a test case, simply hit the run button in the toolbar as it will automatically run as JUnit Test.

Latest revision as of 09:11, 1 February 2011

16. Writing and running JUnit tests

16.1. Writing Tests

  • a) Create a project named "JUnitTest". We can now write our first test.
  • b) Using the wizard, File -> New -> JUnit Test Case
  • c) Select New JUnit 3 test radio button and enter a name for your test class
  • d) You may see a warning message asking you to add the JUnit library to the build path. Use the "Click Here" link to add it automatically.
  • e) click "Finish" to create the test class

Lab1 16.jpg


16.2. Running Tests

  • a) To run a test case, simply hit the run button in the toolbar as it will automatically run as JUnit Test.
  • b) To inspect the results, you can see them in the JUnit view. This view will show the test run progress and status.

Lab1 16 1.jpg