Friday, March 4, 2011

Creating Selenium RC - JUnit Test Suite using Eclipse IDE

1. Create JUnit test cases as illustrated here

2. To create a JUnit test suite, right click on the project select New -> Class

3. Enter the class name as SmokeTestSuite and click on "Finish" button

4. Copy the following code and paste in the above class

package actItTimeSmokeTest;

import org.junit.runner.RunWith;
import org.junit.runners.Suite;

@RunWith(Suite.class)
@Suite.SuiteClasses({JUnitTestCase_01.class, JUnitTestCase_02.class, JUnitTestCase_03.class})
public class SmokeTestSuite {
}

5. To run the test suite, right click on the SmokeTestSuite file and select Run As -> JUnit Test

6. The test suite file will run all the 3 tests and gives the results. Following is the JUnit test result for test suite
Figure: JUnit Test Suite Results

No comments:

Post a Comment