Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
AllTestSuites
package com.test;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
import org.junit.runners.Suite.SuiteClasses;
@RunWith(Suite.class)
@SuiteClasses({TestOneSuite.class, TestTwoSuite.class})
public class AllTestSuites {
}
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.testsuite</groupId>
<artifactId>checktestsuite</artifactId>
<version>0.0.1-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
package com.test;
import org.junit.Test;
public class TestClassOne {
@Test
public void testOne(){
System.out.println("Inside TestClassOne.");
}
}
package com.test;
import org.junit.Test;
public class TestClassTwo {
@Test
public void testTwo(){
System.out.println("Inside TestClassTwo.");
}
}
package com.test;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
import org.junit.runners.Suite.SuiteClasses;
@RunWith(Suite.class)
@SuiteClasses(TestClassOne.class)
public class TestOneSuite {
}
package com.test;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
import org.junit.runners.Suite.SuiteClasses;
@RunWith(Suite.class)
@SuiteClasses(TestClassTwo.class)
public class TestTwoSuite {
}
@coding963

This comment has been minimized.

Copy link
Owner Author

@coding963 coding963 commented Apr 16, 2016

Output on the console is:

Inside TestClassOne.
Inside TestClassTwo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment