none
Unable to run Unit tests on local pc with testsettings in Visual Studio 2015 update 2

    Question

  • I am trying to run this TestMethod with added default TestSettings file.

    Test cannot be executed due to error: Result 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

    Why this happened?

    //----------------------------
    using System;
    using Microsoft.VisualStudio.TestTools.UnitTesting;
    using System.Data;

    [TestClass()]
    public class TestClass1
    {
        public TestContext TestContext { get; set; }
        public DataRow DataRow { get; set; }
        [AssemblyInitialize()]
        public static void AssemblyInit(TestContext context)
        {
            Console.WriteLine("AssemblyInit " + context.TestName);
        }
       
        [ClassInitialize()]
        public static void ClassInit(TestContext context)
        {
            Console.WriteLine("ClassInit " + context.TestName);
        }
        [TestInitialize()]
        public void Initialize()
        {
            Console.WriteLine("TestMethodInit");
        }
        [TestMethod()]
        [DataSource("Microsoft.VisualStudio.TestTools.DataSource.TestCase",
        "http://tfs.server.net:8080/tfs/XXX;XXXX", "123", DataAccessMethod.Sequential)]
        public void MethodTest1()
        {
            Console.WriteLine("Executing Test...");
        }
    }
    //-------------------

    Wednesday, May 25, 2016 4:01 PM

All replies

  • Hi Skliarov,

    After adding a .testsettings file in your Unit Test, please check whether you have selected and used it in your Unit Test. Please choose it from Test menu -> Test Settings -> Select Test Settings File. It will popup a Open Settings File windows to let you choose the .testsettings file.

    After choose the .testsettings file in your Unit Test, it will show as below screenshot.

    Best Regards,
    Weiwei


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Thursday, May 26, 2016 5:14 AM
    Moderator
  • Hi Weiwei,

    As  I say, I am trying to run this TestMethod with added default TestSettings file and selected in Menu from your screenshot. This behavior is reproducible on 2-3 PCs with VS2015upd2.

    And as addition to this case:

    -first run could be successful but second or third run (especially after rebuild solution) - Fails with that error

    -or if you try to run by clicking menu RUN_ALL tests

    -but if you run by clicking on cuurent testmethod inTestExplorer -> Run -

    FAILS with error that I mention in first post.

    Thanks for answer anyway. 

    Thursday, May 26, 2016 6:46 AM
  • Hi Skliarov,

    My colleague who get the same error with the similar code in your original post that when the data source are stored on TFS. But on his environment, he just add a .testsettings file and use it in his Test project, the problem is resolved.

    Please tell us the machine environment, such as Windows version, installed packages for Visual Studio and so on, and please tell us how do you store the data source file in TFS. We need more environment information to try reproduce your problem in our side to confirm whether it is caused by machine environment.

    Best Regards,
    Weiwei


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Friday, May 27, 2016 1:37 AM
    Moderator
  • Hi Weiwei,

    Issue was checked on Win 10 Enterpr 64 bit(VS 2015 upd 2 - 14.0.25123.00) ,

    Win 7 sp1 pro 64 bit (at least 4 PCs with Win 7 sp1 pro and VS 2015  update 2).

    I had VS 2015 pro update 2 (update 2 was installed after installation VS 2015 update 1) (default parameters during installation).

    Also THIS reproducible after clean installation VS 2015 pro update 2 on Win 7 sp1 pro 64 bit  (default parameters during installation)

    I am using MTM and Test cases:

    For example Test Case 123 has parameters:  @Num, @Name  (and a lot of iterations)

    ---

    Now I am using VS 2015 pro update 1 

    ( I have removed VS 2015 upd 2 - 14.0.25123.00 and installed VS 2015 pro update 1 (14.0.24720.41) with default parameters, .Net 4.6.0.1055 now)

    and my SmallProject works PERFECT with added default TestSettings file and selected in Menu from your screenshot.

    (and few another similar Test projects - which did not work on Update 2 also - now works and have access to TFS test cases).

    Thanks for your help.

    Friday, May 27, 2016 9:41 AM
  • Hi Skliarov,

    Thanks for your response and your detailed test steps.

    According to your description for your test steps, it occurs with Visual Studio 2015 Update 2 on several machines. After uninstall the Update 2, everything works fine.

    So I suggest you submit this issue to Visual Studio Connect and share the feedback link here. It can let other communities who has the same problem to vote and add comments for your feedback. I think the report team experts will treat this issue seriously.

    Best Regards,
    Weiwei


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Sunday, May 29, 2016 1:30 AM
    Moderator