Jyotsna
Jyotsna

Reputation: 49

custom data under unit test result

I want to add custom details to the unit test result under error message. I am using Microsoft visual studio test tools for unit testing.

I tried using System.Diagnostics.Trace.WriteLine() but that adds the data under Result StandardOutput, but I want the custom data in Result Message.

Any idea how to achieve that

Upvotes: 0

Views: 224

Answers (1)

Oxald
Oxald

Reputation: 837

All assert methods have overloads with a string parameter used for custom error messages:

int result = 0;
int expected = 2;
Assert.AreEqual(expected, result, $"Failed result: {result} instead of {expected}");

Upvotes: 2

Related Questions