Home | History | Annotate | Download | only in mixed
      1 package test.mixed;
      2 
      3 import org.testng.Assert;
      4 import org.testng.TestListenerAdapter;
      5 import org.testng.TestNG;
      6 import org.testng.annotations.Test;
      7 import test.BaseTest;
      8 import testhelper.OutputDirectoryPatch;
      9 
     10 /**
     11  *
     12  * @author lukas
     13  */
     14 public class MixedTest extends BaseTest {
     15     @Test
     16     public void mixedWithExcludedGroups() {
     17         String[] argv = {
     18                 "-d", OutputDirectoryPatch.getOutputDirectory(),
     19                 "-log", "0",
     20                 "-mixed",
     21                 "-groups", "unit",
     22                 "-excludegroups", "ignore",
     23                 "-testclass", "test.mixed.JUnit3Test1,test.mixed.JUnit4Test1,test.mixed.TestNGTest1,test.mixed.TestNGGroups"
     24         };
     25         TestListenerAdapter tla = new TestListenerAdapter();
     26         TestNG.privateMain(argv, tla);
     27 
     28         Assert.assertEquals(tla.getPassedTests().size(), 5); //2 from junit3test1, 2 from junit4test1, 0 from testngtest1 (no groups), 1 from testnggroups (1 is included, 1 is excluded)
     29         Assert.assertEquals(tla.getFailedTests().size(), 0);
     30 
     31     }
     32 
     33     @Test
     34     public void mixedClasses() {
     35         String[] argv = {
     36             "-d", OutputDirectoryPatch.getOutputDirectory(),
     37             "-log", "0",
     38             "-mixed",
     39             "-testclass", "test.mixed.JUnit3Test1,test.mixed.JUnit4Test1,test.mixed.TestNGTest1"
     40         };
     41         TestListenerAdapter tla = new TestListenerAdapter();
     42         TestNG.privateMain(argv, tla);
     43 
     44         Assert.assertEquals(tla.getPassedTests().size(), 6);
     45         Assert.assertEquals(tla.getFailedTests().size(), 0);
     46     }
     47 
     48     @Test
     49     public void mixedMethods() {
     50         String[] argv = {
     51             "-d", OutputDirectoryPatch.getOutputDirectory(),
     52             "-mixed",
     53             "-log", "0",
     54             "-methods", "test.mixed.JUnit3Test1.testB,test.mixed.JUnit4Test1.atest,test.mixed.TestNGTest1.tngCustomTest1"
     55         };
     56         TestListenerAdapter tla = new TestListenerAdapter();
     57         TestNG.privateMain(argv, tla);
     58 
     59         Assert.assertEquals(tla.getPassedTests().size(), 3);
     60         Assert.assertEquals(tla.getFailedTests().size(), 0);
     61     }
     62 }
     63