Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

NUnit Async Tests not detected
JohnStov
#1 Posted : Wednesday, January 23, 2013 10:42:39 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 10/31/2011(UTC)
Posts: 7

Thanks: 1 times
Was thanked: 3 time(s) in 3 post(s)
Hi I've created some async unit tests using NUnit 2.6.2 and .NET 4.5

NUnit and the Resharper test runner run them fine, but NCrunch doesn't detect them.

NCrunch clearly compiles the code ok, because it runs my synchronous test fine.

I'm using Visual Studio 2012, NCrunch version 1.44.0.11.

This runs:

[Test]
public void SynchronousTest()
{
Assert.True(true);
}

But this doesn't:

[Test]
public async Task AsyncTest()
{
await Task.FromResult(3);
}

Hope you can fix it...
Remco
#2 Posted : Thursday, January 24, 2013 7:24:04 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,144

Thanks: 959 times
Was thanked: 1290 time(s) in 1196 post(s)
Hi John,

NCrunch doesn't yet have the latest version of NUnit (2.6.2) packaged with it, so it won't work with NUnit async tests straight out of the box.

However, something you may want to try is updating the NUnit binaries used by NCrunch. Replace the following files with their equivalents from the latest version of NUnit:

\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\Extensions\Remco Software\NCrunch for Visual Studio 2012\nunit.core.interfaces.dll
\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\Extensions\Remco Software\NCrunch for Visual Studio 2012\nunit.core.dll

A quick test from my side shows that this allows the async tasks to work correctly. I haven't yet had a chance to exhaustively regression test compatibility with the new version of NUnit, but the scope of changes in this revision doesn't look big, so hopefully replacing these files won't surface any other problems. I've made a new to include the newest binaries in the next minor revision of NCrunch.


Cheers,

Remco
JohnStov
#3 Posted : Thursday, January 24, 2013 9:53:31 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 10/31/2011(UTC)
Posts: 7

Thanks: 1 times
Was thanked: 3 time(s) in 3 post(s)
Thanks for the speedy response,

I'll give it a try.

Oh, and I forgot to say; Thanks for a great product, and for great service.
1 user thanked JohnStov for this useful post.
Remco on 1/24/2013(UTC)
JohnStov
#4 Posted : Thursday, January 24, 2013 4:00:18 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 10/31/2011(UTC)
Posts: 7

Thanks: 1 times
Was thanked: 3 time(s) in 3 post(s)
Yep, that worked.

Thanks again.
1 user thanked JohnStov for this useful post.
Remco on 1/24/2013(UTC)
Remco
#5 Posted : Saturday, March 30, 2013 10:08:23 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,144

Thanks: 959 times
Was thanked: 1290 time(s) in 1196 post(s)
For anyone interested, support for NUnit 2.6.2 with async tests has been introduced with the newly released version of NCrunch (v1.45).
joaroyen
#6 Posted : Friday, August 2, 2013 4:05:21 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 11/21/2012(UTC)
Posts: 2
Location: Norway

Thanks: 1 times
Was thanked: 1 time(s) in 1 post(s)
Remco;3909 wrote:
For anyone interested, support for NUnit 2.6.2 with async tests has been introduced with the newly released version of NCrunch (v1.45).


Async NUnit SetUp methods have the same issue, and none of the test methods in classes with async setup are recognized by NCrunch. I'm running NCrunch v1.46.0.20 and my current workaround is to do the async initialization in the test methods themselves.

Thanks for creating this great product :)
- Joar
Remco
#7 Posted : Friday, August 2, 2013 11:09:45 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,144

Thanks: 959 times
Was thanked: 1290 time(s) in 1196 post(s)
Thanks Joar - I can confirm that NCrunch isn't working with async NUnit setup methods. I've logged this down to be fixed in the next maintenance release.
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

YAF | YAF © 2003-2011, Yet Another Forum.NET
This page was generated in 0.051 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download