X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=doc%2FUnitTesting.html;fp=doc%2FUnitTesting.html;h=8969b9d4e7c0a1b9d0fcba3853212c37ef72238d;hb=f06554784411ddbf871d642e66c8dcb7f147d4a8;hp=0000000000000000000000000000000000000000;hpb=cf06ee5d732af6cc874115aece1138adafca8ad7;p=jalview.git diff --git a/doc/UnitTesting.html b/doc/UnitTesting.html new file mode 100644 index 0000000..8969b9d --- /dev/null +++ b/doc/UnitTesting.html @@ -0,0 +1,111 @@ + + + +Unit testing in Jalview + + +

Unit testing in Jalview

+ +

+In June 2015, the Jalview team adopted TestNG as the favourite unit testing framework. Consequently all existing JUnit tests were ported to TestNG. + + +

Test Groups

+TestNG provides the ability to perform sophisticated grouping of tests using method annotations. This enables TestNG to be invoked and asked to include a certain set of groups (or regular expression) while excluding another set. This gives maximum flexibility in how tests are partitioned and doesn't require you to recompile anything if you want to run two different sets of tests back to back. + +

The following test groups are available within the Jalview test environment: +

+ +

Writing new tests

+To write a new TestNG tests in Jalview, create a new java class and create test methods which are properly annotated with appropriate TestNG annotations. Here is a simple example test: + +

+    package jalview.test;
+    
+    import org.testng.annotations.*;
+    
+    public class SimpleTest {
+ 
+ 	 @BeforeClass(alwaysRun = true)
+ 	 public void setUp() {
+	   // code that will be invoked when this test is instantiated
+	 }
+ 
+	 @Test(groups = { "Functional" })
+	 public void aFunctionalTest() {
+	   System.out.println("Functional test");
+	 }
+ 
+	 @Test(groups = { "Network" })
+	 public void aNetworkDependentTest() {
+	    System.out.println("Network dependent test");
+	 } 
+
+	 @Test(groups = { "External" })
+	 public void anExternalDependencyTest() {
+	    System.out.println(“Test with external dependence to a third party resource");
+	 } 
+
+	 @Test(groups = { "Interactive" })
+	 public void anInteractiveTest() {
+	    System.out.println("Human interactive test");
+	 }
+     }
+
+ +

Test Execution

+The TestNG tests for Jalview can be executed in any of the following ways: + + +

TestNG Tutorial

+You can find more up-to-date documentations and tutorials on TestNG from the following recommended links:
+http://http://testng.org/doc/documentation-main.html
+http://www.tutorialspoint.com/testng/ + + + + +