0

I am currently using Visual Studio 2017 and have upgraded my .testsettings file to a .runsettings file. My goal is to use the runsettings file with a TFS build to update certain parameters as needed for a build, but would like to access test parameters located within my test cases by using the DataSource. The error I am facing is the same as described here - https://social.msdn.microsoft.com/Forums/en-US/884cff6a-1da1-44d8-b8c8-d52d6ff12df6/mstest-unable-to-run-the-test-using-runsettings-file?forum=vsunittest.

Using the .testsettings file previously solved the issue, but a runsettings file does not appear to be usable if the testsettings file is being used.

Update

Goal - Run a test locally with a runsettings file and using the DataSource attribute to pull parameters from a TFS test case.

Here is the following error when attempting to run a test locally. enter image description here

Here is an example test case. enter image description here

Here is where the runsettings file is set. enter image description here

Update 2

I have added the following tag to the runsettings file.

enter image description here

I have reduced the NuGet 'MSTest.TestAdapter' from 1.1.18 to 1.1.11 and now I am receiving the following error. The exact test will run and connect to the datasource with no issues on Visual Studio 2015 using a testsettings file.

enter image description here

Brian
  • 124
  • 1
  • 9

1 Answers1

0

First please run your test with MSTest on your build machine manually to check whether it can work or not.

If it can work on build machine, afraid that this problem related to the TFS build definition. Double check some configurations as alltej suggested.

If it also failed on build machine, the problem should be caused by the environment. Double confirm your local environment is as the same as the build machine. It's also able to use .runsetting file of a unit test to connect to the data source. Please follow the tutorial Configure unit tests by using a .runsettings file.

PatrickLu-MSFT
  • 49,478
  • 5
  • 35
  • 62
  • 1
    Currently I am only running this on my local machine. I have not moved this to a build definition (I do not want to waste time/effort updating the build definition if this won't be successful locally). – Brian Aug 10 '17 at 14:21
  • If so, the issue is more related to local VS. Not related to TFS so far. If you got any problem such as build configurations when you moved on TFS, my pleasure to give some help or direction. – PatrickLu-MSFT Aug 11 '17 at 02:02
  • Thanks Patrick. Is there another MSFT expert that can assist with this issue? – Brian Aug 11 '17 at 14:06
  • @Brian will invite someone familiar with vstest when back to office on Monday. – PatrickLu-MSFT Aug 11 '17 at 16:29
  • Any update on inviting someone more familiar with this topic? – Brian Aug 16 '17 at 14:50
  • @Brian, In the runsettings file, please make use you’ve specified the correct TestAdaptersPaths at test run configuration part. And the DeploymentEnable should be set true at MSTest Run Settings part. – Leo Liu Aug 17 '17 at 03:19
  • @Leo-MSFT I have made those changes and still receive the error. – Brian Aug 25 '17 at 16:41
  • @Leo-MSFT Also, if I add the tag 'ForcedLegacyMode' under the 'MSTest' tag I get the follow warning and no tests are ran 'A testsettings file or a runsettings with a ForcedLegacyMode set to true is not supported with the MSTest V2 Adapter.'. – Brian Aug 25 '17 at 17:00