none
How to use MTM test case parameter with Selenium and Unit Testing? RRS feed

  • Question

  • Hello we are transitioning from Coded UI to Selenium Web Driver for our automation. I created Coded UI Test projects prior but as far a Selenium I  have to create a Unit Testing instead. A challenge I am facing is getting the parameters from Microsoft Test Manager (MTM) test cases to work with Selenium. I'm also having trouble making the Unit Test recognize test adapter to connect to the data source. Is there another method of connecting I'm not aware about for Selenium? I am doing something Selenium isn't built for? Is there a solution or away around this when using a Unit Test?

    Error 1: I used the DataSource format I usually use for a standard Coded UI test case to connect to MTM, to use my parameters.

    the error I receieve is as followed:

    Test Name: TestMethod1
    Test FullName: UnitTestProject1.UnitTest1.TestMethod1
    Test Source: C:\Users\klewis\source\repos\UnitTestProject1\UnitTestProject1\UnitTest1.cs : line 38
    Test Outcome: Failed
    Test Duration: 0:00:01.0432321

    Result1 Name: TestMethod1
    Result1 Outcome: Failed
    Result1 Duration: 0:00:00.5226834
    Result1 StackTrace:
    Result1 Message:
    Result1 StandardOutput:
    Result1 StandardError:

    Result2 Name: TestMethod1
    Result2 Outcome: Failed
    Result2 Duration: 0:00:00.5205487
    Result2 StackTrace: at Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.TestDataSource.GetData(ITestMethod testMethodInfo, ITestContext testContext)
    Result2 Message: The unit test adapter failed to connect to the data source or to read the data. For more information on troubleshooting this error, see "Troubleshooting Data-Driven Unit Tests" (http://go.microsoft.com/fwlink/?LinkId=62412) in the MSDN Library. Error details: Unable to find the requested .Net Framework Data Provider.  It may not be installed.
    Result2 StandardOutput:
    Result2 StandardError:


    Error 2: I removed the DataSource and left it generic:

    The error is as followed

    Name Value Type
    $exception {"Object reference not set to an instance of an object."} System.NullReferenceException


    Wednesday, June 26, 2019 6:43 PM

All replies

  • Hi KJ_5000,

    Welcome to MSDN forum.

    According to your description, I create a unit test in my side using MTM as data source, and it throws the same errors.

    Then after my research, When I modify the "TestClass" to "CodeUITest", it could work as normal.

    So it is default that this unit test adapter is not support using MTM as the data source. Therefore, I suggest you could use this coded UI test adapter to read this data for your code method check this issue.

    Any feedback will be expected.

    Best Regards,

    Dylan


    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

    Thursday, June 27, 2019 9:23 AM
  • Hey Dylan!

    Thanks for responding. So you are saying all I need to change is [TestClass] to [CodedUITest]? Do I also have to install the CodedUITest adapater or is it already part of the VS Suite for Unit Testing? Is there anything else I need to change?

    Monday, July 1, 2019 3:19 PM
  • Hi KJ_5000

    Thank you for reply.

    Please download the Code UI Test package in the visual studio installer, then just change [Test Class] to [CodeUITest].

    Note: Open visual studio installer/ Modify/ Individual components/ Coded UI Test

    Best Regards,

    Dylan


    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

    Tuesday, July 2, 2019 5:43 AM