Categories:
.NET (961)
C (387)
C++ (185)
CSS (84)
DBA (8)
General (31)
HTML (48)
Java (641)
JavaScript (220)
JSP (109)
JUnit (31)
MySQL (297)
Networking (10)
Oracle (562)
Perl (48)
Perl (9)
PHP (259)
PL/SQL (140)
RSS (51)
Software QA (28)
SQL Server (5)
Struts (20)
Unix (2)
Windows (3)
XHTML (199)
XML (59)
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, 5132👍, 0💬
Popular Posts:
How To Run Stored Procedures in Debug Mode? - Oracle DBA FAQ - Introduction to Oracle SQL Developer ...
How To Escape Special Characters in SQL statements? - MySQL FAQs - Introduction to SQL Basics There ...
How To Use Subqueries in the FROM clause? - MySQL FAQs - SQL SELECT Statements with JOIN and Subquer...
How To Delete a User Account? - Oracle DBA FAQ - Managing Oracle User Accounts, Schema and Privilege...
How was XML handled during COM times? During COM it was done by using MSXML 4.0. So old languages li...