none
Can i use *.runsettings file to call the url instead of app.config file RRS feed

  • Question

  • Hello,

    I would like to use test.runsettings file instead of using App.config file to launch the browser.

    Is this possible?

    Is so could be please give me the steps how to create runsettings file and call the url to launch the browser.

    thank you in advance


    PV

    Tuesday, June 13, 2017 5:01 PM

All replies

  • Hi PV,

    Thanks for post in MSDN forum.

    As far as I know, we cannot use .runsettings file instead of app.config file in Coded UI Test.

    The .runsettings file is used for configuring unit tests for some purposes.

    https://msdn.microsoft.com/en-us/library/jj635153.aspx?f=255&MSPPError=-2147217396

    I created a simple unit test using .runsettings file in my side, and it could get the output value.

    But, when comes coded UI test, I got the error "Test method UnitTestProject1.CodedUITest1.CodedUITestMethod1 threw exception: System.NullReferenceException: Object reference not set to an instance of an object."

    So it's really a limitation.

    Reference:

    http://stackoverflow.com/questions/32597776/testcontext-testrunparameters-in-coded-ui-test

    Sorry about this brought you such inconvenience.

    Best regards,

    Fletcher


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


    • Edited by Fletch Zhou Wednesday, June 14, 2017 5:23 AM
    • Proposed as answer by Fletch Zhou Friday, June 16, 2017 1:39 AM
    Wednesday, June 14, 2017 5:23 AM
  • Yes Its possible, you can use runsettings file to read any runtime parameter, all you need to make sure is the method that reads the data from runsettings file is static otherwise you will get null reference exception.

    For detail instructions follow this link : http://blog.fermium.io/testrunparameters/ 


    Please "Mark it as answer if it answers your question"

    Wednesday, May 2, 2018 3:55 PM