Wednesday, 13 July 2016

How to make and run Test suite ?


Make and run Test suite

1. Create the Test classes
public class TestFilmTitle {
   @Test
   public void testMyFunction1() {

        ....
   }
   ....
}

public class TestFilmSize {
   @Test
   public void testMyFunction2() {

       ....
   }
   ....
}

2. Create Test suite by grouping multiple test classes
@RunWith(Suite.class)
@SuiteClasses({TestFilmTitle.class,
TestFilmSize.class})public class TestSuite1 {
  // No data in this class

  // Only SuiteClasses annotation will execute which will run the different JUnit classes}


3. You can create a Master Test suite for entire application by grouping multiple test suites
@RunWith(Suite.class)
@SuiteClasses( {

    TestSuite1.class,
    TestSuite2.class,
    TestSuite3.class

})
public class TestSuiteMaster {
  // No data in this clas

  // Only the SuiteClasses annotation will execute all the TestSuites for the different services.}


4. Run Test Suite
  • In eclipse, right click on Test suite class
  • Choose Run as... > Test Suite

No comments:

Post a Comment

Note: only a member of this blog may post a comment.