Can I determine the TestSettings file being used within a CodedUI Test RRS feed

  • Question

  • Hello,

    I was wondering if it was possible to determine the .TestSettings file that is currently being used while a codedUI/Selenium test is running?

    Here is the background:I am using VS2013 to run codedUI and Selenium based automated tests.  We run our tests (C#) on Virtual Machines using the VS2013 Controller and the VS2013 Agents (agents are installed on all of the VMS).  When I want to run a test on a specific VM I select the corresponding .testsettings file that we have setup in our solution (we select the test settings file in Visual Studio by clicking TEST > Test Settings > Select Test Settings File). Then I run the test and the controller/agents do their thing, and our tests run on the VM.  I would like to write some code in the unit tests that determines the .testsetting file that was selected. Is this possible?

    I looked at TestContext.Properties but there is nothing that that helps.

    Any ideas?

    Friday, April 8, 2016 2:59 PM


  • Hi DaveDoesQA,

    I also have checked the TestContext class and the TestConfiguration class, I don't find any properties about the .testsettings file in both of the classes when select the .testsettings file from TEST -> Test Settings -> Select Test Settings File.

    But if you are specify a test settings file to use with the MS Test adapter, which as below sample shows. Then you can read the SettingsFile node to get the selected testsettings file. About how to use the XML file as a testsettings file, please refer to this article.


    Best Regards,

    • Proposed as answer by Weiwei Cai Thursday, April 14, 2016 4:55 AM
    • Marked as answer by Weiwei Cai Tuesday, April 19, 2016 9:33 AM
    Monday, April 11, 2016 6:09 AM