Creating Test Suite in Eclipse

Right click  on the Package Explorer and select New -> JUnit Test Suite
Select "New JUnit 4 Suite", Source folder and Package. Give test suite name and select the classes to include in suite.

Will create the class with @RunWith and @Suite annotation with set of class which are going to include in current test suite as below.

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


@RunWith(Suite.class)
@SuiteClasses({ AddJUnitTest.class, ExceptionTestDemo.class })
public class AllTests {

}

Running the Test Suite
Right click on your new test suite class and select Run-As → JUnit Test
All the test cases result will show in "JUnit view"





No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...