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.
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 runsettingsfile. I removed that unit test project and it started working.