tse
tse

Reputation: 6069

How get quantity of passed tests inside step of TeamCity?

How to get quantity of passed tests inside the step?

I need to make step to check that all required tests was run. It is not the same that all run tests are passed.

I've minutes ago got beautiful situation: only 10% of tests was finished, all of them ok, build successful, and for CI it means that everything is fine, and CI can automatically merge it.

Upvotes: 0

Views: 657

Answers (1)

Yaegor
Yaegor

Reputation: 1832

If you want to ensure that the overall test count did not drop since previous build or is greater than a specified number, you can add a "Failure condition" on metric "number of tests" change right in TeamCity UI. enter image description here

You can also use TeamCity REST API to get the current number of tests via request like:

curl -u "%system.teamcity.auth.userId%:%system.teamcity.auth.password%" "%teamcity.serverUrl%/httpAuth/app/rest/builds/id:%teamcity.build.id%?fields=testOccurrences"

However, these numbers are not real-time, they are updated on the server with some delay.

Actually, the check that all the tests have run seems to be best performed on the testing framework level (like no errors are reported, etc.)

Upvotes: 2

Related Questions