How do I make NUnit assertion fail to display line numbers for C ++?

When I run NUnit tests against my C ++ code and the assertion fails, I don't get the line numbers where the failure occurs.

Method example:

[Test]
void testMethod()
{
    Assert::Fail("test comment");
}

      

Output example:

[nunit2] Failures:

[nunit2] 1) namespace.SomeTest.testMethod: test comment

[nunit2] in namespace.SomeTest.testMethod ()

A similar output (also without line numbers) is generated for any assertion rejection.

When I look at my output, how do I get information about the line number for which the line caused the crash?

0


source to share


1 answer


Double check that you are creating your classes with Debug Information (PDB).



The Assert framework basically throws an exception when assert fails and StackTrace catches the exception. The stack trace gets line numbers from the PDB file associated with the executable.

+1


source







All Articles