Daily Usage Issues

nunit TestCase not working with ExpectedResult

Started by Henrry on 7,077 views

Hi

I have this test

[Test]
[TestCase(null, ExpectedResult = JobStatus.DocumentDelivery)]
[TestCase("9999999999999999", ExpectedResult = JobStatus.InComplete)]
public JobStatus SetJobSetIncompleteStatus(string invoiceNumber)
{
var job = new Job
{
JobStatus = JobStatus.DocumentDelivery,
InvoiceNumber = invoiceNumber
};

service.SetIncompleteStatus(job);
return job.JobStatus;
}

when i run this test with the nunit test runner the it passes, as expected, but when i run it with ncrunch this is the result

1 -> Expected: null was: DocumentDelivery
2 -> Expected: null was: InComplete


Does any one had this same kind of issue?
Hi,

what happens if you remove the [Test] attribute? You already mark it as a test via the [TestCase] attribute.

BR,
Ralf
Event without the test attribute it fails

thanks for your suggestion anyway
Hi Henrry,

I can't seem to recreate this problem when using the latest version of NUnit.

Which version of NUnit are you using?
Hi Remco

this is the nuget package that i have installed
...packages\NUnit.3.2.0\lib\net45\nunit.framework.dll

kind regards
Henrry
Thanks for confirming. This is the same one I also tested with :(

Is there any chance you can put together a sample solution that can reproduce this issue? You can submit it through the contact form.
Sure Remco

I will do it

Kind regards
Henrry Pires
Hi Remco

Sorry for the delay. I just sent via the contact form as requested a demo project


Kind regards
Henrry
Hi Henrry,

Thanks for sending through the sample project. I've tested this at my end and I can confirm that it works with the latest release of NCrunch (v3.9).

I believe the problem you are experiencing is due to a compatibility issue that has been fixed in a later release than the one you are using. The version you're running (v2.18) is more than 18 months old, and there have been considerable changes to the ecosystem with many updates to the NUnit3 integration during these 18 months. v2.18 was released only a couple of weeks after the first introduction of NUnit3 integration, so the code you are running on is early generation and likely will have issues, especially with the newer versions of NUnit that have been released far more recently.

To resolve this problem, you'll need to upgrade your version of NCrunch.
Thanks Remco

It works fine

Post a reply

Log in to reply.