public class CompatibilityTestSuite
extends org.junit.runners.Suite
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.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.
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.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
}
}
Constructor and Description |
---|
CompatibilityTestSuite(Class<?> klass)
Only called reflectively.
|
Modifier and Type | Method and Description |
---|---|
protected List<org.junit.runner.Runner> |
getChildren() |
org.junit.runner.Description |
getDescription() |
childrenInvoker, classBlock, classRules, collectInitializationErrors, createTestClass, filter, getName, getRunnerAnnotations, getTestClass, isIgnored, run, runLeaf, setScheduler, sort, validatePublicVoidNoArgMethods, withAfterClasses, withBeforeClasses
public CompatibilityTestSuite(Class<?> klass) throws Exception
klass
- the test instance class on which this Test Suite is appliedException
- 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 Managerprotected List<org.junit.runner.Runner> getChildren()
getChildren
in class org.junit.runners.Suite
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).
getDescription
in interface org.junit.runner.Describable
getDescription
in class org.junit.runners.ParentRunner<org.junit.runner.Runner>
Copyright © 2004–2019 XWiki. All rights reserved.