Unit test with datasource won't run

67 Views Asked by At

Having problem running test with CSV datasource. File exists, is valid (UTF-8 encoding) and is successfully copied to bin/Debug/netcoreapp3.1 directory every time I run test or build solution (it is Content/Copy always). However, that is where test ends, it does not even get to initialize method.

Method (simplified):

    [TestMethod, DataSource("Microsoft.VisualStudio.TestTools.DataSource.CSV", "|DataDirectory|\\data.csv", "data#csv", DataAccessMethod.Sequential)]
    public void Test(string value)
    {
        // will not even get here
    }

Test works just fine when I replace DataSource attribute with DataRow attribute.

   [TestMethod, DataRow("foo")]
   public void Test(string value)
   {
       // works perfectly
   }

There is an yellow triangle in test explorer, but no stacktrace or whatsoever. Nothing interesting to be found in test output either:

Building Test Projects ========== Starting test run ========== ========== Test run finished: 2 Tests (0 Passed, 0 Failed, 2 Skipped) run in 52 ms

Any idea what could be possibly wrong?

0

There are 0 best solutions below