JUnit Plugin - Macros¶
Contents :
# EXECUTE_JUNIT_TEST {displayName} FROM {qualifiedClass} IN {bundlePath}¶
What ?
This macro will execute a JUnit test and verify that the result is a success.
Underlying instructions :
LOAD {bundlePath} AS junit5{%%r1}.file
CONVERT junit5{%%r1}.file TO script.java(compile) AS junit5{%%r1}.bundle
CONVERT junit5{%%r1}.bundle TO script.junit5(structured) AS junit5{%%r1}.script
EXECUTE execute WITH junit5{%%r1}.script AS junit5{%%1}.result USING $(qualifiedClassName:{qualifiedClass},displayName:{displayName})
ASSERT junit5{%%1}.result IS success
> Input :
{qualifiedClass}
: The qualified name of the class containing the test to execute.{displayName}
: The name of the test to execute. Make sure the diplay name of the test is unique in the class being tested.{bundlePath}
: The path to the java code bundle, including resources and compiled java classes.
Example :
# EXECUTE_JUNIT_TEST testSelenium2JUnit4 FROM org.squashtest.Selenium2JUnit4 IN selenium File to process :
The folder containing the resources to process :
SKF script :
# EXECUTE_JUNIT_TEST {displayName} FROM {qualifiedClass} IN {bundlePath} WITH COMPILE OPTIONS {options}¶
What ?
This macro will execute a JUnit test, with compile options, and verify that the result is a success.
Underlying instructions :
LOAD {bundlePath} AS junit5{%%r1}.file
CONVERT junit5{%%r1}.file TO script.java(compile) USING {options} AS junit5{%%r1}.bundle
CONVERT junit5{%%r1}.bundle TO script.junit5(structured) AS junit5{%%r1}.script
EXECUTE execute WITH junit5{%%r1}.script AS junit5{%%1}.result USING $(qualifiedClassName:{qualifiedClass},displayName:{displayName})
ASSERT junit5{%%1}.result IS success
> Input :
{qualifiedClass}
: The qualified name of the class containing the test to execute.
{displayName}
: The name of the test to execute. Make sure the diplay name of the test is unique in the class being tested.
{bundlePath}
: The path to the java code bundle, including resources and compiled java classes.
{options}
: The name of the configuration resource. It represents a configuration file containing java compilation options (possible options are those of the Java compiler present on the machine). In this file options can be written :
- In line separated with a space character
- One option per line
- A mix of both
Example :
# EXECUTE_JUNIT_TEST testSelenium2JUnit4 FROM org.squashtest.Selenium2JUnit4 IN selenium WITH COMPILE OPTIONS compile.options.file First file to process :
Second file to process :
The folder containing the resources to process :
SKF script :