nunit / nunit3-vs-adapter

NUnit 3.0 Visual Studio test adapter for use under VS 2012 or later
https://nunit.org
MIT License
205 stars 106 forks source link

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

Open jocutajar opened 8 years ago

jocutajar commented 8 years ago

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

CharliePoole commented 7 years ago

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

jocutajar commented 7 years ago

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

sm-g commented 7 years ago

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

CharliePoole commented 7 years ago

@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.

EricStG commented 7 years ago

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

CharliePoole commented 7 years ago

@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.

EricStG commented 7 years ago

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

CharliePoole commented 7 years ago

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.