Package org.apache.batik.test.xml
Class XMLTestSuiteRunner
- java.lang.Object
-
- org.apache.batik.test.xml.XMLTestSuiteRunner
-
- All Implemented Interfaces:
XMLReflectConstants,XTRunConstants,XTSConstants
public class XMLTestSuiteRunner extends java.lang.Object implements XTRunConstants, XTSConstants
This class can be used to build and run aTestSuitefrom an XML description following the "XML Test Run" and "XML Test Suite" formats, whose constants are defined in theXTRunConstantsandXTSConstantsinterfaces. This class takes a "Test Run" XML description as an input. That description contains:
+ pointers to a number of "Test Suite" XML descriptions, which contain the definition of the set ofTeststo be run and their configuration.
+ a description of the set ofTestReportProcessorand their configuration that should be used to process the reports generated by the variousTestSuites.- Version:
- $Id: XMLTestSuiteRunner.java 1806580 2017-08-29 12:06:44Z ssteiner $
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classXMLTestSuiteRunner.AcceptAllTestsFilterTest filter which accepts all testsstatic classXMLTestSuiteRunner.IdBasedTestFilterTest filter which only accepts tests with ids matching the ones passed to its constructor.
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringCANNOT_CREATE_TEST_REPORT_PROCESSORAn error happened while processing aTestreportProcessordescription.static java.lang.StringCOULD_NOT_CONVERT_FILE_NAME_TO_URIDisplayed when the input file name cannot be turned into a URLstatic java.lang.StringERROR_RUNNING_TEST_SUITEError displayed when an error occurs while running the test suitestatic java.lang.StringINVALID_DOCUMENTDisplayed when the input document cannot be parsed.static java.lang.StringINVALID_URIDisplayed when the input argument does not represent a valid URIstatic java.lang.StringMESSAGE_UNMATCHED_TEST_IDSDisplayed when no test or testSuite matching the input id was found.static java.lang.StringNOT_A_FILE_TRY_URIDisplayed 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.StringTEST_REPORT_PROCESSING_EXCEPTIONAn error happened while processing theTestReportgenerated by theTestSuite{0} :TestReportProcessorclass name.static java.lang.StringTEST_SUITE_EXCEPTIONAn error happened while running theTestSuite{0} :TestSuitename {1} :TestSuiteclass name.static java.lang.StringUSAGEDisplayed when the user passes no arguments to the command line.-
Fields inherited from interface org.apache.batik.test.xml.XMLReflectConstants
XR_ARG_TAG, XR_CLASS_ATTRIBUTE, XR_NAME_ATTRIBUTE, XR_PROPERTY_TAG, XR_VALUE_ATTRIBUTE
-
Fields inherited from interface org.apache.batik.test.xml.XTRunConstants
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
-
Fields inherited from interface org.apache.batik.test.xml.XTSConstants
XTS_ID_ATTRIBUTE, XTS_NAME_ATTRIBUTE, XTS_NAMESPACE_URI, XTS_TEST_GROUP_TAG, XTS_TEST_SUITE_TAG, XTS_TEST_TAG
-
-
Constructor Summary
Constructors Constructor Description XMLTestSuiteRunner()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected TestReportProcessorbuildProcessor(org.w3c.dom.Element element)Builds aTestResultProcessorfrom an element.protected DefaultTestSuitebuildTestRunTestSuite(org.w3c.dom.Element element)Builds aTestSuitefrom an input element.protected TestReportProcessor[]extractTestReportProcessor(org.w3c.dom.Element element)Builds an array ofTestReportProcessorfrom the input element, assuming the input element is a <testSuite> instance,protected org.w3c.dom.Element[]getChildrenByTagName(org.w3c.dom.Element element, java.lang.String tagName)Gets all the children of a given type.static voidmain(java.lang.String[] args)protected voidprocessReport(TestReport report, TestReportProcessor[] processors)TestReportrun(org.w3c.dom.Document doc, java.lang.String[] ids)Runs the test suite described by the input Document object.protected TestReportrun(org.w3c.dom.Element testRunElement, java.lang.String[] ids)protected TestReportrunTest(Test test)
-
-
-
Field Detail
-
MESSAGE_UNMATCHED_TEST_IDS
public static final java.lang.String MESSAGE_UNMATCHED_TEST_IDS
Displayed when no test or testSuite matching the input id was found. {0} : unmatched id set- See Also:
- Constant Field Values
-
CANNOT_CREATE_TEST_REPORT_PROCESSOR
public static final java.lang.String CANNOT_CREATE_TEST_REPORT_PROCESSOR
An error happened while processing aTestreportProcessordescription. {0} : the <testReportProcessor> "className" attribute value {1} : exception's class name {2} : exception's message {3} : exception's stack trace- See Also:
- Constant Field Values
-
TEST_SUITE_EXCEPTION
public static final java.lang.String TEST_SUITE_EXCEPTION
An error happened while running theTestSuite{0} :TestSuitename {1} :TestSuiteclass name. {1} : exception's class name. {2} : exception's message {3} : exception's stack trace.- See Also:
- Constant Field Values
-
TEST_REPORT_PROCESSING_EXCEPTION
public static final java.lang.String TEST_REPORT_PROCESSING_EXCEPTION
An error happened while processing theTestReportgenerated by theTestSuite{0} :TestReportProcessorclass name. {1} : exception's class name. {2} : exception's message {3} : exception's stack trace.- See Also:
- Constant Field Values
-
USAGE
public static final java.lang.String USAGE
Displayed when the user passes no arguments to the command line.- See Also:
- Constant Field Values
-
NOT_A_FILE_TRY_URI
public static final 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.- See Also:
- Constant Field Values
-
COULD_NOT_CONVERT_FILE_NAME_TO_URI
public static final java.lang.String COULD_NOT_CONVERT_FILE_NAME_TO_URI
Displayed when the input file name cannot be turned into a URL- See Also:
- Constant Field Values
-
INVALID_URI
public static final java.lang.String INVALID_URI
Displayed when the input argument does not represent a valid URI- See Also:
- Constant Field Values
-
INVALID_DOCUMENT
public static final java.lang.String INVALID_DOCUMENT
Displayed when the input document cannot be parsed. {0} : uri of the invalid document. {1} : exception generated while parsing {2} : exception message- See Also:
- Constant Field Values
-
ERROR_RUNNING_TEST_SUITE
public static final java.lang.String ERROR_RUNNING_TEST_SUITE
Error displayed when an error occurs while running the test suite- See Also:
- Constant Field Values
-
-
Method Detail
-
extractTestReportProcessor
protected TestReportProcessor[] extractTestReportProcessor(org.w3c.dom.Element element) throws TestException
Builds an array ofTestReportProcessorfrom the input element, assuming the input element is a <testSuite> instance,- Throws:
TestException
-
buildProcessor
protected TestReportProcessor buildProcessor(org.w3c.dom.Element element) throws TestException
Builds aTestResultProcessorfrom an element.- Throws:
TestException
-
buildTestRunTestSuite
protected DefaultTestSuite buildTestRunTestSuite(org.w3c.dom.Element element) throws TestException
Builds aTestSuitefrom an input element. This method assumes that element is a <testRun> instance. The element is scanned for children <testSuite> elements which is loaded into aTestand composited into aTestSuite- Throws:
TestException
-
getChildrenByTagName
protected org.w3c.dom.Element[] getChildrenByTagName(org.w3c.dom.Element element, java.lang.String tagName)Gets all the children of a given type.
-
run
public TestReport run(org.w3c.dom.Document doc, java.lang.String[] ids) throws TestException
Runs the test suite described by the input Document object. If the input ids array is null or of zero length, then all the tests will be run. Otherwise, only the tests identified by the array will be run.- Throws:
TestException
-
runTest
protected TestReport runTest(Test test) throws TestException
- Throws:
TestException
-
processReport
protected void processReport(TestReport report, TestReportProcessor[] processors) throws TestException
- Throws:
TestException
-
run
protected TestReport run(org.w3c.dom.Element testRunElement, java.lang.String[] ids) throws TestException
- Throws:
TestException
-
main
public static void main(java.lang.String[] args)
-
-