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, 5640👍, 0💬
Popular Posts:
What is Windows DNA architecture? Note :- If you have worked with classic ASP this question can come...
How To Control White Spaces between Table Cells? - XHTML 1.0 Tutorials - Understanding Tables and Ta...
Can you explain why your project needed XML? Remember XML was meant to exchange data between two ent...
when should the volatile modifier be used? The volatile modifier is a directive to the compiler's op...
Describe in detail Basic of SAO architecture of Remoting? For these types of questions interviewer e...