In our previous blog we talked about mocha reports, and in this will continue on the same topic report generation with cypress. The only difference is that here we will talk about the Dashboard Report Generation with cypress.
So you guys may be thinking why do we need to configure the dashboard, if we can generate report with Mocha report generators?
Just wait for a few mins, and I am sure after reading this blog you will get your answer.
Before starting with report generation lets talk about what is Dashboard in cypress and what are the benefits of dashboard reports.
The Dashboard provides us insight into what happened when our tests ran.
Cypress Dashboard report helps Team members as well as business people to understand the result of the executed test cases.
- Dashboard report helps us to see the number of failed, passing, pending, and skipped tests.
- It helps us to get the entire stack trace of failed tests.
- We can watch a video of our entire test run or a video clip at the point of test failure.
These are some additional features of Dashboard which are not there with Mocha Reports, that’s why configuring Dashboard for your project is more useful and beneficial.
Dashboard Report Generation:
For generating the Dashboard report first we need to configure our dashboard. It is a one-time activity.
After running our tests we can see the recordings in the Dashboard, and it will be in the “Runs” tab of the test runner.
here as you can see that we have not configured the dashboard and it is providing an option to do so.
After setting up the Dashboard it will generate a unique key, which we will use to generate our Dashboard report.
So, till now we have generated the key and configured our Dashboard. Now let’s begin with running our cypress tests and generating the Dashboard report.
we can use the following commands to generate the Dashboard Reports:
npx cypress run --record --key <record key> //for running all the tests. npx cypress run --record --key <record key> --spec "testFile.spec.js //for running specific spec file.
After executing the above commands, we can see the generated report on the dashboard.
for the opening dashboard, we can either click on the link which will be generated while running the cypress tests or we can open the Dashboard via clicking on go to dashboard link in the “Run” tab in the test runner.
Once we will click on the dashboard we will be able to see the reports like this: