Difference between revisions of "Species Discovery Plugin Test Suite"

From Gcube Wiki
Jump to: navigation, search
Line 1: Line 1:
 
The Species Discovery Plugin Testsuite is a java library for the testing and the checking of the functionality offered by a Species Discovery plugin.
 
The Species Discovery Plugin Testsuite is a java library for the testing and the checking of the functionality offered by a Species Discovery plugin.
  
The test suite offers different sets of test to run over a plugin.
+
The test suite offers different sets of test to run over a plugin. Each test produces a report indicating which errors have been encountered.
 
+
Some tests requires a set of scientific name or common name in order to be used, the test suite offers different sets that can be indicated when running a test.
Here some examples of testsuite use:
+
In order to build a TestSuite a TestSuiteBuilder has been provided. The builder facilitate the creation and configuration of a test suite.
  
 +
Here an example of TestSuite creation for the ObisPlugin.
 
<source lang="java5">
 
<source lang="java5">
 
//instantiate the plugin to test
 
//instantiate the plugin to test
Line 29: Line 30:
 
//...and run it
 
//...and run it
 
testSuite.run();
 
testSuite.run();
 +
</source>
 +
 +
==Installation==
 +
In order to use the testsuite the developer have to declare the dependency in the pom file.
 +
Here an example:
 +
<source lang="xml">
 +
<dependency>
 +
<groupId>org.gcube.dataaccess</groupId>
 +
<artifactId>spd-plugin-testsuite</artifactId>
 +
<version>0.0.1-SNAPSHOT</version>
 +
<scope>test</scope>
 +
</dependency>
 
</source>
 
</source>

Revision as of 14:18, 22 November 2012

The Species Discovery Plugin Testsuite is a java library for the testing and the checking of the functionality offered by a Species Discovery plugin.

The test suite offers different sets of test to run over a plugin. Each test produces a report indicating which errors have been encountered. Some tests requires a set of scientific name or common name in order to be used, the test suite offers different sets that can be indicated when running a test. In order to build a TestSuite a TestSuiteBuilder has been provided. The builder facilitate the creation and configuration of a test suite.

Here an example of TestSuite creation for the ObisPlugin.

	//instantiate the plugin to test
	ObisPlugin obisPlugin = new ObisPlugin();
 
	//start the TestSuite creation for the specified plugin
	TestSuiteBuilder builder = TestSuiteBuilder.create(obisPlugin);
 
	//we want to load the plugin configuration from the IS in the /gcube/devsec scope
	builder.runtimeResourceFromIS(GCUBEScope.getScope("/gcube/devsec"));
 
	//the suite will use the specified scientific name and common name sets
	builder.withScientificNameSet(ScientificNameSet.SHORT).withCommonNameSet(CommonNameSet.SHORT);
 
	//we require to run the ScanTest group
	builder.addScanTest();
 
	//the test suite should save the test report into a file
	builder.reportToFile();
 
	//finally we build the test suite...
	TestSuite testSuite = builder.build();
 
	//...and run it
	testSuite.run();

Installation

In order to use the testsuite the developer have to declare the dependency in the pom file. Here an example:

	<dependency>
		<groupId>org.gcube.dataaccess</groupId>
		<artifactId>spd-plugin-testsuite</artifactId>
		<version>0.0.1-SNAPSHOT</version>
		<scope>test</scope>
	</dependency>