Package org.citrusframework.common
Class DefaultTestLoader
java.lang.Object
org.citrusframework.common.DefaultTestLoader
- All Implemented Interfaces:
org.citrusframework.common.TestLoader
- Direct Known Subclasses:
JavaTestLoader
Default test loader implementation takes case on test names/packages and initializes the test runner if applicable.
Also loads the test case and provides it to registered test handlers. This way a test case can be loaded from different sources
like Java code, Groovy code, XML, Json, YAML, etc.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Citrusprotected CitrusContextprotected org.citrusframework.context.TestContextprotected Stringprotected org.citrusframework.TestCaseRunnerprotected org.citrusframework.TestCaseprotected Class<?>protected StringFields inherited from interface org.citrusframework.common.TestLoader
GROOVY, JAVA, logger, RESOURCE_PATH, SPRING, TYPE_RESOLVER, XML, YAML -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor for full control over the loader.DefaultTestLoader(Class<?> testClass, String testName, String packageName, CitrusContext citrusContext) Constructor with context file and parent application context field for simple initialisation. -
Method Summary
Modifier and TypeMethodDescriptioncitrusContext(CitrusContext citrusContext) voidconfigureTestCase(Consumer<org.citrusframework.TestCase> configurer) context(org.citrusframework.context.TestContext context) protected voiddoLoad()Subclasses are supposed to overwrite this method on order to add logic how to load the test case (e.g. from XML, Json, YAML).voiddoWithTestCase(Consumer<org.citrusframework.TestCase> handler) org.citrusframework.TestCaseprotected voidSafely initialize default test runner if applicable.protected booleanReturn true if the throwable is considered a skip exception that must be passed up to the testing framework in order to report that this test was skipped.final voidload()packageName(String packageName) runner(org.citrusframework.TestCaseRunner runner) voidvoidsetCitrusContext(CitrusContext citrusContext) voidsetContext(org.citrusframework.context.TestContext context) voidsetPackageName(String packageName) voidsetRunner(org.citrusframework.TestCaseRunner runner) voidsetTestCase(org.citrusframework.TestCase testCase) voidsetTestClass(Class<?> testClass) voidsetTestName(String testName) testCase(org.citrusframework.TestCase testCase)
-
Field Details
-
citrus
-
citrusContext
-
context
protected org.citrusframework.context.TestContext context -
runner
protected org.citrusframework.TestCaseRunner runner -
testCase
protected org.citrusframework.TestCase testCase -
testClass
-
testName
-
packageName
-
configurer
-
handler
-
-
Constructor Details
-
DefaultTestLoader
public DefaultTestLoader()Default constructor for full control over the loader. -
DefaultTestLoader
public DefaultTestLoader(Class<?> testClass, String testName, String packageName, CitrusContext citrusContext) Constructor with context file and parent application context field for simple initialisation.
-
-
Method Details
-
load
public final void load()- Specified by:
loadin interfaceorg.citrusframework.common.TestLoader
-
isSkipExceptionType
Return true if the throwable is considered a skip exception that must be passed up to the testing framework in order to report that this test was skipped. Subclasses may override according to the framework -
doLoad
protected void doLoad()Subclasses are supposed to overwrite this method on order to add logic how to load the test case (e.g. from XML, Json, YAML). -
initializeTestRunner
protected void initializeTestRunner()Safely initialize default test runner if applicable. -
setCitrus
-
citrus
-
setCitrusContext
-
citrusContext
-
setContext
public void setContext(org.citrusframework.context.TestContext context) -
context
-
setRunner
public void setRunner(org.citrusframework.TestCaseRunner runner) -
runner
-
setTestCase
public void setTestCase(org.citrusframework.TestCase testCase) -
testCase
-
getTestCase
public org.citrusframework.TestCase getTestCase()- Specified by:
getTestCasein interfaceorg.citrusframework.common.TestLoader
-
setTestClass
- Specified by:
setTestClassin interfaceorg.citrusframework.common.TestLoader
-
testClass
-
setTestName
- Specified by:
setTestNamein interfaceorg.citrusframework.common.TestLoader
-
testName
-
setPackageName
- Specified by:
setPackageNamein interfaceorg.citrusframework.common.TestLoader
-
packageName
-
doWithTestCase
- Specified by:
doWithTestCasein interfaceorg.citrusframework.common.TestLoader
-
configureTestCase
- Specified by:
configureTestCasein interfaceorg.citrusframework.common.TestLoader
-