All tests for a specific project?

I have tried many URLs using the REST API documentation, but maybe what I am trying to do is not possible.

Is it possible to get all tests within a given project?   Not test occurrences, but tests.

I tried /tests:(affectedProject:MyProject) and many other ideas.

0
1 comment
Hi Guy,

The `affectedProject` locator dimension is only supported in conjunction with either `currentlyFailing:true` or `currentlyMuted:true` (because the project, along with subprojects, may theoretically include thousands of tests which will impact the performance/usefulness of the response). For example, the below request allows to fetch all *failing* tests in the project `TestProject` and all of its subprojects:

```
[GET] <TeamCity URL>/app/rest/tests?locator=affectedProject:TestProject,currentlyFailing:true
```

I would recommend using the `testOccurrences` in this case, though, as this will also yield the build/build configuration where the test failed into the response, e.g.:

```
[GET] <TeamCity URL>/app/rest/testOccurrences?locator=affectedProject:TestProject,currentlyFailing:true&fields=testOccurrence(id,name,status,build)
```

Best regards,
Anton
1

Please sign in to leave a comment.