Summary


  • To make the executable tests run:

    • Add to each executable test:

      - An extends clause that references your application test class

      - A pass-thru constructor

    • Define an application-test class that

      - Is named AppTest, where App is the name of your application

      - Extends JUnit's TestCase

      - Adds a pass-thru constructor

      - Defines assertFalse

      - Defines a method that calls the system code you want to test (requires knowledge of how the code in the system works)

  • Compile the executable tests with javac, just as with any other java program.

  • Run your tests with java and JUnit's TestRunner utility:

    • The GUI version is junit.swingui.TestRunner.

    • The command-line version is junit.textui.TestRunner.

  • Combine all the tests into a test suite in AllTests, so you can run them in a single operation.

We encourage you to try this out yourself in the following exercise and see that it isn't as hard as you might think.



Testing Extreme Programming
Testing Extreme Programming
ISBN: 0321113551
EAN: 2147483647
Year: 2005
Pages: 238

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net