Reputation: 1897
I have a C# (selenium + NUnit + Specflow) .Net Core 2.1 project (vs 2017).
My project references the Microsoft.TestPlatform.TestHost nuget which contains the testhost.dll. The tests run on my computer but when I try to run them in Azure DevOps they fail with the error, "Unable to find testhost.dll".
This makes sense because when I build the project on my computer, testhost.dll is not added to the bin directory although the project references the Microsoft.TestPlatform.TestHost nuget which contains the testhost.dll.
Question: Why does the testhost.dll not get added to the bin directory on build?
Note: I have looked at other posts about this error message and most of the time their problem is that they are not referencing the assembly. However, I am referencing the nuget.
Upvotes: 3
Views: 2426
Reputation: 4174
Just run the Publish
task (dotnet
or msbuild
) prior to the test execution and use the test libraries from your publish location.
Upvotes: 0
Reputation: 1897
This is more than likely the issue. I copied the files to the artifact instead of publishing. I'll test and see if this works. Will update this post after I try this out. [Update: Yes, the issue was that I needed to publish in order for the needed *.dlls to get placed into the bin directory]
Answer in the image came from the following github page.
These are the Instructions I was following. They were actually really good. I used it to get comfortable running a test project in azure before integrating it into a software pipeline. You'll see minute 11:33 shows that the tests need to have a 'Publish' step in the job. How to Run .NET Core Selenium Tests in Azure DevOps
Upvotes: 1