Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 874
Dhananjay Jadhav Avatar asked Dec 31 '25 11:12

Dhananjay Jadhav


1 Answers

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.

like image 94
Dhananjay Jadhav Avatar answered Jan 02 '26 23:01

Dhananjay Jadhav



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!