How to log into file in cypress? - cypress

i want to log each and every step of the process ex: sign up done, user dashboard opened , user profile edited. How can this be achieved by cypress. I tried this using node.js but as cypress runs in browser i cant create file using node.js and also i tried by cy.writefile where it replace the previous this i have written in the file. Is there a way to do this ???
After this i do want to send this log to an email.

Welcome to Stack Overflow. If you run Cypress on a CI Server like CircleCI, it can record your output.
There is also a --record option, where it saves the details of the session for you.
Cypress can record your tests running and make them available in our
Dashboard.
Recorded tests allow you to: See the number of failed, pending and
passing tests. Get the entire stack trace of failed tests. View
screenshots taken when tests fail and when using cy.screenshot().
Watch a video of your entire test run or a clip at the point of test
failure.
You can read more about recording sessions here https://docs.cypress.io/guides/guides/continuous-integration.html#Recording-tests-in-CI

Related

Re-run Cypress test in Github Actions does not work

I have a cypress workflow in Github and it runs nicely. But, when the e2e tests fail for some reason and I want to re-run them using the re-run all jobs button (below), the following message appears:
The run you are attempting to access is already complete and will not accept new groups.
The existing run is: https://dashboard.cypress.io/projects/abcdef/runs
When a run finishes all of its groups, it waits for a configurable set of time before finally completing. You must add more groups during that time period.
The --tag flag you passed was:
The --group flag you passed was: core
What should I change in my configuration to make these possible? Sometimes the e2e fails because of a backend error that is fixed later.
I'd like to do this instead of a force e2e commit.
I was facing the same issue before.
I think you can try to pass GITHUB_TOKEN or add a custom build id. It fixed my issue. Hoep it helps.
https://github.com/cypress-io/github-action#custom-build-id
Check your Cypress Dashboard subscription plan. Mine got the free plan full (500 test for free and I was running in 3 different browsers 57 tests, so it got full pretty quick since this is 171 tests in one run) and after that it didn't allowed me to keep running or re running more parallel tests. Test kept running but in 1 machine out of 4 in the first browser and stages for the other 2 browsers started failing, I was able to allow the pipeline to not be failing by passing continueOnError: true in the configuration.
Quick edit, I don't remember where but I read that you could also add a delay to your pipeline and/or reduce the default wait on the Dashboard which is 60s(https://docs.cypress.io/guides/guides/parallelization#Run-completion-delay)

How to re-run only failed tests (failed data row) in visual studio test task?

We have a build pipeline for our automated scripts (selenium) in Azure-Devops. And we use browserstack to run all our scripts. Sometimes we get timeout issue, no matter what we implement additional options to browser settings we still get timeout. So we decided to re run the tests to certain limit and then the pass percentage went high and scripts were passed without any issues.
So we have different data rows for each test method. Now when a test method for a particular data row is failed then the entire test (including all the passed data row) are getting executed again in the re-run which is unnecessary since some are passed.
Is there any way to run only failed data row test ?
As seen in below screenshot on the regular attempt, data row 0 is failed and others passed. So it goes for re-run and running all the passed test again.
Test result screenshot
Note: Using Batch option to re-run the failed tests. Also tried with Automatic batch option where it failed to re-run because of test name issue of vstest.console.exe (There is formatting issue if the test name has spaces or round braces)

View result file in Jmeter

Need a help in jmeter. When we run jmeter from GUI mode, we can see the instant results in UI and that gets auto refreshed in milliseconds or lesser.
But when I run jmeter from command line , in non GUI mode it still creates the result file and I can view it by another jmeter and with the adding an aggregate report listener to it. It opens the results with a pop up alert message but does not refresh it. For getting the updated results , need to browse and open it again .
So is there any way/plugin to open the file to view with auto refreshed as we can view while running in GUI mode.
Thanks
It is not recommended to use listeners during test run, even if it is done via another instance of JMeter. Wait for the test to finish and then perform the analysis.
If for some reason looking into interim stats is absolutely required I would recommend running your JMeter test using Taurus tool as a wrapper, you'll be able to see some statistics and graphs this way:

How to get the test outcome programmatically?

I am using the Visual Studio agents to run VS coded UI tests on a remote test server (the test agent) from my own developer machine (the test controller).
When running tests locally, I was able to access and read the TRX results file that is created once the test had completed, but I am unable to access this file on the remote test server since the TRX results file remains within the Visual Studio folder on the test controller.
The reason I want to access the results file programmatically as I have code to read the file and then to send out the result as an automated email.
So, is there any way to get the outcome of the test programmatically so that I can send out the results email automatically?
Ideally, I would be able to get access to the TRX results file from the test server but I'm not sure if this is feasible or possible.
If you run the coded ui inside of a load test, you can set it to write to the LoadTest2010 database. From there you can set up ways to get the results and trigger events as with any database.

How can i check my script is working fine in JMeter?

I am new to JMeter. I did my first script in JMeter.
My scenario is: clicking a button, i.e. after login, click that button. Thats it. Upto this i have recorded for my script using JMeter.
When i run for single user, it gives proper output for any different user. But when i run with concurrent users (2 or more users with User Parameters pre-processor), it shows error in clicking that button.
I have used View Results Tree as listener to see the results.
In sometimes, it does not show error. So i can't identify the exact reason, why it fails.
Can you please anyone can guide me regarding this?
I am completely new to this JMeter.
Thanks in Advance,
A 500 internal server error indicates jmeter is making the connection to your server and your server is having difficulty processing the request. You should probably look at your server log files to see if there are any errors or exceptions (apache/jetty/etc log file).
Additionally, when you DO actually have an issue with jmeter and you can't seem to figure out what is going on from your listener output, you can view the jmeter.log file created in the directory when jmeter is run from. This usually gives more detailed information regarding failures in jmeter.

Resources