public class W3CTests extends Object
The W3CTests class is standalone and can download and transform the IRP tests locally using respectively commandline parameter get or make.
To execute one or multiple IRP tests the commandline parameter run must be specified.
Optional environment parameter -Ddatamodel=<minimal|ecma|xpath> can be specified to limit the execution of the tests for and using only the specified datamodel language.
Optional environment parameter -Dtest=<testId> can be specified to only execute a single test, which also can be combined with the -Ddatamodel parameter.
The W3CTests also uses a separate tests.xml
configuration file, located in the
src/test/resources/w3c
directory, which is manually maintained to enable|disable execution
of tests (when not using the -Dtest parameter, which will always execute the specified test).
Furthermore, in this configuration file the current success or failure status, and even more
meta data per test is maintained.
Modifier and Type | Class and Description |
---|---|
protected static class |
W3CTests.Assertions
Assertions model class used for loading the W3C IRP tests manifest.xml file, defining the meta data and
source URIs for all the W3C IRP tests.
|
protected static class |
W3CTests.Datamodel
Datamodel enum representing the minimal, ecma and xpath datamodel types used and tested by the W3C IRP tests.
|
protected static class |
W3CTests.TestResults
Simple TestResult data struct for tracking test results
|
protected static class |
W3CTests.Tests
Tests model class used for loading the tests.xml configuration file
|
Constructor and Description |
---|
W3CTests() |
Modifier and Type | Method and Description |
---|---|
protected void |
createCleanDirectory(String path) |
protected void |
getTests()
Downloads the W3C IRP manifest.xml, the IRP ecma and xpath stylesheets to transform the tests, and the
actual test templates (.txml) as defined in the manifest.xml
|
protected W3CTests.Assertions |
loadAssertions()
Unmarshall and return the W3C IRP tests manifest.xml
|
protected W3CTests.Tests |
loadTests()
Loads the tests.xml configuration file into a Tests class configuration model instance.
|
static void |
main(String[] args)
W3CTests main function, see
usage() how to use. |
protected void |
makeTests()
Transforms the W3C IRP tests.
|
protected void |
processResource(String specid,
W3CTests.Assertions.Resource resource,
Transformer minimalTransformer,
Transformer ecmaTransformer,
Transformer xpathTransformer)
Download and transform a W3C IRP test resource file
|
protected void |
runTest(W3CTests.Assertions.Assertion assertion,
W3CTests.Tests tests,
W3CTests.Datamodel datamodel,
boolean singleTest,
W3CTests.TestResults results)
Run a single W3C IRP test (assert)
|
protected boolean |
runTest(W3CTests.Assertions.TestCase testCase,
W3CTests.Tests.Test test,
File scxmlFile)
Run a single W3C IRP SCXML test
|
protected void |
runTests(String testId,
W3CTests.Datamodel datamodel)
Run one or multiple W3C IRP tests
|
protected boolean |
runTests(W3CTests.Assertions.Assertion assertion,
W3CTests.Assertions.TestCase testCase,
W3CTests.Tests.Test test,
String scxmlDir,
ArrayList<String> failedTests)
Execute all W3C IRP SCXML tests for a specific
W3CTests.Assertions.TestCase |
protected void |
transformResource(W3CTests.Assertions.Resource resource,
Transformer transformer,
String targetDir)
XSL transform a W3C IRP test SCXML resource to a datamodel specific location and format,
or simply copy a non SCXML resource to that location.
|
protected static void |
usage()
Usage prints the 'commandline' usage options.
|
public W3CTests()
public static void main(String[] args) throws Exception
usage()
how to use.args
- Exception
protected static void usage()
protected void getTests() throws Exception
Exception
protected void makeTests() throws Exception
Note: for transforming the IRP .txml test files XPath 2.0 is required, for which the Saxon library is used.
Exception
protected W3CTests.Assertions loadAssertions() throws Exception
Exception
protected void processResource(String specid, W3CTests.Assertions.Resource resource, Transformer minimalTransformer, Transformer ecmaTransformer, Transformer xpathTransformer) throws Exception
specid
- the SCXML 1.0 spec id (anchor) for the current assertion,
which is used to determine if, how and where the resource should be transformed.resource
- The test resource definitionminimalTransformer
- transformer to produce an minimal datamodel SCXML document from the txml resourceecmaTransformer
- transformer to produce an ecmascript datamodel SCXML document from the txml resourcexpathTransformer
- transformer to produce a xpath datamodel based SCXML document from the txml resourceException
protected void transformResource(W3CTests.Assertions.Resource resource, Transformer transformer, String targetDir) throws Exception
resource
- the test resource definitiontransformer
- the XSL transformer to usetargetDir
- the target location for the transformed SCXML document, or the non-SCXML resourceException
protected void createCleanDirectory(String path) throws Exception
Exception
protected void runTests(String testId, W3CTests.Datamodel datamodel) throws Exception
testId
- a W3C IRP test id, or null to specify all tests to rundatamodel
- only tests available for or executable with the specified datamodel will be run (or all if null)Exception
protected W3CTests.Tests loadTests() throws Exception
Exception
protected void runTest(W3CTests.Assertions.Assertion assertion, W3CTests.Tests tests, W3CTests.Datamodel datamodel, boolean singleTest, W3CTests.TestResults results) throws Exception
assertion
- The W3C IRP assert, defining one or more W3CTests.Assertions.TestCase
stests
- the tests configurationsdatamodel
- the datamodel to limit and restrict the execution of the testsingleTest
- if true a single test id was specified which will be executed even if disabled in the configuration.Exception
protected boolean runTests(W3CTests.Assertions.Assertion assertion, W3CTests.Assertions.TestCase testCase, W3CTests.Tests.Test test, String scxmlDir, ArrayList<String> failedTests) throws Exception
W3CTests.Assertions.TestCase
assertion
- the W3C IRP test assert definitiontestCase
- the W3C IRP test definitiontest
- the test configurationscxmlDir
- the datamodel specific directory path containing the SCXML document(s)Exception
protected boolean runTest(W3CTests.Assertions.TestCase testCase, W3CTests.Tests.Test test, File scxmlFile)
testCase
- the W3C IRP test definitiontest
- the test configurationscxmlFile
- the file handle for the SCXML documentCopyright © 2005–2015 The Apache Software Foundation. All rights reserved.