public class XMLTestSuiteRunner extends java.lang.Object implements XTRunConstants, XTSConstants
TestSuite
from
an XML description following the "XML Test Run" and "XML Test Suite"
formats, whose constants are defined in the XTRunConstants
and XTSConstants
interfaces.
This class takes a "Test Run" XML description as an input. That
description contains: Tests
to be
run and their configuration.TestReportProcessor
and
their configuration that should be used to process the reports
generated by the various TestSuites
.Modifier and Type | Class and Description |
---|---|
static class |
XMLTestSuiteRunner.AcceptAllTestsFilter
Test filter which accepts all tests
|
static class |
XMLTestSuiteRunner.IdBasedTestFilter
Test filter which only accepts tests with ids matching
the ones passed to its constructor.
|
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CANNOT_CREATE_TEST_REPORT_PROCESSOR
An error happened while processing a
TestreportProcessor
description. |
static java.lang.String |
COULD_NOT_CONVERT_FILE_NAME_TO_URI
Displayed when the input file name cannot be turned into a URL
|
static java.lang.String |
ERROR_RUNNING_TEST_SUITE
Error displayed when an error occurs while running the
test suite
|
static java.lang.String |
INVALID_DOCUMENT
Displayed when the input document cannot be parsed.
|
static java.lang.String |
INVALID_URI
Displayed when the input argument does not represent a valid
URI
|
static java.lang.String |
MESSAGE_UNMATCHED_TEST_IDS
Displayed when no test or testSuite matching the input id was
found.
|
static java.lang.String |
NOT_A_FILE_TRY_URI
Displayed when the input argument does not represent an existing
file to notify the user that the argument is going to be
interpreted as a URI.
|
static java.lang.String |
TEST_REPORT_PROCESSING_EXCEPTION
An error happened while processing the
TestReport
generated by the TestSuite
{0} : TestReportProcessor class name. |
static java.lang.String |
TEST_SUITE_EXCEPTION
An error happened while running the
TestSuite
{0} : TestSuite name
{1} : TestSuite class name. |
static java.lang.String |
USAGE
Displayed when the user passes no arguments to the command line.
|
XTRun_HREF_ATTRIBUTE, XTRun_ID_ATTRIBUTE, XTRun_NAME_ATTRIBUTE, XTRun_NAMESPACE_URI, XTRun_TEST_REPORT_PROCESSOR_TAG, XTRun_TEST_RUN_TAG, XTRun_TEST_SUITE_TAG
XTS_ID_ATTRIBUTE, XTS_NAME_ATTRIBUTE, XTS_NAMESPACE_URI, XTS_TEST_GROUP_TAG, XTS_TEST_SUITE_TAG, XTS_TEST_TAG
XR_ARG_TAG, XR_CLASS_ATTRIBUTE, XR_NAME_ATTRIBUTE, XR_PROPERTY_TAG, XR_VALUE_ATTRIBUTE
Constructor and Description |
---|
XMLTestSuiteRunner() |
Modifier and Type | Method and Description |
---|---|
protected TestReportProcessor |
buildProcessor(org.w3c.dom.Element element)
Builds a
TestResultProcessor from an element. |
protected DefaultTestSuite |
buildTestRunTestSuite(org.w3c.dom.Element element)
Builds a
TestSuite from an input element. |
protected TestReportProcessor[] |
extractTestReportProcessor(org.w3c.dom.Element element)
Builds an array of
TestReportProcessor from the input
element, assuming the input element is a |
protected org.w3c.dom.Element[] |
getChildrenByTagName(org.w3c.dom.Element element,
java.lang.String tagName)
Gets all the children of a given type.
|
static void |
main(java.lang.String[] args) |
protected void |
processReport(TestReport report,
TestReportProcessor[] processors) |
TestReport |
run(org.w3c.dom.Document doc,
java.lang.String[] ids)
Runs the test suite described by the input
Document object.
|
protected TestReport |
run(org.w3c.dom.Element testRunElement,
java.lang.String[] ids) |
protected TestReport |
runTest(Test test) |
public static final java.lang.String MESSAGE_UNMATCHED_TEST_IDS
public static final java.lang.String CANNOT_CREATE_TEST_REPORT_PROCESSOR
TestreportProcessor
description.
{0} : the public static final java.lang.String TEST_SUITE_EXCEPTION
TestSuite
{0} : TestSuite
name
{1} : TestSuite
class name.
{1} : exception's class name.
{2} : exception's message
{3} : exception's stack trace.public static final java.lang.String TEST_REPORT_PROCESSING_EXCEPTION
TestReport
generated by the TestSuite
{0} : TestReportProcessor
class name.
{1} : exception's class name.
{2} : exception's message
{3} : exception's stack trace.public static final java.lang.String USAGE
public static final java.lang.String NOT_A_FILE_TRY_URI
public static final java.lang.String COULD_NOT_CONVERT_FILE_NAME_TO_URI
public static final java.lang.String INVALID_URI
public static final java.lang.String INVALID_DOCUMENT
public static final java.lang.String ERROR_RUNNING_TEST_SUITE
protected TestReportProcessor[] extractTestReportProcessor(org.w3c.dom.Element element) throws TestException
TestReportProcessor
from the input
element, assuming the input element is a TestException
protected TestReportProcessor buildProcessor(org.w3c.dom.Element element) throws TestException
TestResultProcessor
from an element.TestException
protected DefaultTestSuite buildTestRunTestSuite(org.w3c.dom.Element element) throws TestException
TestSuite
from an input element.
This method assumes that element is a <testRun>
instance. The element is scanned for children
<testSuite> elements which is loaded into
a Test
and composited into a TestSuite
TestException
protected org.w3c.dom.Element[] getChildrenByTagName(org.w3c.dom.Element element, java.lang.String tagName)
public TestReport run(org.w3c.dom.Document doc, java.lang.String[] ids) throws TestException
TestException
protected TestReport runTest(Test test) throws TestException
TestException
protected void processReport(TestReport report, TestReportProcessor[] processors) throws TestException
TestException
protected TestReport run(org.w3c.dom.Element testRunElement, java.lang.String[] ids) throws TestException
TestException
public static void main(java.lang.String[] args)