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, 5354👍, 0💬
Popular Posts:
How To View All Columns in an Existing Table? - Oracle DBA FAQ - Managing Oracle Database Tables If ...
How To Delete All Rows a Table? - MySQL FAQs - Understanding SQL INSERT, UPDATE and DELETE Statement...
What is normalization? What are different types of normalization? It is set of rules that have been ...
How do you estimate maintenance project and change requests?
Which JavaScript file is referenced for validating the validators at the client side ? WebUIValidati...