Creating a Test Suite JUnit Step 57
After you have created your suite of tests, you will want to add them to a test suite that can be used to run all of your tests at one time.
You should create a class under com.testing package called WebTestSuite and paste the following code in that class.
package com.testing;
import junit.framework.Test;
import junit.framework.TestSuite;
public class WebTestSuite {
private static final String TEST_ROOT = "src/com/testing/";
public static Test suite() {
TestSuite suite = new TestSuite();
try
{
suite.addTestSuite(Webtest.class);
}
catch(Exception e)
{
}
return suite;
}
/**
* Runs the test suite using the textual runner.
*
* @param args command line arguments
*/
public static void main(String[] args) {
junit.textui.TestRunner.run(suite());
}
}
You will run this suite the same way that you will run a JUnit test or JWebUnit test. You will add each class to the suite object like this: suite.addTestSuite(Webtest.class); . The suite will run all of your tests to make your testing automated.
Go To Step 58

0 comments:
Post a Comment