You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using DynamicDataAttribute without any data produces a cryptic error message:
Failed (test name)
Error Message:
Error in executing test. No result returned by extension. If using extension of
TestMethodAttribute then please contact vendor.
I'm less concerned with what the correct behavior should be here and more concerned with providing developers with meaningful errors. It was very confusing to figure out why my test was failing after my IEnumerable<object[]> was processed but before the first line of code was reached. Note: my DynamicDaa was a .Where() clause on different test data; the repro in this issue is a simplified version of my original test.
I don't think that a DynamicData test without any data should be considered a "passing test", but I hesitate to call it a "failing test."
Steps to reproduce
Run the command: dotnet new mstest
Update the nuget packages:
MSTest.TestFramework 1.2.0 -> 1.3.0
MSTest.TestAdapter 1.2.0 -> 1.3.0
Microsoft.Net.TestSdk 15.6.0 -> 15.7.2
Replace the contents of UnitTest1.cs with:
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Collections.Generic;
[TestClass]
public class UnitTest1
{
public static IEnumerable<object[]> Empty => new object[][]{};
[TestMethod]
[DynamicData(nameof(Empty))]
public void Object_IsNotNull(object o) => Assert.IsNotNull(o);
}
Run the command: dotnet test
Expected behavior
Something to the effect of:
Build started, please wait...
Build completed.
Test run for D:(masked)\bin\Debug\netcoreapp2.0\repro.dll(.NETCoreApp,Version
=v2.0)
Microsoft (R) Test Execution Command Line Tool Version 15.6.0
Copyright (c) Microsoft Corporation. All rights reserved.
Starting test execution, please wait... Skipped Object_IsNotNull
Error Message:
DynamicDataAttribute specified an IEnumerable<object[]> to use for test parameters, but the enumerable was empty.
Total tests: 1. Passed: 0. Failed: 0. Skipped: 1.
Test Run Successful.
Test execution time: 1.7951 Seconds
Actual behavior
Build started, please wait...
Build completed.
Test run for D:(masked)\bin\Debug\netcoreapp2.0\repro.dll(.NETCoreApp,Version
=v2.0)
Microsoft (R) Test Execution Command Line Tool Version 15.6.0
Copyright (c) Microsoft Corporation. All rights reserved.
Starting test execution, please wait... Failed Object_IsNotNull
Error Message:
Error in executing test. No result returned by extension. If using extension of
TestMethodAttribute then please contact vendor.
Total tests: 2. Passed: 1. Failed: 1. Skipped: 0.
Test Run Failed.
Test execution time: 1.8811 Seconds
Description
Using DynamicDataAttribute without any data produces a cryptic error message:
I'm less concerned with what the correct behavior should be here and more concerned with providing developers with meaningful errors. It was very confusing to figure out why my test was failing after my IEnumerable<object[]> was processed but before the first line of code was reached. Note: my DynamicDaa was a .Where() clause on different test data; the repro in this issue is a simplified version of my original test.
I don't think that a DynamicData test without any data should be considered a "passing test", but I hesitate to call it a "failing test."
Steps to reproduce
dotnet new mstest
dotnet test
Expected behavior
Something to the effect of:
Actual behavior
Diagnostic logs
Environment
I am running Windows 7 SP1.
Finally, for good measure, a screenshot of the Test Explorer in VS:
The text was updated successfully, but these errors were encountered: