Species Discovery Plugin Test Suite

From Gcube Wiki
Revision as of 15:18, 22 November 2012 by Federico.defaveri (Talk | contribs)

Jump to: navigation, search

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>