method before executing the (Web hosts) run() method. Similarly, the

method before executing the run() method. Similarly, the tearDown() method is called after all tests are executed. This method can be used to dispose of resources. When you have created several TestCase classes, it makes sense to combine these classes in a test suite. The JUnit Wizard will help you with this task, too. You only have to invoke the File > New > Other > Java > JUnit > Test Suite function. In the wizard s selection list checkmark all TestCase classes that you want to add to the test suite (in this example the only test case is the PlayerTest class); see Figure 6.6. At this point it is even possible to add other test suites to the new test suite, i.e., you may nest test suites. In the Test Suite field change the proposed name AllTests according to your requirements. 123 Project Development Figure 6.6 After you press the Finish button, the wizard will generate the resulting TestSuite class: import junit.framework.Test; import junit.framework.TestSuite; public class AllTests { public static Test suite() { TestSuite suite = new TestSuite(”Test for tests”); //$JUnit-BEGIN$ suite.addTest(new TestSuite(PlayerTest.class)); //$JUnit-END$ return suite; } }
Get account with us and you will get completely access to our free web templates database with over 10.000 templates in it to build your website.Don’t wait, go and check free web templates.

Leave a Reply