SE450: JUnit: Executing Tests [35/41] ![]() ![]() ![]() |
Great, so now you have all kinds of tests. How do you run them?
The first way would be to run it directly from the test
itself via a main()
method. You would
instantiate a TestCase, then call the run method on it to
execute the test.
Test test= new MathTest("testAdd"); test.run();
This is a simple way, but not very extensible or easy to automate.
Second, you can use a TestRunner to run your tests. You have the choice of using a textual or graphical TestRunner. When integrating with Ant, we will use the textual one, but you will probably want to use the graphical one at one point or another to debug your code.