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:
+
+ - Functional - basic unit tests that should always be successfully executed
+ - Network - depends on network connection to execute successfully
+ - External - depends on external third party resource to execute
+ - Interactive - depends on human interaction to execute successfully
+
+
+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:
+
+ - From Eclipse IDE:
+ To execute Jalview unit test in eclipse please take the following steps:
+
+ - Ensure that you have TestNG plugin correctly install for eclipse
+ - Ensure that your test classes are error free and properly annotated
+ - Create a lunch configuration "Select the Run / Run... (or Run / Debug...) menu and create a new TestNG configuration"
+ - Run the tests by executing the configuration target created above
+
+ A more detailed guide for installing and executing TestNG in eclipse is available at testng.org/doc/eclipse.html
+
+ - From Ant:
+ To execute Jalview unit test from ant please take the following steps:
+
+ - Ensure that you have ant installed
+ - Ensure that your test classes are error free and properly annotated
+ - Ensure that the test class or group is available in the TestNG config file. For Jalview this is located in jalview/utils/jalview_testng.xml
+ - Add a TestNG run target to your main ant build file, and execute the target.
+
+ A more detailed guide for executing TestNG from ant is available at http://testng.org/doc/ant.html
+
+
+
+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/
+
+
+
+
+