3

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?

Malachi
  • 2,260
  • 3
  • 27
  • 40
  • To be clear, you have found the logs on TeamCity? You're just not sure how to create a program to predict where the output will be? – Speerian Aug 04 '15 at 18:59
  • I can find the logs manually on the server with explorer.exe. Not with TeamCity. For example, work directory for MSTEST is, in one case, buildTmp\"BuildUser_WIN-FB0FUANB08L 2015-08-04 12_47_53" – Malachi Aug 04 '15 at 22:40

1 Answers1

1

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

Paul Hunt
  • 3,395
  • 2
  • 24
  • 39
  • Thanks Paul, but as may have been unclear in the original question, my question revolves more how to identify "Test Log Files" in the first place as with MSTest it is a moving target. I've updated the original question to make this more clear – Malachi Jul 27 '15 at 18:27