3

I am having difficulty building an ordered test in Visual Studio 2015 Enterprise (Update 1) and having the unit tests within the ordered test be able to reference my .runsettings.

Specifically, I need to access the TestRunParameters defined in the .runsettings file.

In any of my test methods, if I access the Properties of the TestContext, the properties I defined in the .runsettings are not found.

Surely I'm not the first to do this. Any help would be appreciated.

Aaron Hudon
  • 5,280
  • 4
  • 53
  • 60
  • I've been experiencing the same behavior, most of the time. About one out of 5 executions, my properties from my runsettings file are present in the TestContext Properties dictionary. I have yet to be able to consistently make it work. – BrettJ May 13 '16 at 11:54
  • I am having this issue (VS2015 Update 3). the answer from BrettJ did not fix. I have the correct run settings file loaded. I did clean/build. If I run an individual test, everything works and properties are loaded. If I run an ordered test, the properties are not loaded. – MarkD Nov 04 '16 at 05:54

1 Answers1

0

I think I understand the bug in Visual Studio. Whenever you select a runsettings file in the VS->Test->Test Settings submenu, they do NOT take effect until I at least do a Rebuild of my Test project (or a Clean solution / Build solution). Simply building does NOT make VS apply the proper runsettings file. There were certain situations where it wasn't applying any runsettings file, but since I started doing a Rebuild Project every time I select a different runsettings file, I've never discovered the TestContext not having my Proerties.

BrettJ
  • 980
  • 8
  • 15