nunit3-vs-adapter icon indicating copy to clipboard operation
nunit3-vs-adapter copied to clipboard

Theory (random/dynamic data driven) tests always inconclusive with AutoFixture and NSubstitute

Open jocutajar opened this issue 8 years ago • 8 comments

Hi, I have a similar situation to #97, though probably more complex. Using AutoFixture and NSubstitute, I can declare tests as such:

[Theory, AutoSubstituteData]
public void Test_Mixed(int version, string name, [Substitute] IService svc)
{
     // not executed, shown as inconclusive
}

This works with xUnit in VS and also with NUnit console runners. The VS test runner shows it always inconclusive. Test output shows:

Test adapter sent back a result for an unknown test case. Ignoring result for 'Test_Mixed(150,"name04f0cd50-e89f-4a8f-db6-dab69b58e98e",Castle.Proxies.IServiceProxy)'.

More details are available on SO.

Once #97 is fixed, as @CharliePoole suggests, this particular problem may need more attention.

Thanks, Rob

jocutajar avatar Jun 08 '16 09:06 jocutajar

@jocutar Was this fixed by #97, which was in the 3.5 release?

CharliePoole avatar Dec 25 '16 01:12 CharliePoole

Hi Charlie, I've moved on to another project and dotnet core with xunit. Thanks for the efffort though. I might need it again. Kind regards

On Sat, Dec 24, 2016 at 05:44:37PM -0800, CharliePoole wrote:

@jocutar Was this fixed by #97, which was in the 3.5 release?

-- You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub: https://github.com/nunit/nunit3-vs-adapter/issues/188#issuecomment-269106941

jocutajar avatar Jan 12 '17 07:01 jocutajar

I have adapter of 3.7.0.0 version and [Test, AutoData] tests still not running.

sm-g avatar Feb 16 '17 11:02 sm-g

@sm-g This issue is about a problem with [Theory] which is quite specialized. If you have a problem with general tests, it would be better to start a new issue.

Before you do, however, make sure that you are using The AutoFixture package for NUnit 3, not NUnit 2.

CharliePoole avatar Feb 16 '17 11:02 CharliePoole

I'm seeing the same problem with 3.7, same error message. It looks like it's related to the name of the test changing (to include the random data), but not being updated in the VS test explorer

EricStG avatar Apr 24 '17 18:04 EricStG

@EricStG Could you clarify whether your problem is with [Test] or [Theory]? Both have been reported in this thread.

@nunit/framework-team This is a good one for somebody to take on if you want to spend a bit of quality time getting to know AutoFixture. Essentially, I would say that that any problem that is only present when AutoFixture is in use is likely to be an AutoFixture problem, but it may take some effort to demonstrate that.

CharliePoole avatar Apr 24 '17 20:04 CharliePoole

@CharliePoole in my case, this is using [Test].

EricStG avatar Apr 24 '17 20:04 EricStG

So, any random values generated come from autofixture. I'd say that someone could look at the code quickly and verify that they don't use NUnit's guaranteed repeatable random values, but simply call Random. That would make it their bug.

CharliePoole avatar Apr 24 '17 20:04 CharliePoole