Build/Test Issues

Build failure when a tests is parameterized on MSTest framework. NCrunch (version 3.14.0.1)

Started by AlexanderUK on 4,332 views

When I try to write one easy parameterized test, NCrunch (version 3.14.0.1) cannot build the project on VS 2017 (version 15.5.2). And that's why cannot run this test.

In output window I have next stack trace:

System.ArgumentNullException: Value cannot be null.
Parameter name: source
в System.Linq.Enumerable.Select[TSource,TResult](IEnumerable`1 source, Func`2 selector)
в nCrunch.Module.MSTest.Integration.MSTestStaticDiscoverer.resolveDataRowParameters(ReflectedAttribute dataRowAttribute)
в nCrunch.Module.MSTest.Integration.MSTestDynamicDiscoverer.<>c__DisplayClass7_0.<FindFrameworkTestsInAssembly>b__1()
в nCrunch.Common.PerformanceTracking.PerfTracker.TrackActivity(String name, Action activity)
в nCrunch.Common.PerformanceTracking.PerfTracker.TryTrackActivity(String name, Action activity)
в nCrunch.Module.MSTest.Integration.MSTestDynamicDiscoverer.FindFrameworkTestsInAssembly(ReflectedAssembly assembly, FilePath assemblyFilePath, IList`1 referencedAssemblyFilePaths, ComponentUniqueName testComponentUniqueName, PlatformType platformType, DynamicProxy[] dynamicProxies)
в nCrunch.TestExecution.TestFinder..()
в nCrunch.Common.PerformanceTracking.PerfTracker.TrackActivity(String name, Action activity)
в nCrunch.TestExecution.TestFinder..()
в nCrunch.Common.PerformanceTracking.PerfTracker.TrackActivity(String name, Action activity)
в nCrunch.TestExecution.TestFinder.FindTestsForFrameworks(ReflectedAssembly assembly, FilePath assemblyFilePath, IList`1 referencedAssemblyFilePaths, DescribedTestFrameworkDiscoverer[] describedDiscoverers, ComponentUniqueName testComponentUniqueName, PlatformType platformType, DynamicProxy[] dynamicProxies)
в nCrunch.Compiler.StaticManipulation.BuiltAssembly.DiscoverTests(TestFrameworkDescription[] applicableTestFrameworks, ComponentUniqueName testComponentUniqueName)
в nCrunch.Compiler.RemoteBuildRunner.(ComponentBuildParameters , FilePath , BuildOutput , DirectoryPath[] , FilePath[] )
в nCrunch.Compiler.RemoteBuildRunner..()
в nCrunch.Common.PerformanceTracking.PerfTracker.TrackActivity(String name, Action activity)
в nCrunch.Compiler.RemoteBuildRunner.(ComponentBuildParameters )



Can somebody help me with it or explain what is wrong? And how can I fix it on my environment?



Repro steps:
1. Create "Unit Test Project (.net core)"
2. And add this test:

using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace UnitTestProject2
{
[TestClass]
public class UnitTest1
{
[TestMethod]
[DataRow(null, null)]
public void Test1(string str, int? age)
{
Assert.IsNull( age);
}
}
}

Edited

Hi,

Thanks for sharing this issue.

When writing parameterised data row tests using MSTest that use type conversions or nullables, please set your 'Framework utilisation type for MSTest' to 'DynamicAnalysis'. This will resolve such problems.
Many thanks! It really helped.

I changed this option to "dynamic" and now all tests is executing correctly.

Thanks again!!!!

Post a reply

Log in to reply.