JetBrains / TeamCity.VSTest.TestAdapter

Apache License 2.0
30 stars 14 forks source link

Attachments are not reported per test by default #48

Closed Sebazzz closed 7 months ago

Sebazzz commented 8 months ago

Using this test adapter, attachments are not reported via service messages but via stdout, like this:

Attachment "My description": "file://path/to/file"

Going by Options:

https://github.com/JetBrains/TeamCity.VSTest.TestAdapter/blob/b5d4df3102946616dcfca033d0a42756fa1c990f/TeamCity.VSTest.TestLogger/Options.cs#L58-L59

And going by Attachments:

https://github.com/JetBrains/TeamCity.VSTest.TestAdapter/blob/b5d4df3102946616dcfca033d0a42756fa1c990f/TeamCity.VSTest.TestLogger/Attachments.cs#L37-L41

Everything should, by default, be reported through service messages.

Running dotnet test through a build script (Cake). Am I missing any settings?

mchechulnikov commented 7 months ago

@Sebazzz hi!

The attachment reporting supported via VSTest was added in TeamCity 2018.2. So, this condition is a guard to ensure that TeamCity.VSTest.TestAdapter is compatible with the TeamCity version and a couple of feature toggles – again just for the sake of compatibility. There were a number of possibilities to use these test adapters with TC version, which doesn't support attachments. We should probably remove feature toggles at least after checking if it is safe since it looks like right now the modern TeamCity version is able to support

To pass this condition and send attachments to the TeamCity server, you need the following:

So, if you have an issue with the behavior, perhaps one or several of these env vars in the wrong state in dotnet test ... process. I'd suggest you logging the values of these env vars before the dotnet test running or/and inside a test. Just for debugging purposes and to be sure about values.

Sebazzz commented 7 months ago

@mchechulnikov Thanks, if figured it out inserts facepalm

Our TeamCity installation is years old, at least since 2013 but probably earlier. At some point someone, me probably, added the TEAMCITY_VERSION environment variable as set it to 10, probably to trigger Cake or Nunit back then to detect TeamCity properly. We never deleted the variable.