Manage Cypress Tests With TestBench – Part Two: Inspect And Report Test Results
Part Two of the Cypress blog series: How to manage, inspect and report your Cypress executions in TestBench CS.
In the first blog post, I wrote about what Cypress is and how you can use the API to import Cypress specs into TestBench CS.
Both TestBench and Cypress offer a comprehensive API so that a far-reaching, bidirectional integration is possible. The following figure illustrates the general procedure:
As a second integration step, we import Cypress test results into TestBench and link them to a single test session for each test run. Your benefit is that you are now easily able to inspect and report your Cypress executions in TestBench CS together with all your other test tools and methods using its great functionalities.
How does it work
To achieve this in our development and automation process, we integrate directly into Cypress using so-called hooks provided by the Mocha framework. Cypress uses those hooks to get the test results, and we extend them to send those to TestBench CS finally. All this is not that complicated or magic because we provide examples in our repository on GitHub. If you have read the first blog post on this topic, you may already be familiar with it.
Using the provided example, the only thing you have to do is set up your Cypress configuration as described in the README. That’s it.
If Cypress starts with one or more specification files, a new test session is created in TestBench CS. After the first test has finished, the test result, including test steps provided as cy.log entries (see the first post), are transformed into a TestBench test execution result. And they are immediately sent to TestBench. This test result is available in TestBench on its corresponding test case and in the newly created test session. This repeats with each test that is executed. After the last test, the test session in TestBench is closed, and you can access it and see all your test results.
Furthermore, if one of your tests failed, you will get a quick overview of which tests failed.
When you open the test execution, you will find the exact test step that failed.
With this, you now can track your Cypress specification (from stage 1) and also manage, inspect and report your Cypress executions with TestBench CS.
Any team already using Cypress for test automation can quickly and easily improve their test management by integrating it with TestBench and seamlessly connecting Cypress test automation with manual tests, exploratory tests, or other test automation tools. Conversely, Cypress is another test automation framework for teams using TestBench that is ideal for automating browser-based end-to-end tests.
All scripts presented are available for download in the TestBench GitHub.
A permanent free TestBench Basic license is available with a few clicks here:
Connected to the TestBench Basic license, you can also create and use your VirtualShowRoom.
Have fun using it in your project!
Written by Dipl. Inf. (FH) Holger Seidel
Holger Seidel has a degree in computer science and has been working for imbus AG since 2008. Until 2016, he was, among other things, involved in research projects as well as project manager in customer projects at the imbus TestCenter in the area of software test automation and as the person responsible for the IT infrastructure of the imbus TestCenter. Since 2016, he has been working in the TestBench team, initially as an architect for test automation and currently as the person responsible for infrastructure and development operations (DevOps) of TestBench CS, which is being developed across several locations.
Of course, there are many more ways to connect Cypress with TestBench CS.
Stay tuned for the upcoming blog post:
- Deploy and start Cypress Tests from TestBench