org.xwiki.rendering.test.cts
Class CompatibilityTestSuite
java.lang.Object
org.junit.runner.Runner
org.junit.runners.ParentRunner<org.junit.runner.Runner>
org.junit.runners.Suite
org.xwiki.rendering.test.cts.CompatibilityTestSuite
- All Implemented Interfaces:
- org.junit.runner.Describable, org.junit.runner.manipulation.Filterable, org.junit.runner.manipulation.Sortable
public class CompatibilityTestSuite
- extends org.junit.runners.Suite
Run all tests found in resources files located in the classpath, for a given Syntax.
The algorithm is the following:
- Look for
cts/[scope] resources in the classpath where [scope] represents the value of the
@Scope annotation prefixed by cts\\.. By default if no Scope annotation is defined,
.\*\.xml is used, leading to a total regex of cts\\..\*\.xml. This is the regex that's used
to look for resources in the classpath. For example the following test file would match:
cts/simple/bold/bold1.inout.xml. We call these CTS resources.
- For each
CTS resource found look for equivalent test input and output files for the tested Syntax.
For example if we have cts/simple/bold/bold1.inout.xml then if the Syntax is xwiki/2.0 look
for xwiki20/simple/bold/bold1.[in|out|inout].txt test files. We call them SYN resources.
- For each
SYN IN resource, parse it with the corresponding Syntax parser and render the generated XDOM
with the CTS Renderer, and compare the results with the CTS OUT resource. Note that if no
SYN IN resource is found generate a warning in the test logs.
- For each
SYN OUT resource, parse the CTS IN resource with the CTS Syntax parser and render the
generated XDOM with the Syntax Renderer, and compare the results with the SYN OUT resource.
Note that if no SYN OUT resource is found generate a warning in the test logs.
Usage Example
@RunWith(CompatibilityTestSuite.class)
@Syntax("xwiki/2.0")
@Scope("simple")
public class IntegrationTests
{
}
It's also possible to get access to the underlying Component Manager used, for example in order to register
Mock implementations of components. For example:
@RunWith(CompatibilityTestSuite.class)
@Syntax("xwiki/2.0")
@Scope("simple")
public class IntegrationTests
{
@Initialized
public void initialize(ComponentManager componentManager)
{
// Init mocks here for example
}
}
- Since:
- 4.1M1
- Version:
- $Id: 68f0176227dcd7160f2059348d3e0b9a15ab7655 $
| Nested classes/interfaces inherited from class org.junit.runners.Suite |
org.junit.runners.Suite.SuiteClasses |
| Methods inherited from class org.junit.runners.Suite |
describeChild, emptySuite, runChild |
| Methods inherited from class org.junit.runners.ParentRunner |
childrenInvoker, classBlock, classRules, collectInitializationErrors, filter, getName, getRunnerAnnotations, getTestClass, run, runLeaf, setScheduler, sort, validatePublicVoidNoArgMethods, withAfterClasses, withBeforeClasses |
| Methods inherited from class org.junit.runner.Runner |
testCount |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
CompatibilityTestSuite
public CompatibilityTestSuite(Class<?> klass)
throws Exception
- Only called reflectively. Do not use programmatically.
- Parameters:
klass - the test instance class on which this Test Suite is applied
- Throws:
Exception - if we fail to locate or load test data, if the RenderingTest isn't a valid JUnit Test
class or if we cannot locate the Component Manager
getChildren
protected List<org.junit.runner.Runner> getChildren()
- Overrides:
getChildren in class org.junit.runners.Suite
getDescription
public org.junit.runner.Description getDescription()
-
We override this method so that the JUnit results are not displayed in a test hierarchy with a single test
result for each node (as it would be otherwise since RenderingTest has a single test method).
- Specified by:
getDescription in interface org.junit.runner.Describable- Overrides:
getDescription in class org.junit.runners.ParentRunner<org.junit.runner.Runner>
Copyright © 2004–2014 XWiki. All rights reserved.