How can I debug loading test data with Microsoft.VisualStudio.TestTools.WebTesting.DataSource?

Martin Krischik 16 Reputation points
2021-05-28T07:21:35.073+00:00

For our performance tests we are loading test date from a CSV-File. Up until recently this worked fine. But now we get the following error:

Could not run Web test 'XXXXX' on agent 'XXXXXX': Could not access table 'Test#csv' in data source 'dsTest' of test 'XXXXXX,XXXXXX': The OleDbParameterCollection only accepts non-null OleDbParameter type objects, not SqlParameter objects.

And I have no idea where this is coming from. I was able to pinpoint the problem to the following statement:

c#
    using WebTesting = Microsoft.VisualStudio.TestTools.WebTesting;

    [WebTesting.DataSource (
        dataSourceName: "dsTest",
        providerName: "Microsoft.VisualStudio.TestTools.DataSource.CSV",
        connectionString: "|DataDirectory|\\data\\Test.csv",
        WebTesting.DataBindingAccessMethod.Sequential,
        WebTesting.DataBindingSelectColumns.SelectOnlyBoundColumns,
        tableName: "Test#csv")]

But this is an annotation and now I'm at a loss on how to debug loading the data.

Update 1

I checked reading the CSV manually and that works as expected:

c#
    var dataTable = new Csv.CsvDataTable();

    dataTable.ReadFromFile(
        filename: System.IO.Directory.GetCurrentDirectory() + "\\Test.csv", 
        setheaderfromfirstrow: true, 
        encoding: System.Text.Encoding.UTF8, 
        delimeter: ',',
        quote : '"',  
        emptyLineBehavior: Csv.EmptyLineBehavior.NoColumns);

Update 2

Just to be sure it's not and I18N Problem I replaced the , with ;. Same result. So now I wonder if even the header line is read.

PS: The CSV-file itself contains confidential data — I would have to sanitise it and then it's not the same file any more. I would really prefer if I'm helped along finding the error.

Update 3

Considering it might be an version mismatch after the lates Visual Studio update I updated all nuget packages. That make no difference either.

Update 4

We have one virtual machine on which the performance tests are still working and I have noticed that this virtual machine is using “Windows Server 2016 Datacenter” while all the other virtual machines which don't work any more have been update to “Windows Server 2019 Datacenter”.

This reframes the problem and I might have to ask the question again.

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,233 questions
Visual Studio Testing
Visual Studio Testing
Visual Studio: A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.Testing: The act or process of applying tests as a means of analysis or diagnosis.
328 questions
{count} vote

2 answers

Sort by: Most helpful
  1. Tore Olav Kristiansen 16 Reputation points
    2021-07-30T21:28:45.403+00:00

    As a workaround pending a fix from Microsoft to this VS2019 issue, the tests work in VS2017.

    0 comments No comments

  2. Tore Olav Kristiansen 16 Reputation points
    2021-07-30T22:19:21.95+00:00
    0 comments No comments