Documente Academic
Documente Profesional
Documente Cultură
Design of JUnit
JUnit is designed around two key design patterns: the Command pattern and the Composite pattern. A TestCase is a Command object. It can define any number of public testXXX() methods and any test class that has test methods should extend the TestCase class.
Test installation by using the textual or graphical test runner to run the sample tests distributed with JUnit. All tests should pass with an OK or a green bar. If not, then verify that junit.jar is in the CLASSPATH
A TestSuite comprises of various TestCase instances. To write a test suite follow these steps:
Create a class that defines a static suite() factory method which creates TestSuites for all tests. Optionally define a main() method that runs the TestSuite in batch mode.
}
//Runs the test suite using the textual runner. public static void main(String[] args) { junit.textui.TestRunner.run(suite()); }
References
Clark, Michael. JUnit Primer October 7, 2000. [http://www.clarkware.com/articles/JUnitPrimer.html] (April 18, 2004) testdriven.com: Yours test-driven development community News [http://www.testdriven.com/modules/news/] (April 18, 2004) JUnit, Testing Resources for Extreme Programming [http://www.junit.org] (April 18, 2004)