Publishing test assemblies with artifacts in order to use them during functional tests on VSTS
B

3

6

I am having a really hard time trying to figure out how to properly configure functional tests on my realease pipeline. I have a solution that contains some web projects being built using the default build configuration in VSTS. The artifact is ok and I can publish them using a release pipeline. So far so good, now I want to implement functional tests using CodedUI and have them integrated on my releases. We have a development server with a vsagent that was installed when I configured the deployment group. I then installed manually a vstest agent using a tool that I have downloaded here.

I then added a new task on my release pipeline: VsTest configured as follows

enter image description here

This is the log output from the test task in my release pipeline where it says that no test assemblies were found:

enter image description here

My build task:

enter image description here

And this is my artifact package that doesnt seems to have any test assemblies, only web projects:

enter image description here

So basically, how do I publish my test assemblies in order to use them in my release pipeline? Am I doing it right packing the test assemblies together with my web projects artifacts?

Benefactor answered 25/7, 2018 at 20:19 Comment(0)
H
5

You can try to copy the Test Assemblies to $(build.artifactstagingdirectory) and publish with the artifact.

Alternately you can try to add another Copy Task and Publish Build Artifacts task or directly use Copy and Publish Build Artifacts task to copy the Test Assemblies and publish them as another Artifact.

enter image description here

Hoofed answered 26/7, 2018 at 9:42 Comment(3)
Note: now the "Copy and Publish" task is deprecated, so I went with the two separate tasks.Osteomyelitis
How come the copy and publish step comes after the vsTest step? should'nt it be before if the message from the testin step is that testing cannot find the test assemblies?Polyphone
I only needed the copy step (before the publishing step), the publishing was then automatic through the existing publishing step.Parbuckle
E
2

I had a related issue, but was able to fix it by changing the search folder from the template default $(System.DefaultWorkingDirectory) to $(Agent.BuildDirectory). This way I do not need to create a copy task.

My tests are located in a separate project.

Erroneous answered 22/11, 2019 at 11:46 Comment(3)
Hi Halling, can you explain your process a bit more. I'm trying to implement the same thing.Magner
Notice the last line called searchFolder. I changed the value to $(Agent.BuildDirectory). - task: VSTest@2 inputs: testSelector: 'testAssemblies' testAssemblyVer2: | **test.dll !**\obj** !**\xunit.runner.visualstudio.testadapter.dll !**\xunit.runner.visualstudio.dotnetcore.testadapter.dll searchFolder: '$(Agent.BuildDirectory)'Erroneous
So near yet so far. I cannot believe I'm in the same boat in 2021. Just cannot figure out this syntax. It's insane.Marchand
E
0

You need to publish a separate artifact containing your test assemblies.

Elianore answered 25/7, 2018 at 20:23 Comment(1)
Could you explain how can I achieve this? In my MSBuild task I have the parameter /p:PackageLocation="$(build.artifactstagingdirectory)\\" how I am supposed to get those test assemblies from that (I am going to have multiple test projects, basically, one test project to each web project)?Benefactor

© 2022 - 2024 — McMap. All rights reserved.