Test Scripts with XDriveUnit

Step 1: Create a new Test Case

The test case you create will simply read in your script file to determine what tests should be run.

package test;
import java.io.File;
import junit.framework.Test;
import com.flexiblewebsolutions.xdriveunit.ScriptRunner;
		
Extending the ScriptRunner class will force you to implement the getTestDirectory method which tells the API where to find your test script configuration file.
public class ScriptTest extends ScriptRunner {

	public File getTestDirectory() {
		return(  new File("test") );
	}
		
	public static Test suite() {
		return( ( new ScriptTest() ).initScript( "script1.xml" ) );
	}
}
		

Step 2: Create Test Script XML

Your script will be stored in the 'test directory' as defined by your test script class.

		
<?xml version="1.0" encoding="ISO-8859-1"?>

<testscript 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../schemas/XDriveTestScript.xsd"> 
<test>
	<test>
		<step>
			<classname>com.flexiblewebsolutions.xdriveunit.extensions.test.TestTest</classname>
			<configuration>testConfig/config1.xml</configuration>
		</step>
	</test>
	<test>
		<step>
			<classname>com.flexiblewebsolutions.xdriveunit.extensions.test.TestTest</classname>
			<configuration>testConfig/config2.xml</configuration>
		</step>
	</test>
</testscript>