github-action icon indicating copy to clipboard operation
github-action copied to clipboard

Save Test Results to File or Action Output

Open ChrisPage-AT opened this issue 1 year ago • 6 comments

Would it be possible to have an option to save the test results to a file instead of posting a job summary? My use case is I am using the parallel: true flag to run across multiple runners and I want to combine the test results into one post per group: instead of each parallel run having their own. The easiest way I can think to accomplish this is to save what would normally put to the job summary into a file (json, csv, etc) and upload those as artifacts. Then I can have a job that waits for all the parallel jobs to complete, aggregates the results, and posts a single summary.

If that's not possible, I could create such a file myself if the various fields such as testResults.totalPassed were exposed as action outputs.

ChrisPage-AT avatar Mar 12 '24 14:03 ChrisPage-AT

@ChrisPage-AT

Are you using Cypress Cloud to view your results?

Most pages on Cypress Cloud Analytics allow download reports in CSV format. It's the small cloud symbol on the top right.

  • There was also a PR https://github.com/cypress-io/github-action/pull/949 submitted, but unfortunately there was no agreement reached between the submitter and the Cypress.io team, so eventually it was closed as being stale.

MikeMcC399 avatar Mar 12 '24 15:03 MikeMcC399

Ah, I see closed PR now. Do you know if this is something the Cypress.io team is interested in still? Those totalDuration, totalFailed, totalPassed, etc fields would help me do what I need to. The current Summary output works fine for parallel: false jobs just fine, but this would make the parallel: true jobs output much cleaner.

We do use Cypress Cloud to view the results, but not everyone has access or knows how to view the results. The $GITHUB_STEP_SUMMARY output in the test pipeline is useful for helping non-QA folks determine if they created a new test failure or if it's one that was already failing that day.

I can try and download the csv report via api call and display the information that way, but I figured just getting test output from the step would be easier since it already has that information.

ChrisPage-AT avatar Mar 12 '24 19:03 ChrisPage-AT

Having the simple stats report would be fine and this was the feedback in the PR - version, totalDuration, totalFailed, totalPassed, totalPending, totalSkipped, totalSuites and totalTests. We don't want the entirety of results or config printed since this could impact performance and also opens up opportunity to users to accidentally expose secrets within the GitHub output.

jennifer-shehane avatar Mar 12 '24 20:03 jennifer-shehane

That would be perfectly fine since if anyone needs that much detail they can just look at the Cypress Cloud site. I'm just looking for whatever data variables you'd use for the GITHUB_STEP_SUMMARY to also be exported as outputs.

ChrisPage-AT avatar Mar 13 '24 20:03 ChrisPage-AT

We'd also like the same thing. Our usecase is we want to grep the output to post to slack the exact test cases that failed. Is there any way to do that?

erezarnon avatar Apr 21 '24 15:04 erezarnon

+1 for this feature, I'm looking for a similar use case using parallel tests. IMO it would be cleaner and easier to read if these tables were all together in 1 summary instead of 5 different ones, since by default GitHub only shows the first 3 summaries: https://github.com/bahmutov/cypress-examples/actions/runs/10608410827

nrgbistro avatar Aug 29 '24 16:08 nrgbistro