Package org.citrusframework.common
Class DefaultTestLoader
java.lang.Object
org.citrusframework.common.DefaultTestLoader
- All Implemented Interfaces:
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 TestContextprotected Stringprotected TestCaseRunnerprotected 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<TestCase> configurer) 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<TestCase> handler) protected 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(TestCaseRunner runner) voidvoidsetCitrusContext(CitrusContext citrusContext) voidsetContext(TestContext context) voidsetPackageName(String packageName) voidsetRunner(TestCaseRunner runner) voidsetTestCase(TestCase testCase) voidsetTestClass(Class<?> testClass) voidsetTestName(String testName)
-
Field Details
-
citrus
-
citrusContext
-
context
-
runner
-
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 interfaceTestLoader
-
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
-
context
-
setRunner
-
runner
-
setTestCase
-
testCase
-
getTestCase
- Specified by:
getTestCasein interfaceTestLoader
-
setTestClass
- Specified by:
setTestClassin interfaceTestLoader
-
testClass
-
setTestName
- Specified by:
setTestNamein interfaceTestLoader
-
testName
-
setPackageName
- Specified by:
setPackageNamein interfaceTestLoader
-
packageName
-
doWithTestCase
- Specified by:
doWithTestCasein interfaceTestLoader
-
configureTestCase
- Specified by:
configureTestCasein interfaceTestLoader
-