Build/Test Issues

Parameterized NUnit tests run only once

Started by rucamzu on 7,400 views

Hi,

I'm using NCrunch 3.6.0.2 on a C# library project with NUnit 3.6.1, targeting .NET 4.5 on Visual Studio 2015. I'm writing parameterized tests like this:


[Test, TestCaseSource(nameof(SomeIntegers))]
public void MyTest(List<int> someIntegers)
{
    ...
}

private static IEnumerable<List<int>> SomeIntegers {get; }
    = new[]
        {
            new List<int>(1, 2, 3),
            new List<int>(4, 5, 6),
            new List<int>(7, 8, 9)
        };


In tests like the one above, NCrunch only runs the test once, with the first parameter (in this case new List<int>(1, 2, 3)). Both the NUnit console test runner and ReSharper handle this properly.

Am I missing some configuration?
Thanks for the help, I've been probably missing NCrunch warning. The link to the documentation is broken, but I'll try to get SetName working. Thanks!
rucamzu wrote:Thanks for the help, I've been probably missing NCrunch warning. The link to the documentation is broken, but I'll try to get SetName working. Thanks!


Can you confirm which link you're seeing as broken? Is this the one in the warning?
Remco wrote:Hi,

NCrunch should give you a warning about this with a link to the documentation page explaining this issue - http://www.ncrunch.net/documentation/considerations-and-constraints_unique-test-name.
...


Remco wrote:
Can you confirm which link you're seeing as broken? Is this the one in the warning?


above link ( http://www.ncrunch.net/documentation/considerations-and-constraints_unique-test-name ) returns

Page Not Found
Sorry, but the documentation page you just tried to reference does not exist.

Edited

Post a reply

Log in to reply.