Store your test automation results in TestMonitor, alongside your manual tests, to get an overview of all your test efforts in a single place.
By integrating Selenium with TestMonitor you can keep all of your testing results in one place. Selenium allows you to automate tests, and by integrating it with TestMonitor you can also automatically record those test results. By tying Selenium’s automated tests with TestMonitor you can take advantage of features like risks and requirements while keeping all your data in one place for reporting and issue management.
How It Works
The integration with Selenium uses the TestNG framework. A listener is used so that every test result of every test case will automatically be sent to TestMonitor with no need to change any any of your Selenium test code.
Your test cases will be created in TestMonitor. Previously created test cases will be recognized by name and re-used, avoiding test case duplication. They are planned in a run and the test results will be stored.
Software RequirementsWhen you are integrating your Selenium tests in TestMonitor, we recommend to meet the following software requirements:
- Java 8 or newer
- Maven 3 or newer
- Selenium 3
Generate an API TokenBefore you integrate the TestMonitor API client in your test code, you’re going to need valid API credentials. To create an API token in TestMonitor:
- In the top menu, click the circle containing your avatar or initials and select My account.
- Scroll down to Personal Access Tokens and click the Create token button.
- Choose a name for your token and click Create. Your token will appear in the popup.
- Copy the personal access token immediately, it will not be available to view later.
Integrating the TestMonitor Client and ListenerAfter you’ve created your token, it’s time for the next step in the process. Follow the directions below to integrate TestMonitor with the listener:
- Integrate the TM client in your test code.
- Set up the TestNG listener and configure it to send data to your TM account. We’ve created a step-by-step guide on our GitHub page to get you started.
- Optionally, by implementing the HasWebdriver interface, Selenium test results will be annotated with a screenshot when test cases fail.
If you want to see the client in action in a different project, take a look at our example Selenium project
Using the IntegrationWhen everything is in place, you’re ready to run your Selenium test. Once started, the following actions will take place:
- The test cases will be executed.
- The TestNG listener will be triggered.
- Create a test suite with test cases in TestMonitor. When a test case already exists, it will be re-used.
- Create a new milestone in TestMonitor, or reuse it when it already exists.
- Create a new test run.
- Assign the test cases.
- Assign itself to the test run.
- Store test results for each test case in the run.
- When the test case passes, the test result category will be set to Passed.
- When the test case fails, the test result category will be set to Failed and a description of the error and screenshot will be included.
You can assign your test cases to requirements, risks, and applications. Once the test results have been stored, you can track them and link issues when needed. You can use the reports to analyze which test cases pass and fail, and where potential bottlenecks are.