Next: A sample JUnit session
Up: JUnit
Previous: Goals of unit testing?
Contents
Subsections
How to create unit tests with JUnit
- Build a subclass of the class TestCase.
- Create as many test methods in this test class as necessary.
- With JUnit, if each method begins with the name "test", like testThis(), testThat(), etc., the test methods will be discovered automatically.
- The testing framework collects up all the tests and executes them one after another.
- You can create a method named setUp() that sets stuff up before each test is run.
- You can create a method named tearDown() that helps you get rid of stuff after each test is run.
Next: A sample JUnit session
Up: JUnit
Previous: Goals of unit testing?
Contents