One of my test containing Assert.Equal(2, list.Count);
fails on Appveyor, a continuous integration server, but I cannot reproduce the failure on my local machine.
I hope to get more information from the error message, but don't know how to do.
The authors of xUnit.net insist they should not allow users to specify custom error messages, see https://github.com/xunit/xunit/issues/350 . That's why there is not API allowing me to write eg. Assert.Equal(2, list.Count, "The content of the list is " + ...);
I also looked at Fluent Assertions. If I write list.Should().HaveCount(3, "the content of the list is " + ...);
, the output reads as
Expected collection to contain 3 item(s) because the content of the list is
..., but found 2.
The "because" clause doesn't make sense in English grammar. The because parameter seems to be used to describe expected behavior, not actual behavior.
Considering xUnit.net and Fluent Assertions both discourage us from providing additional information regarding the failure, is outputting additional information when tests fail a good way to debug remote errors?
What's the best way to output additional information?