public class QFTest
extends java.lang.Object
implements java.lang.Iterable<DynamicNode>
QFTest.Test, which can be used to embed
QF-Test test suites and/or run logs in JUnit 5 Tests.
Technically, QF-test is started in batch mode to execute the specified test suites, and the generated run logs are then transformed into the JUnit 5 test results.
Example:
import de.qfs.apps.qftest.junit5.QFTest
public class QFTestDummyTest
{
@QFTest.Test
QFTest blaTest() throws Exception {
return QFTest.runSuites("/tmp/err.qft#unbenannt.unbenannt2",
"/tmp/test.qft",
"initializeTests_2203112117_own_w10t6_3.qzp");
}
}
To include the QFTest tests into your JUnit 5 test run, include these libs from the QF-Test installation directory
into your test run classpath:
| Modifier and Type | Class and Description |
|---|---|
static class |
QFTest.Error |
static class |
QFTest.SystemProperties
System properties which can be used to globally modify parameters for the QF-Test run.
|
static interface |
QFTest.Test
The annotation to use with a JUnit 5 test method, which returns an object of
QFTest as result. |
| Modifier | Constructor and Description |
|---|---|
protected |
QFTest() |
| Modifier and Type | Method and Description |
|---|---|
static java.io.File |
getQFTestBinary()
Helper method to return the QF-Test binary used to run th QF-Test tests.
|
static java.io.File |
getVersionDir()
Helper method to get the property of "qftest:dir.version".
|
java.util.Iterator<DynamicNode> |
iterator() |
static boolean |
openReport(java.io.File reportPath)
Helper method to open a report in the browser.
|
static boolean |
openReport(java.nio.file.Path reportPath)
Helper method to open a report in the browser.
|
static boolean |
openReport(java.lang.String reportPath)
Helper method to open a report in the browser.
|
QFTest |
paths(java.lang.String... testsuitePaths)
Add the specified test suites or run logs to the test run.
|
static QFTest |
runSuite(java.io.File testsuite)
Run the specified test suite during the JUnit test run.
|
static QFTest |
runSuite(java.nio.file.Path testsuite)
Run the specified test suite during the JUnit test run.
|
static QFTest |
runSuite(java.lang.String testsuitePath)
Run the specified test suite during the JUnit test run.
|
static QFTest |
runSuites(java.io.File... testsuites)
Run the specified test suites during the JUnit test run.
|
static QFTest |
runSuites(java.nio.file.Path... testsuites)
Run the specified test suites during the JUnit test run.
|
static QFTest |
runSuites(java.lang.String... testsuitePaths)
Run the specified test suites during the JUnit test run.
|
static java.lang.String |
startProcess(java.lang.String... args)
Deprecated.
|
static java.lang.String |
startQFTestProcess(java.lang.String... args)
Helper method, starts a QF-Test process with the given arguments and returns the process output.
|
QFTest |
suites(java.lang.String... testsuitePaths)
Add the specified test suites to the test run.
|
QFTest |
withArgument(java.lang.String argument)
Adds a QF-Test arguments to the test run.
|
QFTest |
withArguments(java.lang.String... arguments)
Adds QF-Test arguments to the test run.
|
QFTest |
withLicense(java.io.File licenseFile)
Specifies an explicit license to use for the test run (similar to the
-license argument). |
QFTest |
withLicense(java.nio.file.Path licenseFile)
Specifies an explicit license to use for the test run (similar to the
-license argument). |
QFTest |
withLicense(java.lang.String license)
Specifies an explicit license to use for the test run.
|
QFTest |
withOption(java.lang.String optionName,
java.lang.String optionValue)
Sets a QF-Test option for the test run.
|
QFTest |
withOptions(java.lang.String... optionNamesAndValues)
Sets multiple QF-Test option for the test run.
|
QFTest |
withReport()
Enables report generation after the tests have been executed.
|
QFTest |
withReport(java.io.File reportDir,
java.lang.String... reportArguments)
Enables report generation after the tests have been executed.
|
QFTest |
withReport(java.nio.file.Path reportDir,
java.lang.String... reportArguments)
Enables report generation after the tests have been executed.
|
QFTest |
withReport(java.lang.String reportDir,
java.lang.String... reportArguments)
Enables report generation after the tests have been executed.
|
QFTest |
withReportOpen()
If specified, a report is generated after the tests are run, and the report will be opened in the browser, if possible.
|
QFTest |
withRunLogPath(java.io.File runLogDirOrFile)
Specify the directory where created QF-Test run logs will be stored, or the run log file directly.
|
QFTest |
withRunLogPath(java.io.File runLogDirOrFile,
boolean keepSuccessfullRunLog)
Specify the directory where created QF-Test run logs will be stored, or the run log file directly.
|
QFTest |
withRunLogPath(java.nio.file.Path runLogDirOrFile)
Specify the directory where created QF-Test run logs will be stored, or the run log file directly.
|
QFTest |
withRunLogPath(java.nio.file.Path runLogDirOrFile,
boolean keepSuccessfullRunLog)
Specify the directory where created QF-Test run logs will be stored, or the run log file directly.
|
QFTest |
withRunLogPath(java.lang.String runLogPathname)
Specify the directory where created QF-Test run logs will be stored, or the run log file directly.
|
QFTest |
withRunLogPath(java.lang.String runLogPathname,
boolean keepSuccessfullRunLog)
Specify the directory where created QF-Test run logs will be stored, or the run log file directly.
|
QFTest |
withVariable(java.lang.String variableName,
java.lang.String variableValue)
Sets a QF-Test variable for the test run.
|
QFTest |
withVariables(java.lang.String... variableNamesAndValues)
Sets multiple QF-Test variables for the test run.
|
public static QFTest runSuite(java.lang.String testsuitePath)
testsuitePath - The path of the test suite to run or run log to includeQFTest, which can be returned by a test method
to include the test suites into the JUnit 5 test runpublic static QFTest runSuite(java.io.File testsuite)
testsuites - The test suite to run or run log to includeQFTest, which can be returned by a test method
to include the test suites into the JUnit 5 test runpublic static QFTest runSuite(java.nio.file.Path testsuite)
testsuite - The path of the test suite to run or run log to includeQFTest, which can be returned by a test method
to include the test suites into the JUnit 5 test runpublic static QFTest runSuites(java.lang.String... testsuitePaths)
testsuitePaths - The paths of the test suites to run or run logs to includeQFTest, which can be returned by a test method
to include the test suites into the JUnit 5 test runpublic static QFTest runSuites(java.io.File... testsuites)
testsuites - The test suites to run or run logs to includeQFTest, which can be returned by a test method
to include the test suites into the JUnit 5 test runpublic static QFTest runSuites(java.nio.file.Path... testsuites)
testsuites - The paths of the test suites to run or run logs to includeQFTest, which can be returned by a test method
to include the test suites into the JUnit 5 test runpublic static java.io.File getQFTestBinary()
public static java.lang.String startQFTestProcess(java.lang.String... args)
throws de.qfs.lib.util.ProcessManager.RunProcessException
args - The arguments to start QF-Test withde.qfs.lib.util.ProcessManager.RunProcessException - Thrown if an error occurs during execution@Deprecated
public static java.lang.String startProcess(java.lang.String... args)
throws de.qfs.lib.util.ProcessManager.RunProcessException
de.qfs.lib.util.ProcessManager.RunProcessExceptionpublic static java.io.File getVersionDir()
public static boolean openReport(java.lang.String reportPath)
reportPath - The path to the report directory or HTML filetrue, when the report could be opened, false otherwisepublic static boolean openReport(java.io.File reportPath)
reportPath - The file of the report directory or HTML filetrue, when the report could be opened, false otherwisepublic static boolean openReport(java.nio.file.Path reportPath)
reportPath - The path to the report directory or HTML filetrue, when the report could be opened, false otherwisepublic QFTest paths(java.lang.String... testsuitePaths)
testsuitePaths - the files to add to the test runthis for method chainingpublic QFTest suites(java.lang.String... testsuitePaths)
testsuitePaths - the files to add to the test runthis for method chainingpublic QFTest withArgument(java.lang.String argument)
argument - The QF-Test argument to addthis for method chainingpublic QFTest withArguments(java.lang.String... arguments)
arguments - The QF-Test arguments to addthis for method chainingpublic QFTest withLicense(java.lang.String license)
-license argument, but you can also provide
directly the text content of the license file.license - The QF-Test license to usethis for method chainingpublic QFTest withLicense(java.io.File licenseFile)
-license argument).license - The QF-Test license file to usethis for method chainingpublic QFTest withLicense(java.nio.file.Path licenseFile)
-license argument).license - The QF-Test license file to usethis for method chainingpublic QFTest withOption(java.lang.String optionName, java.lang.String optionValue)
optionName - The name of the option to setoptionValue - The option value to usethis for method chainingpublic QFTest withOptions(java.lang.String... optionNamesAndValues)
optionNamesAndValues - Option names and values alternating.this for method chainingpublic QFTest withVariable(java.lang.String variableName, java.lang.String variableValue)
variableName - The name of the variable to setvariableValue - The variable value to usethis for method chainingpublic QFTest withVariables(java.lang.String... variableNamesAndValues)
variableNamesAndValues - Variable names and values alternating.this for method chainingpublic QFTest withRunLogPath(java.lang.String runLogPathname)
runLogPathname - The path name of the file or directory to use for the run logthis for method chainingpublic QFTest withRunLogPath(java.io.File runLogDirOrFile)
runLogDirOrFile - The file or directory to use for the run logthis for method chainingpublic QFTest withRunLogPath(java.nio.file.Path runLogDirOrFile)
runLogPathname - The path of the file or director to use for the run logthis for method chainingpublic QFTest withRunLogPath(java.lang.String runLogPathname, boolean keepSuccessfullRunLog)
runLogPathname - The path name of the file or directory to use for the run logkeepSuccessfullRunLog - If true, logs of successful executions will be kept, otherwise
they will be removed after the test run.this for method chainingpublic QFTest withRunLogPath(java.io.File runLogDirOrFile, boolean keepSuccessfullRunLog)
runLogDirOrFile - The file or directory to use for the run logkeepSuccessfullRunLog - If true, logs of successful executions will be kept, otherwise
they will be removed after the test run.this for method chainingpublic QFTest withRunLogPath(java.nio.file.Path runLogDirOrFile, boolean keepSuccessfullRunLog)
runLogDirOrFile - The path of the file or directory to use for the run logkeepSuccessfullRunLog - If true, logs of successful executions will be kept, otherwise
they will be removed after the test run.this for method chainingpublic QFTest withReport()
this for method chainingpublic QFTest withReport(java.lang.String reportDir, java.lang.String... reportArguments)
reportDir - The pathname of the target directory for the report. If null, a temporary directory will be created and usedreportArguments - Additional QF-Test arguments which will be used during report generationthis for method chainingpublic QFTest withReport(java.io.File reportDir, java.lang.String... reportArguments)
reportDir - The target directory for the report. If null, a temporary directory will be created and usedreportArguments - Additional QF-Test arguments which will be used during report generationthis for method chainingpublic QFTest withReport(java.nio.file.Path reportDir, java.lang.String... reportArguments)
reportDir - The path of a target directory for the report. If null, a temporary directory will be created and usedreportArguments - Additional QF-Test arguments which will be used during report generationthis for method chainingpublic QFTest withReportOpen()
this for method chainingpublic java.util.Iterator<DynamicNode> iterator()
iterator in interface java.lang.Iterable<DynamicNode>