Release pipeline couldn't find .runsettings file while executing tests on machine

1.7k views Asked by At

I have created a release pipeline in azure for my .Net core test project. I am using runsettings file to store test inputs for my selenium automation project.

While running the pipeline it's getting failed with error - Assembly Initialization method Tests_MSTestAssemblyHooks.AssemblyInitialize threw an exception. System.Exception: System.Exception: Unit test Provider already set. Aborting test execution.

This is the same error in Visual studio when we don't select runsettings file from Test> Configure Run Settings. From this I guess, it is not able to find runsettings file.

I have mentioned runsettings file in VsTest task. As it didn't work, then I also added Copy file task in the release pipeline. Here are some more screenshots from VsTest task log - 1, 2, 3 as I am not able to attach the file here.

I am using MS Test as a test framework and a self-hosted agent pool if that matters.

1

There are 1 answers

0
Dhananjay Jadhav On BEST ANSWER

I had one unloaded unit test project in my solution which is using NUnit adapter. Nuget restore in my build pipeline was installing it. When release pipeline was dropping all assemblies in single folder, where MSTest and NUnit adapters were present. Test started executing its getting conflict between these adapters, as a result tests were not able to find file. I removed that unit test project and it started working.