xunit2

MemberData tests show up as one test instead of many

▼魔方 西西 提交于 2019-12-03 10:38:33
问题 When you use [Theory] together with [InlineData] it will create a test for each item of inline data that is provided. However, if you use [MemberData] it will just show up as one test. Is there a way to make [MemberData] tests show up as multiple tests? 回答1: I spent a lot of time trying to figure this one out in my project. This related Github discussion from @NPadrutt himself helped a lot, but it was still confusing. The tl;dr is this: [MemberInfo] will report a single group test unless the

How to implement XUnit descriptive Assert message?

雨燕双飞 提交于 2019-12-03 04:31:11
Context in XUnit github I found this: Add Assert.Equal(expected, actual, message) overload #350 (so a developer ask for a non existing overload see below) Quote from the answer: We are a believer in self-documenting code; that includes your assertions. (so the XUnit team rejects it) OK, I got it. I also believe the self documenting code. Still I can not find out this use case: Sample // Arrange // Create some external soap service client and its wrapper classes // Act // client.SomeMethod(); // Assert // Sorry, soap service's interface, behaviour and design is *given* // So I have to check if

MemberData tests show up as one test instead of many

大兔子大兔子 提交于 2019-12-03 04:22:47
When you use [Theory] together with [InlineData] it will create a test for each item of inline data that is provided. However, if you use [MemberData] it will just show up as one test. Is there a way to make [MemberData] tests show up as multiple tests? Nate Barbettini I spent a lot of time trying to figure this one out in my project. This related Github discussion from @NPadrutt himself helped a lot, but it was still confusing. The tl;dr is this: [MemberInfo] will report a single group test unless the provided objects for each test can be completely serialized and deserialized by implementing

Why is the Visual Studio 2015/2017/2019 Test Runner not discovering my xUnit v2 tests

 ̄綄美尐妖づ 提交于 2019-11-26 19:31:43
UPDATE: Adding a 2019; the discovery/runner integration mechanism is same as per 2017 & 2015, so the key things that can go wrong are the same. I've read Why is the xUnit runner not finding my tests, which covers reasons xUnit would never be able to find your tests but my problem is different - I'm confident there's nothing subtle going on with my tests; (they have worked in other environments, this seems to be just my machine) - the Visual Studio Test Runner in Visual Studio 2015 [Community Edition] is simply not showing any of my tests. I'm not doing anything remotely exciting; the tests