Executing Tests - ChrisMell/OEL-wiki GitHub Wiki
Execution of a test can be done with JUnit or Maven. This guide will show how to do both.
Execution with Maven
Using Maven, the tester can execute all tests simply by using the command:
mvn clean verify
If testing only a subset of test classes, you can add an environment variable to your maven command:
mvn clean -Dit.test=ExampleTestSuite verify
This mvn goal uses the Maven Failsafe Plugin to select which tests to run. For more information about specifiying your test runners, visit the Running a Single Test documentation for the maven failsafe plugin.
Changing test configurations from Maven
In addition to specifying a specific test runner, the maven command also allows you to change other options such as the browser and the environment. This will override any configurations you have set in the serenity.properties file.
mvn clean -Dit.test=ExampleTestSuite -Denvironment=alpha -Dwebdriver.driver=edge
Execution with JUnit in IntelliJ
IntelliJ makes it simple to execute your test runner using IntelliJ. Note that since the report generation is a maven goal, executing using IntelliJ will not give you reports. JUnit execution is best used for debugging purposes.
- Open the framework code, and locate your test runners
- Right-click on the test runner you want to execute to bring up a context menu.
- Click on 'Run (TestSuiteName)'
This will run your test class using JUnit.