JUnit Tutorial
Introduction to Junit JUnit Set up JUnit Architecture JUnit Annotations JUnit Fixtures Junit Assertions Junit Categories @Test Annotation Parameters Verification of Exceptions Ignoring tests Time out in JUnit tests Parameterizing tests Test Suite TestWatcher TemporaryFolder ExternalResource Theories in JUnit JUnit Test Runners Execution order of JUnit tests Assumptions in JUnit JUnit and Hamcrest Matchers Running JUnit tests in parallel JUnit and Maven Integration JUnit and Gradle Integration Executing Selenium tests using JUnit test framework Method interceptor and usage JUnit in Intellij IDEA JUnit in EclipseRunning multiple test classes in junit
JUnit allows you to run all tests in specific test classes by using a concept called as JUnit suite. Below example illustrates how to Suite.class to run the test methods in given classes. In below example, We have asked JUnit to run the tests from TestClass.class and IgnoreTestClass.class. We can pass the list of any number of classes to run the tests from.
package junit_tests;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
@RunWith(Suite.class)
@Suite.SuiteClasses({
TestClass.class,
IgnoreTestClass.class
})
public class JunitSuiteClass {
}
Web development and Automation testing
solutions delivered!!