Get test results list automatically

I have TeamCity project which runs NUnit tests.
I can get test results as .csv file via WebUi ("Download all tests in CSV")
Is it any possibility to get such .csv file automatically on every build without manual steps?

Or maybe there is another way to rerun only failed tests?
Now I download this csv, filter test list to extract test list with only failed tests and then run another build with these failed tests only.

5 comments
Comment actions Permalink

Hi Algot,

It's partially possible to get this automatically. The file is available under an URL such as: http://<server>/get/tests/buildId/<build_id>/<build_name>-tests.csv. You can check it manually if you check the link generated in the UI. With this in mind, you should be able to download the file by running a command line step with a script that pulls it.

We do have implemented a Retry Build Trigger, that will allow you to repeat a build that has failed, but it won't filter out the passed tests, as there are several possibilities on a retry: The build fails before reaching the tests, the same tests fail, different tests fail, etc, and this might have different implications.

If you already have a way to filter out tests, then you should be able to pull the file in a build step, then parse its results and run the build as you require.

1
Comment actions Permalink

I created PowerShell script to do this.

Maybe it will be useful for somebody

Getting build number and buildId

https://pastebin.com/vnXPeLJd


Downloading csv

https://pastebin.com/jfejq3RV

Parsing csv

https://pastebin.com/QDLNGZCX

Trigger TeamCity build which runs failed test list

https://pastebin.com/XXB4q439

1
Comment actions Permalink

Thanks a lot for sharing, they look really interesting

 

0
Comment actions Permalink

Algot , Could you share all script?  Because I do not understand how you pass bunch of test which should be re-executed 

0
Comment actions Permalink

@Valeraf23

I download a csv with all tests which are failed - https://pastebin.com/jfejq3RV

Then I pass this file to ParseCsv function https://pastebin.com/QDLNGZCX
ParseCsv function returns the list of test I need to run.
I write it out to txt file which is used by TeamCity build as nunit test list.

1

Please sign in to leave a comment.