Categories:
.NET (357)
C (330)
C++ (183)
CSS (84)
DBA (2)
General (7)
HTML (4)
Java (574)
JavaScript (106)
JSP (66)
Oracle (114)
Perl (46)
Perl (1)
PHP (1)
PL/SQL (1)
RSS (51)
Software QA (13)
SQL Server (1)
Windows (1)
XHTML (173)
Other Resources:
How To Group Multiple Test Classes into a Suite in JUnit 4.4?
How To Group Multiple Test Classes into a Suite in JUnit 4.4?
✍: FYICenter.com QA Team
JUnit 4.4 stops using the "public static Test suite()" method to build a test suite class. It is now provides the org.junit.runners.Suite class and two annotations to help you to build test suite.
org.junit.runners.Suite - JUnit 4.4 runner class that runs a group of test classes.
org.junit.runner.RunWith - JUnit 4.4 class annotation that specify runner class to run the annotated class.
org.junit.runner.Suite.SuiteClasses - JUnit 4.4 class annotation that specify an array of test classes for the Suite.class to run.
The annotated class should be an empty class.
To run "@Suite.SuiteClasses" class, you can use the core runner: org.junit.runner.JUnitCore.
Here is a good example of "@Suite.SuiteClasses" class:
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
import org.junit.runners.Suite.SuiteClasses;
// by FYICenter.com
// specify a runner class: Suite.class
@RunWith(Suite.class)
// specify an array of test classes
@Suite.SuiteClasses({
HelloTest.class,
ExpectedExceptionTest1.class,
ExpectedExceptionTest2.class,
UnexpectedExceptionTest1.class,
UnexpectedExceptionTest2.class}
)
// the actual class is empty
public class AllTests {
}
2008-01-29, 5951👍, 0💬
Popular Posts:
Regarding C Coding Given: Line in file Contents 30 int * someIDs, theFirst, *r; 110 someIDs =GetSome...
How To Decrement Dates by 1? - MySQL FAQs - Introduction to SQL Date and Time Handling If you have a...
What are the high-level thread states? The high-level thread states are ready, running, waiting, and...
What is PMP(project management plan)? The project management plan is a document that describes the p...
1. What is normalization. 2. Difference between procedure and functions. 3. Oracle 9i Vs 10g. 4. how...