Malachi
Malachi

Reputation: 2443

TeamCity + MSTest - how to capture generated artifacts?

I've searched and searched, to no avail.

How does one capture unit test output artifacts from a TeamCity + MSTest step?

We're stuffing folders/artifacts in the test directory fine - I'm not asking about [DeploymentItem] and friends

Specifically, we generate a bunch of logfiles as the tests run and I'd like to hold on to these for historical inspection.

Currently we manually inspect the auto-generated TestResults folders this is troublesome since we have multiple build agents, and also MSTest has a habit of deleting the "Out" folder once it's done.

I've tried turning deployment off completely with a .testsettings file, but MSTest still tries to execute in its special temporary deploy directory - but with almost nothing deployed in it (you can imagine how well that works)

EDIT:

To be clear, the issue is that MSTest executes one's tests in difficult-to-programatically-predict folders, thus rendering TeamCity's artifact capture next to useless. My question is:

How does one nail down/predictably locate these would-be artifacts and then capture them with TeamCity?

Upvotes: 3

Views: 855

Answers (1)

Paul Hunt
Paul Hunt

Reputation: 3555

To capture files that are output by a TeamCity build process you need to specify their paths in General Settings / Artifact Paths. For instance to select all files that are in a folder called Test Log Files in the root of the agent checkout directory you would do this:

Artifact paths

Captured files will then be stored as artifacts that are linked to that particular build run and can be viewed or downloaded from within the build's history page:

Build history

The amount of time that the artifacts are kept are controlled by TeamCity's clean-up rules.

Artifact Paths

Clean-Up

Upvotes: 1

Related Questions