Executing Tests using dotnet runner cli doesn't interpret DynamicData

Neftali Reyes 6 Reputation points
2020-09-29T13:56:11.087+00:00

I have a test case (MS UnitTest Framework, VS 2019) that uses the [DataTestMethod] [DynamicData(nameof(GetTestData), DynamicDataSourceType.Method)] attributes to iterate thru several objects. Running the test in VS TestExplorer works great, it iterates thru all the rows being passed (works like a champ). However, when I run the same test case from the command console using dotnet or vstest.console runners, it executes the test only once.

Am I missing something?

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.
351 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Neftali Reyes 6 Reputation points
    2020-09-30T15:52:50.857+00:00

    Thanks for the quick response. After going back to review, I realized it was my own fault. I was using only two rows for a quick test, however, on incrementing the rows I was starting the count of rows at 1 instead of zero (a stupid mistake because I wanted my count to start at 1 for other reasons). Because the count was starting at 1, it was omitting to run the test case for row 0.

    1 person found this answer helpful.

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.