@Retention(value=RUNTIME) @Target(value=METHOD) public @interface Script
ScriptRule TestRule.
The name of the script is optional and if omitted the package name is used as directory
and the ClassName.MethodName.ScriptExtension as filename. Additionally a list of
variables can be defined and the execute flag decides whether the script is execute
before the test function is called.
The script variables can be accessed trough the ScriptRule.variables
field.
Example usage:
@Test
@Script
public void scriptNameWithoutExtension() {
\\...
}
@Test
@Script("scriptNameWithoutExtension")
public void notTheScriptName() {
\\...
}
@Test
@Script(
name = "scriptNameWithoutExtension",
variables = {
@ScriptVariable(name="a", value="b"),
@ScriptVariable(name="f", file="test.xml")
}
)
public void notTheScriptName() {
\\...
}
@Test
@Script(
name = "scriptNameWithoutExtension",
execute = false
)
public void notTheScriptName() {
Map variables = Collections.singletonMap("a", "b");
script.execute(variables)
assertEquals("b", script.variables.get("a"))
}
public abstract String value
public abstract String name
public abstract ScriptVariable[] variables
Copyright © 2014–2020 Camunda Services GmbH. All rights reserved.