Rank: Advanced Member
Groups: Registered
Joined: 10/5/2015(UTC) Posts: 42 Location: Australia
Thanks: 14 times Was thanked: 23 time(s) in 11 post(s)
|
Tried updating to the latest MSTest 3 package and ran into a build issue. With [DataRow] tests that use params for a list of values passed into a test, eg. Code:
[DataRow("A")]
[DataRow("A", "B")]
[DataRow("A", "B", "C")]
[DataRow("A", "B", "C", "D")]
[DataRow("A", "B", "C", "D", "E")]
[DataRow("A", "B", "C", "D", "E", "F")]
[DataTestMethod]
public void DataRowTest(params string[] letters)
{
Assert.AreEqual(letters, letters);
}
NCrunch can no longer build the project. Error is as follows: Quote: NCrunch has encountered an internal error: System.Exception: System.InvalidCastException: Unable to cast object of type 'System.String' to type 'System.Object[]'. at nCrunch.Module.MSTest.Integration.MSTestCilResolvedParameters..ctor(CilCustomAttribute dataRowAttribute) at nCrunch.Module.MSTest.Integration.MSTestCilDiscoverer.createTestCases(CilMethodDefinition method, CilTypeDefinition fixture) at nCrunch.Module.MSTest.Integration.MSTestCilDiscoverer.<FindFrameworkTestsInAssembly>b__12_0() at nCrunch.Common.PerformanceTracking.PerfTracker.TrackActivity(String name, Action activity) at nCrunch.Module.MSTest.Integration.MSTestCilDiscoverer.FindFrameworkTestsInAssembly(ReflectedAssembly assembly, FilePath assemblyFilePath, IList`1 referencedAssemblyFilePaths, ComponentUniqueName testComponentUniqueName, PlatformType platformType, DynamicProxy[] dynamicProxies) at nCrunch.TestExecution.TestFinder..() at nCrunch.Common.PerformanceTracking.PerfTracker.TrackActivity(String name, Action activity) at nCrunch.TestExecution.TestFinder..() at nCrunch.Common.PerformanceTracking.PerfTracker.TrackActivity(String name, Action activity) at nCrunch.TestExecution.TestFinder.FindTestsForFrameworks(ReflectedAssembly assembly, FilePath assemblyFilePath, IList`1 referencedAssemblyFilePaths, DescribedTestFrameworkDiscoverer[] describedDiscoverers, ComponentUniqueName testComponentUniqueName, PlatformType platformType, DynamicProxy[] dynamicProxies) at nCrunch.Compiler.StaticManipulation.BuiltCilAssembly.DiscoverTests(TestFrameworkDescription[] applicableTestFrameworks, ComponentUniqueName testComponentUniqueName) at nCrunch.Compiler.CilProcessingTasks.CilTestDiscoveryTask.ProcessTask(IBuiltAssembly builtAssembly, ComponentInstrumentationParameters instrumentationParameters, BuildOutput output) at nCrunch.Compiler.CilProcessingTasks.ConcurrentCilTaskProcessor.() at nCrunch.Compiler.CilProcessingTasks.ConcurrentCilTaskProcessor.ProcessTasks(Int32 backgroundThreadsAllowed) at nCrunch.Compiler.RemoteBuildRunner.(ComponentInstrumentationParameters , BuildOutput , IBackgroundTaskProcessor ) at nCrunch.Compiler.RemoteBuildRunner.PerformPostProcessingOfBuiltAssembly(ComponentInstrumentationParameters instrumentationParameters, BuildOutput output, IBackgroundTaskProcessor backgroundTaskProcessor) at nCrunch.Core.BuildManagement.BuildEnvironment..() at nCrunch.Common.PerformanceTracking.PerfTracker.TrackActivity(String name, Action activity) at nCrunch.Core.BuildManagement.BuildEnvironment.Build(SnapshotComponent snapshotComponentToBuild, IList`1 referencedComponents, GridClientId gridClientId, IList`1 customEnvironmentVariables, IPlatformBuildExtender extender, Guid taskId, GridAddress clientAddress, Boolean extractCoverageReportStructure)
The same code builds and works fine in MSTest 2.2. My best guess is this is something related to this breaking change. https://github.com/microsoft/testfx/pull/1332
Sidenote - there is a variant that NCrunch will build with MSTest 3, but the test cannot run under NCrunch (though it runs via VS test runner). Code:
[DataRow(new string[] { "A" })]
[DataRow(new string[] { "A", "B" })]
[DataRow(new string[] { "A", "B", "C" })]
[DataRow(new string[] { "A", "B", "C", "D" })]
[DataRow(new string[] { "A", "B", "C", "D", "E" })]
[DataRow(new string[] { "A", "B", "C", "D", "E", "F" })]
[DataTestMethod]
public void DataRowTestArray(string[] letters)
{
Assert.AreEqual(letters, letters);
}
This results in a failing test with message: Quote:Unable to transfer an Array from a statically analysed domain into a dynamic runtime domain. Please change your 'Framework utilisation type for MSTest' setting to 'UseDynamicAnalysis' to run this test. Here's a repro solution with both of the above cases: https://1drv.ms/u/s!ArNW31rplqplm0WV52MqdOpMOrxA?e=BLQkmw
|