...
This tutorial shows how to write a JUnit test case using the Netbeans IDE.
Test Case Skeleton
Tip | ||
---|---|---|
| ||
You can automatically generate a test class with complete test cases in Netbeans. With the class open in the editor, go to the "Tools" menu and select "Create JUnit Tests" or use the shortcut Ctrl+Shift+U. Alternatively, you can right-click on a class in the Files browser and follow the same path, "Tools -> Create JUnit Tests". |
Below is minimal code that can be used as a template for writing org.lcsim test cases. It is not meant as an example, working test case but as an illustration of the essential parts of a JUnit test case. Each section will be covered in detail.
No Format |
---|
import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; public class TestCaseExample extends TestCase { public void TestCaseExample() throws Exception {} public static Test suite() { return new TestSuite(TestCaseExample.class); } protected void setUp() throws Exception { // DO SETUP HERE } public void testIt() throws Exception { // DO TEST HERE } } |
...
Actual test data is kept at *http://www.lcsim.org/datasamples*, which can be browsed. Your test data can also be added here. Contact jeremy@slac.stanford.edu if you want to upload your own test data.
...