C#5 async tests are not supported

Bug #1057981 reported by Anthony Steele on 2012-09-28
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
NUnit Framework
High
Charlie Poole
NUnit V2
Fix Released
Wishlist
Simone Busoli
NUnitLite
High
Charlie Poole

Bug Description

If a method is marked async, nunit does not recognise it as a test, and some test runners may incorrectly pass it while it is still running. These methods actually return a Task not void, and the test can only be passed if the task completes without a failure.

As detailed here http://anthonysteele.co.uk/async-and-await-with-nunit

MSTest supports async tests
http://blogs.msdn.com/b/visualstudioalm/archive/2012/03/13/what-s-new-for-mstest-unit-tests-in-visual-studio-11-beta.aspx

Related branches

Simone Busoli (simone.busoli) wrote :

I believe this deserves implementing.

Charlie, do you mind if I look into it?

Simone Busoli (simone.busoli) wrote :

Anthony, although this is certainly currently not handled at all in NUnit, if I recall correctly R# emulates NUnit and doesn't use it directly, so I would say that your tests should first be run using an official NUnit runner, like the console or the gui, in order to validate this bug.

Purely out of interest for the interesting, Simone, can I tag along, too? I
have a few doubts on the new implementation of the new CLR (Server GC)
background GC and a separate GC thread for each processor plus the work
stealing mode (no pun), which may also come into play in this scenario.

Regards,

Jv

On Fri, Sep 28, 2012 at 2:43 PM, Simone Busoli
<email address hidden>wrote:

> I believe this deserves implementing.
>
> Charlie, do you mind if I look into it?
>
> --
> You received this bug notification because you are a member of NUnit
> Developers, which is subscribed to NUnit V2.
> https://bugs.launchpad.net/bugs/1057981
>
> Title:
> C#5 async tests are not supported
>
> Status in NUnit V2 Test Framework:
> New
>
> Bug description:
> If a method is marked async, nunit does not recognise it as a test,
> and some test runners may incorrectly pass it while it is still
> running. These methods actually return a Task not void, and the test
> can only be passed if the task completes without a failure.
>
> As detailed here http://anthonysteele.co.uk/async-and-await-with-nunit
>
> MSTest supports async tests
>
> http://blogs.msdn.com/b/visualstudioalm/archive/2012/03/13/what-s-new-for-mstest-unit-tests-in-visual-studio-11-beta.aspx
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/nunitv2/+bug/1057981/+subscriptions
>

--
Regards,

Ravichandran Jv
http://ravichandranjv.blogspot.com

Simone Busoli (simone.busoli) wrote :

Hi Jv, sure, I was just proposing myself as a way to have this out soon, but I certainly don't mind if you would like to take over.

Jv (jv-ravichandran) wrote :

No, not take over but help you with by pairing?

I am recovering from an arm injury so please note that I may be slow as a
pairing partner! :)

Jv

On Fri, Sep 28, 2012 at 3:19 PM, Simone Busoli
<email address hidden>wrote:

> Hi Jv, sure, I was just proposing myself as a way to have this out soon,
> but I certainly don't mind if you would like to take over.
>
> --
> You received this bug notification because you are a member of NUnit
> Developers, which is subscribed to NUnit V2.
> https://bugs.launchpad.net/bugs/1057981
>
> Title:
> C#5 async tests are not supported
>
> Status in NUnit V2 Test Framework:
> New
>
> Bug description:
> If a method is marked async, nunit does not recognise it as a test,
> and some test runners may incorrectly pass it while it is still
> running. These methods actually return a Task not void, and the test
> can only be passed if the task completes without a failure.
>
> As detailed here http://anthonysteele.co.uk/async-and-await-with-nunit
>
> MSTest supports async tests
>
> http://blogs.msdn.com/b/visualstudioalm/archive/2012/03/13/what-s-new-for-mstest-unit-tests-in-visual-studio-11-beta.aspx
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/nunitv2/+bug/1057981/+subscriptions
>

--
Regards,

Ravichandran Jv
http://ravichandranjv.blogspot.com

Changed in nunitv2:
status: New → Triaged
importance: Undecided → Wishlist
assignee: nobody → Simone Busoli (simone.busoli)
Charlie Poole (charlie.poole) wrote :

I marked this triaged (since I know we don't have the feature) and assigned it to Simone. I'm also changing the bug to target NUnitLite and NUnit 3.0.

Since our build of NUnit 2.6 targets .NET 2.0, this isn't really a suitable feature to add there, which leaves the question of where to best work on it...

NUnitLite currently has an experimental Asynchronous attribute, which allows other tests to be run while the marked test continues on a separate thread. Implementing this required a _lot_ of changes to how tests are executed, which is why I really don't think we should do it in the 2.6 series. Since NUnitLite is built for multiple platforms it would be relatively simple to support the use of an async method without requiring the attribute in the .NET 4.5 build - which you would have to add.

NUnit 3.0 has a branch (currently not published) where all tests may be run in parallel. It's not yet clear to me whether we really need any special handling for async tests in this environment. On the one hand, a single async test would not have any impact on execution of other tests so long as the maximum number of runners was not exceeded. On the other hand, people are probably using async (at least some of the time) on methods that have to wait for long-running operations that don't use the cpu, so we might like the runner thread to be freed up for another test while that wait takes place.

Between the two projects, I think that NUnitLite is the easiest place to begin since it's all in a single assembly. If you have to make changes to the basic execution of tests (found under framework\Internal\WorkItems) we will want to port the changes to NUnit 3.0 eventually as well. In fact, lot of new stuff has been first developed in NUnitLite over the years and then moved to NUnit.

affects: nunitv2 → nunit-3.0
Changed in nunitlite:
status: New → Triaged
importance: Undecided → Wishlist
assignee: nobody → Simone Busoli (simone.busoli)
importance: Wishlist → High
Charlie Poole (charlie.poole) wrote :

I upgraded NUnitLite fix to High priority because it would enable us to support async methods in the NUnit test adapter that runs under VS 2012. That adapter is currently based on the full NUnit framework, but I was planning to switch it over to NUnitLite as soon as the latter reached feature parity with NUnit.

Simone Busoli (simone.busoli) wrote :

Charlie, I think this bug is not about asynchronous tests, but rather about
correct handling of tests which have to be marked as async because they use
the new .NET 4.5 async/await features, which is a different matter as far
as I understand.

Also, I'm not completely sure that although this feature has been
introduced in .NET 4.5 it cannot be handled somehow in CLR 2.0, but I will
have to check further as I'm not overly familiar with the brand new
features.

In any case, it would be quite good if this was possible to handle it in
NUnit 2.x which is the current released version, as users otherwise would
have to wait until 3.0 is out or switch to NUnitLite, which if I were a
user I would like to not need to do.

If not possible then the workaround is quite simple and just requires the
users to Wait on the task by caling its waiting method, rather than
"awaiting" it.

On Fri, Sep 28, 2012 at 5:26 PM, Charlie Poole <email address hidden> wrote:

> I upgraded NUnitLite fix to High priority because it would enable us to
> support async methods in the NUnit test adapter that runs under VS 2012.
> That adapter is currently based on the full NUnit framework, but I was
> planning to switch it over to NUnitLite as soon as the latter reached
> feature parity with NUnit.
>
> --
> You received this bug notification because you are a bug assignee.
> https://bugs.launchpad.net/bugs/1057981
>
> Title:
> C#5 async tests are not supported
>
> Status in NUnit Test Framework:
> Triaged
> Status in NUnitLite Testing Framework:
> Triaged
>
> Bug description:
> If a method is marked async, nunit does not recognise it as a test,
> and some test runners may incorrectly pass it while it is still
> running. These methods actually return a Task not void, and the test
> can only be passed if the task completes without a failure.
>
> As detailed here http://anthonysteele.co.uk/async-and-await-with-nunit
>
> MSTest supports async tests
>
> http://blogs.msdn.com/b/visualstudioalm/archive/2012/03/13/what-s-new-for-mstest-unit-tests-in-visual-studio-11-beta.aspx
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/nunit-3.0/+bug/1057981/+subscriptions
>

Anthony Steele (anthony-steele) wrote :

Simone is correct here. This is all about the Task type, which was present in C#4. It may be enough to allow tasks with this return type, wait for the task to complete and check for exceptions.

This comment from Eric Lippert http://stackoverflow.com/a/8043882/5599 suggests that if the method returns "async void" then you can't get a task out of it. This is be a pity, since if you have the task you can wait for it to compete and then check for exceptions. I wonder how MSTest deals with that?

Charlie Poole (charlie.poole) wrote :

@Simone:

I'm OK with your experimenting with this to see if something can be done. We can add NUnitV2 back to the affected projects if it turns out to be relatively simple: i.e.: if we don't have to change the basically sequential execution pattern that is implemented in NUnit 2.6.

However, I did point out in the StackOverflow thread that there is lots you can already do in NUnit with asynchronous calls, provided you don't expect NUnit to recognize async tests. So long as the user does an await in the test, there won't be an issue as far as I can tell. Perhaps you should first check me on that.

@Anthony:

Since NUnit 2.x is built targeting .NET 2.0, I'm not sure how a Task return type would help us. Can you clarify?

@everyone:

Frankly, I'd rather hurry up with NUnit 3.0 than spend time on a half-a**ed fix of NUnit 2.6.

Charlie Poole (charlie.poole) wrote :

A further note based on my readings...

Since you can't await a method that returns async void, and since NUnit attaches a special meaning to any value that is returned by the test method, we'll have to somehow allow for that either by disallowing checking the return value on an async test method or awaiting the task and then checking the actual return value in some way.

Simone Busoli (simone.busoli) wrote :

I agree Charlie, I'm not aware of the current status of V3 so I just
assumed it was not ready for prime time, but if it makes sense to add it
there then it's probably going to be easier by far.

Simone

On Fri, Sep 28, 2012 at 6:20 PM, Charlie Poole <email address hidden> wrote:

> @Simone:
>
> I'm OK with your experimenting with this to see if something can be
> done. We can add NUnitV2 back to the affected projects if it turns out
> to be relatively simple: i.e.: if we don't have to change the basically
> sequential execution pattern that is implemented in NUnit 2.6.
>
> However, I did point out in the StackOverflow thread that there is lots
> you can already do in NUnit with asynchronous calls, provided you don't
> expect NUnit to recognize async tests. So long as the user does an await
> in the test, there won't be an issue as far as I can tell. Perhaps you
> should first check me on that.
>
> @Anthony:
>
> Since NUnit 2.x is built targeting .NET 2.0, I'm not sure how a Task
> return type would help us. Can you clarify?
>
> @everyone:
>
> Frankly, I'd rather hurry up with NUnit 3.0 than spend time on a
> half-a**ed fix of NUnit 2.6.
>
> --
> You received this bug notification because you are a bug assignee.
> https://bugs.launchpad.net/bugs/1057981
>
> Title:
> C#5 async tests are not supported
>
> Status in NUnit Test Framework:
> Triaged
> Status in NUnitLite Testing Framework:
> Triaged
>
> Bug description:
> If a method is marked async, nunit does not recognise it as a test,
> and some test runners may incorrectly pass it while it is still
> running. These methods actually return a Task not void, and the test
> can only be passed if the task completes without a failure.
>
> As detailed here http://anthonysteele.co.uk/async-and-await-with-nunit
>
> MSTest supports async tests
>
> http://blogs.msdn.com/b/visualstudioalm/archive/2012/03/13/what-s-new-for-mstest-unit-tests-in-visual-studio-11-beta.aspx
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/nunit-3.0/+bug/1057981/+subscriptions
>

Richard Beier (rpbeier) wrote :

I just came across this thread while searching for a way to run async tests with NUnit 2.6.

Stephen Cleary's workaround ("Right Way #1") seems to work fine for NUnit:
http://nitoprograms.blogspot.ca/2012/02/async-unit-tests-part-2-right-way.html

This requires two classes which Stephen has included in his AsyncUnitTests-MSTest package. The source is here:
http://bit.ly/PeSRUx
http://bit.ly/PLvZyq

This sample test correctly fails in the Resharper 7 NUnit runner:
http://pastebin.com/3mQvdzDZ

Thanks,
Richard

Charlie Poole (charlie.poole) wrote :

Thanks for the pointer... interesting articles.

Unfortunately, Stephen's code is licensed under MS-PL, making it incompatible
with either the NUnit 2.6 or NUnit 3.0 license. (I looked that up before linking
to the code and then didn't look at it to avoid any possibility of "stealing" it
by mistake.)

It's not clear to me how some folks choose licenses, but a lot of them are
using MS-PL these days, perhaps not realizing that code can't be used by
any open source projects except those that also use MS-PL.

Nevertheless, we'll get there anyway. :-)

Charlie

On Fri, Sep 28, 2012 at 3:54 PM, Richard Beier <email address hidden> wrote:
> I just came across this thread while searching for a way to run async
> tests with NUnit 2.6.
>
> Stephen Cleary's workaround ("Right Way #1") seems to work fine for NUnit:
> http://nitoprograms.blogspot.ca/2012/02/async-unit-tests-part-2-right-way.html
>
> This requires two classes which Stephen has included in his AsyncUnitTests-MSTest package. The source is here:
> http://bit.ly/PeSRUx
> http://bit.ly/PLvZyq
>
> This sample test correctly fails in the Resharper 7 NUnit runner:
> http://pastebin.com/3mQvdzDZ
>
> Thanks,
> Richard
>
> --
> You received this bug notification because you are subscribed to NUnit
> Extended Testing Platform.
> https://bugs.launchpad.net/bugs/1057981
>
> Title:
> C#5 async tests are not supported
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/nunit-3.0/+bug/1057981/+subscriptions

Charlie Poole (charlie.poole) wrote :

Based on Simone's work, I added this back to the NUnitV2 project, targeting the 2.6.2 release.

Changed in nunitv2:
status: New → Triaged
importance: Undecided → Wishlist
assignee: nobody → Simone Busoli (simone.busoli)
milestone: none → 2.6.2
status: Triaged → In Progress
Jv (jv-ravichandran) wrote :

Since I am fairly free, I can work on this issue independently as a spike. Please point me to the appropriate files in NUnit v2.

I will be working on finding if the async threads' context can be independently established.

This will help in maintaining that tests "await"-ing a async result is testing the right context and will also help in establishing the "void" context.

Jv

Charlie Poole (charlie.poole) wrote :

Hi Jv,

You should coordinate with Simone on this, since he has the
bug assigned. OTOH, there are tons of things to do other
than this if you want something of your own!

Charlie

On Sun, Sep 30, 2012 at 4:02 AM, Jv <email address hidden> wrote:
> Since I am fairly free, I can work on this issue independently as a
> spike. Please point me to the appropriate files in NUnit v2.
>
> I will be working on finding if the async threads' context can be
> independently established.
>
> This will help in maintaining that tests "await"-ing a async result is
> testing the right context and will also help in establishing the "void"
> context.
>
> Jv
>
> --
> You received this bug notification because you are subscribed to NUnit
> Extended Testing Platform.
> https://bugs.launchpad.net/bugs/1057981
>
> Title:
> C#5 async tests are not supported
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/nunit-3.0/+bug/1057981/+subscriptions

Jv (jv-ravichandran) wrote :

Sure, Charlie, but this particular problem does require more than one
person I thought and hence suggested to help. I will try to independently
simulate some similar async scenarios and then seek help on how it can be
merged with Simone's work.

Jv

On Mon, Oct 1, 2012 at 2:45 AM, Charlie Poole <email address hidden> wrote:

> Hi Jv,
>
> You should coordinate with Simone on this, since he has the
> bug assigned. OTOH, there are tons of things to do other
> than this if you want something of your own!
>
> Charlie
>
> On Sun, Sep 30, 2012 at 4:02 AM, Jv <email address hidden> wrote:
> > Since I am fairly free, I can work on this issue independently as a
> > spike. Please point me to the appropriate files in NUnit v2.
> >
> > I will be working on finding if the async threads' context can be
> > independently established.
> >
> > This will help in maintaining that tests "await"-ing a async result is
> > testing the right context and will also help in establishing the "void"
> > context.
> >
> > Jv
> >
> > --
> > You received this bug notification because you are subscribed to NUnit
> > Extended Testing Platform.
> > https://bugs.launchpad.net/bugs/1057981
> >
> > Title:
> > C#5 async tests are not supported
> >
> > To manage notifications about this bug go to:
> > https://bugs.launchpad.net/nunit-3.0/+bug/1057981/+subscriptions
>
> --
> You received this bug notification because you are a member of NUnit
> Developers, which is subscribed to NUnit V2.
> https://bugs.launchpad.net/bugs/1057981
>
> Title:
> C#5 async tests are not supported
>
> Status in NUnit Test Framework:
> Triaged
> Status in NUnitLite Testing Framework:
> Triaged
> Status in NUnit V2 Test Framework:
> In Progress
>
> Bug description:
> If a method is marked async, nunit does not recognise it as a test,
> and some test runners may incorrectly pass it while it is still
> running. These methods actually return a Task not void, and the test
> can only be passed if the task completes without a failure.
>
> As detailed here http://anthonysteele.co.uk/async-and-await-with-nunit
>
> MSTest supports async tests
>
> http://blogs.msdn.com/b/visualstudioalm/archive/2012/03/13/what-s-new-for-mstest-unit-tests-in-visual-studio-11-beta.aspx
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/nunit-3.0/+bug/1057981/+subscriptions
>

--
Regards,

Ravichandran Jv
http://ravichandranjv.blogspot.com

Charlie Poole (charlie.poole) wrote :
Download full text (3.3 KiB)

Sounds good! One thing we need is a test assembly built in VS2012,
which contains all sorts of combinations of test features, for example,
test cases that use an async method, methods with timeout plus async,
methods using testcasesource, etc. The existing NUnit tests have lots
of examples but of course none of them can use async.

This is actually something that would help us implement async tests
in all three projects... NUnit V2, NUnit 3.0 and NUnitLite

Charlie

On Sun, Sep 30, 2012 at 2:39 PM, Jv <email address hidden> wrote:
> Sure, Charlie, but this particular problem does require more than one
> person I thought and hence suggested to help. I will try to independently
> simulate some similar async scenarios and then seek help on how it can be
> merged with Simone's work.
>
> Jv
>
> On Mon, Oct 1, 2012 at 2:45 AM, Charlie Poole <email address hidden> wrote:
>
>> Hi Jv,
>>
>> You should coordinate with Simone on this, since he has the
>> bug assigned. OTOH, there are tons of things to do other
>> than this if you want something of your own!
>>
>> Charlie
>>
>> On Sun, Sep 30, 2012 at 4:02 AM, Jv <email address hidden> wrote:
>> > Since I am fairly free, I can work on this issue independently as a
>> > spike. Please point me to the appropriate files in NUnit v2.
>> >
>> > I will be working on finding if the async threads' context can be
>> > independently established.
>> >
>> > This will help in maintaining that tests "await"-ing a async result is
>> > testing the right context and will also help in establishing the "void"
>> > context.
>> >
>> > Jv
>> >
>> > --
>> > You received this bug notification because you are subscribed to NUnit
>> > Extended Testing Platform.
>> > https://bugs.launchpad.net/bugs/1057981
>> >
>> > Title:
>> > C#5 async tests are not supported
>> >
>> > To manage notifications about this bug go to:
>> > https://bugs.launchpad.net/nunit-3.0/+bug/1057981/+subscriptions
>>
>> --
>> You received this bug notification because you are a member of NUnit
>> Developers, which is subscribed to NUnit V2.
>> https://bugs.launchpad.net/bugs/1057981
>>
>> Title:
>> C#5 async tests are not supported
>>
>> Status in NUnit Test Framework:
>> Triaged
>> Status in NUnitLite Testing Framework:
>> Triaged
>> Status in NUnit V2 Test Framework:
>> In Progress
>>
>> Bug description:
>> If a method is marked async, nunit does not recognise it as a test,
>> and some test runners may incorrectly pass it while it is still
>> running. These methods actually return a Task not void, and the test
>> can only be passed if the task completes without a failure.
>>
>> As detailed here http://anthonysteele.co.uk/async-and-await-with-nunit
>>
>> MSTest supports async tests
>>
>> http://blogs.msdn.com/b/visualstudioalm/archive/2012/03/13/what-s-new-for-mstest-unit-tests-in-visual-studio-11-beta.aspx
>>
>> To manage notifications about this bug go to:
>> https://bugs.launchpad.net/nunit-3.0/+bug/1057981/+subscriptions
>>
>
>
> --
> Regards,
>
> Ravichandran Jv
> http://ravichandranjv.blogspot.com
>
> --
> You received this bug notification because you are subscribed to NUnit
> Extended Testing Platform.
> https://bugs.laun...

Read more...

Simone Busoli (simone.busoli) wrote :

Hello, I've pushed the changes to the branch you see below and the
description of the merge request for details.

Charlie, I didn't take any decision with regards to how to handle solution
projects built for fx > 2.0 so in order to run the build you need to have
4.5 and specify net-4.0 as the target via nant (apparently it still doesn't
explicitly support .NET 4.5). I guess it would make sense to put some
conditionals in the build scripts, but it's a bit confusing, specifically
because this feature is available also for the net-2.0 build so it would
make sense to run its tests even in that case, but then I'm not sure how
you could build the test assembly if you have specified the net-2.0/3.5
targets, as the build will fail. Maybe an override specifically for that
project? I kept the changes in that regard to the minimum so you have have
a look at how it would make sense to handle it.

Simone

On Mon, Oct 1, 2012 at 2:27 AM, Launchpad Bug Tracker <
<email address hidden>> wrote:

> ** Branch linked: lp:~simone.busoli/nunitv2/async-support-void-and-task-
> return-types
>
> --
> You received this bug notification because you are a bug assignee.
> https://bugs.launchpad.net/bugs/1057981
>
> Title:
> C#5 async tests are not supported
>
> Status in NUnit Test Framework:
> Triaged
> Status in NUnitLite Testing Framework:
> Triaged
> Status in NUnit V2 Test Framework:
> In Progress
>
> Bug description:
> If a method is marked async, nunit does not recognise it as a test,
> and some test runners may incorrectly pass it while it is still
> running. These methods actually return a Task not void, and the test
> can only be passed if the task completes without a failure.
>
> As detailed here http://anthonysteele.co.uk/async-and-await-with-nunit
>
> MSTest supports async tests
>
> http://blogs.msdn.com/b/visualstudioalm/archive/2012/03/13/what-s-new-for-mstest-unit-tests-in-visual-studio-11-beta.aspx
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/nunit-3.0/+bug/1057981/+subscriptions
>

Simone Busoli (simone.busoli) wrote :

Hello, I've pushed the changes to a new branch, please have a look at the description of the merge request for details.

Charlie, I didn't take any decision with regards to how to handle solution projects built for fx > 2.0 so in order to run the build you need to have 4.5 and specify net-4.0 as the target via nant (apparently it still doesn't explicitly support .NET 4.5). I guess it would make sense to put some conditionals in the build scripts, but it's a bit confusing, specifically because this feature is available also for the net-2.0 build so it would make sense to run its tests even in that case, but then I'm not sure how you could build the test assembly if you have specified the net-2.0/3.5 targets, as the build will fail. Maybe an override specifically for that project? I kept the changes in that regard to the minimum so you have have a look at how it would make sense to handle it.

Jv (jv-ravichandran) wrote :
Download full text (4.9 KiB)

Ok, will do.

I downloaded TFS 2012 express but my Windows Home Basic does not support it
so mid-way downloading VS 2012 express...will be able to deliver some
scenarios by this weekend.Unusual power failure in my area since morning
may not help my cause today, it seems.

Jv

On Mon, Oct 1, 2012 at 3:37 AM, Charlie Poole <email address hidden> wrote:

> Sounds good! One thing we need is a test assembly built in VS2012,
> which contains all sorts of combinations of test features, for example,
> test cases that use an async method, methods with timeout plus async,
> methods using testcasesource, etc. The existing NUnit tests have lots
> of examples but of course none of them can use async.
>
> This is actually something that would help us implement async tests
> in all three projects... NUnit V2, NUnit 3.0 and NUnitLite
>
> Charlie
>
> On Sun, Sep 30, 2012 at 2:39 PM, Jv <email address hidden> wrote:
> > Sure, Charlie, but this particular problem does require more than one
> > person I thought and hence suggested to help. I will try to independently
> > simulate some similar async scenarios and then seek help on how it can be
> > merged with Simone's work.
> >
> > Jv
> >
> > On Mon, Oct 1, 2012 at 2:45 AM, Charlie Poole <email address hidden> wrote:
> >
> >> Hi Jv,
> >>
> >> You should coordinate with Simone on this, since he has the
> >> bug assigned. OTOH, there are tons of things to do other
> >> than this if you want something of your own!
> >>
> >> Charlie
> >>
> >> On Sun, Sep 30, 2012 at 4:02 AM, Jv <email address hidden> wrote:
> >> > Since I am fairly free, I can work on this issue independently as a
> >> > spike. Please point me to the appropriate files in NUnit v2.
> >> >
> >> > I will be working on finding if the async threads' context can be
> >> > independently established.
> >> >
> >> > This will help in maintaining that tests "await"-ing a async result is
> >> > testing the right context and will also help in establishing the
> "void"
> >> > context.
> >> >
> >> > Jv
> >> >
> >> > --
> >> > You received this bug notification because you are subscribed to NUnit
> >> > Extended Testing Platform.
> >> > https://bugs.launchpad.net/bugs/1057981
> >> >
> >> > Title:
> >> > C#5 async tests are not supported
> >> >
> >> > To manage notifications about this bug go to:
> >> > https://bugs.launchpad.net/nunit-3.0/+bug/1057981/+subscriptions
> >>
> >> --
> >> You received this bug notification because you are a member of NUnit
> >> Developers, which is subscribed to NUnit V2.
> >> https://bugs.launchpad.net/bugs/1057981
> >>
> >> Title:
> >> C#5 async tests are not supported
> >>
> >> Status in NUnit Test Framework:
> >> Triaged
> >> Status in NUnitLite Testing Framework:
> >> Triaged
> >> Status in NUnit V2 Test Framework:
> >> In Progress
> >>
> >> Bug description:
> >> If a method is marked async, nunit does not recognise it as a test,
> >> and some test runners may incorrectly pass it while it is still
> >> running. These methods actually return a Task not void, and the test
> >> can only be passed if the task completes without a failure.
> >>
> >> As detailed here
> http://anthonysteele.co.uk/async-and-await-w...

Read more...

Simone Busoli (simone.busoli) wrote :
Download full text (6.7 KiB)

Jv, I've committed the complete feature in this
branch<https://code.launchpad.net/~simone.busoli/nunitv2/async-support-void-and-task-return-types>already,
I would suggest you have it a look and come up with improvements
or additional test scenarios eventually. For instance I'm not 100%
confident of the implementation of the custom synchronization context, but
I didn't find any way to make any test fail yet.

Simone

On Mon, Oct 1, 2012 at 9:43 AM, Jv <email address hidden> wrote:

> Ok, will do.
>
> I downloaded TFS 2012 express but my Windows Home Basic does not support it
> so mid-way downloading VS 2012 express...will be able to deliver some
> scenarios by this weekend.Unusual power failure in my area since morning
> may not help my cause today, it seems.
>
> Jv
>
> On Mon, Oct 1, 2012 at 3:37 AM, Charlie Poole <email address hidden> wrote:
>
> > Sounds good! One thing we need is a test assembly built in VS2012,
> > which contains all sorts of combinations of test features, for example,
> > test cases that use an async method, methods with timeout plus async,
> > methods using testcasesource, etc. The existing NUnit tests have lots
> > of examples but of course none of them can use async.
> >
> > This is actually something that would help us implement async tests
> > in all three projects... NUnit V2, NUnit 3.0 and NUnitLite
> >
> > Charlie
> >
> > On Sun, Sep 30, 2012 at 2:39 PM, Jv <email address hidden> wrote:
> > > Sure, Charlie, but this particular problem does require more than one
> > > person I thought and hence suggested to help. I will try to
> independently
> > > simulate some similar async scenarios and then seek help on how it can
> be
> > > merged with Simone's work.
> > >
> > > Jv
> > >
> > > On Mon, Oct 1, 2012 at 2:45 AM, Charlie Poole <email address hidden>
> wrote:
> > >
> > >> Hi Jv,
> > >>
> > >> You should coordinate with Simone on this, since he has the
> > >> bug assigned. OTOH, there are tons of things to do other
> > >> than this if you want something of your own!
> > >>
> > >> Charlie
> > >>
> > >> On Sun, Sep 30, 2012 at 4:02 AM, Jv <email address hidden>
> wrote:
> > >> > Since I am fairly free, I can work on this issue independently as a
> > >> > spike. Please point me to the appropriate files in NUnit v2.
> > >> >
> > >> > I will be working on finding if the async threads' context can be
> > >> > independently established.
> > >> >
> > >> > This will help in maintaining that tests "await"-ing a async result
> is
> > >> > testing the right context and will also help in establishing the
> > "void"
> > >> > context.
> > >> >
> > >> > Jv
> > >> >
> > >> > --
> > >> > You received this bug notification because you are subscribed to
> NUnit
> > >> > Extended Testing Platform.
> > >> > https://bugs.launchpad.net/bugs/1057981
> > >> >
> > >> > Title:
> > >> > C#5 async tests are not supported
> > >> >
> > >> > To manage notifications about this bug go to:
> > >> > https://bugs.launchpad.net/nunit-3.0/+bug/1057981/+subscriptions
> > >>
> > >> --
> > >> You received this bug notification because you are a member of NUnit
> > >> Developers, which is subscribed to NUnit V2.
> > >> https://bugs.launchpad.net/b...

Read more...

@Charlie: You're right, task return type only helps if you are targeting .Net 4.0 or up.

I see you guys have goten quite far with this already. :)

Simone Busoli (simone.busoli) wrote :

Hi Anthony, yes, if you have had any experience with implementing I'd
appreciate if you could have a look at the branch where I've implemented
it. A nice addition is that it would also now be possible to do this:

[TestCase(Result = 1)]
public async Task<int> Do()
{
    return await Task.FromResult(1);
}

On Mon, Oct 1, 2012 at 11:28 AM, Anthony Steele <Anthony.Steele@7digital.com
> wrote:

> @Charlie: You're right, task return type only helps if you are targeting
> .Net 4.0 or up.
>
> I see you guys have goten quite far with this already. :)
>
> --
> You received this bug notification because you are a bug assignee.
> https://bugs.launchpad.net/bugs/1057981
>
> Title:
> C#5 async tests are not supported
>
> Status in NUnit Test Framework:
> Triaged
> Status in NUnitLite Testing Framework:
> Triaged
> Status in NUnit V2 Test Framework:
> In Progress
>
> Bug description:
> If a method is marked async, nunit does not recognise it as a test,
> and some test runners may incorrectly pass it while it is still
> running. These methods actually return a Task not void, and the test
> can only be passed if the task completes without a failure.
>
> As detailed here http://anthonysteele.co.uk/async-and-await-with-nunit
>
> MSTest supports async tests
>
> http://blogs.msdn.com/b/visualstudioalm/archive/2012/03/13/what-s-new-for-mstest-unit-tests-in-visual-studio-11-beta.aspx
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/nunit-3.0/+bug/1057981/+subscriptions
>

Jv (jv-ravichandran) wrote :
Download full text (8.3 KiB)

Thanks, Simone, will do.

Jv

On Mon, Oct 1, 2012 at 2:16 PM, Simone Busoli <email address hidden>wrote:

> Jv, I've committed the complete feature in this
> branch<
> https://code.launchpad.net/~simone.busoli/nunitv2/async-support-void-and-task-return-types
> >already,
> I would suggest you have it a look and come up with improvements
> or additional test scenarios eventually. For instance I'm not 100%
> confident of the implementation of the custom synchronization context, but
> I didn't find any way to make any test fail yet.
>
> Simone
>
> On Mon, Oct 1, 2012 at 9:43 AM, Jv <email address hidden> wrote:
>
> > Ok, will do.
> >
> > I downloaded TFS 2012 express but my Windows Home Basic does not support
> it
> > so mid-way downloading VS 2012 express...will be able to deliver some
> > scenarios by this weekend.Unusual power failure in my area since morning
> > may not help my cause today, it seems.
> >
> > Jv
> >
> > On Mon, Oct 1, 2012 at 3:37 AM, Charlie Poole <email address hidden> wrote:
> >
> > > Sounds good! One thing we need is a test assembly built in VS2012,
> > > which contains all sorts of combinations of test features, for example,
> > > test cases that use an async method, methods with timeout plus async,
> > > methods using testcasesource, etc. The existing NUnit tests have lots
> > > of examples but of course none of them can use async.
> > >
> > > This is actually something that would help us implement async tests
> > > in all three projects... NUnit V2, NUnit 3.0 and NUnitLite
> > >
> > > Charlie
> > >
> > > On Sun, Sep 30, 2012 at 2:39 PM, Jv <email address hidden> wrote:
> > > > Sure, Charlie, but this particular problem does require more than one
> > > > person I thought and hence suggested to help. I will try to
> > independently
> > > > simulate some similar async scenarios and then seek help on how it
> can
> > be
> > > > merged with Simone's work.
> > > >
> > > > Jv
> > > >
> > > > On Mon, Oct 1, 2012 at 2:45 AM, Charlie Poole <email address hidden>
> > wrote:
> > > >
> > > >> Hi Jv,
> > > >>
> > > >> You should coordinate with Simone on this, since he has the
> > > >> bug assigned. OTOH, there are tons of things to do other
> > > >> than this if you want something of your own!
> > > >>
> > > >> Charlie
> > > >>
> > > >> On Sun, Sep 30, 2012 at 4:02 AM, Jv <email address hidden>
> > wrote:
> > > >> > Since I am fairly free, I can work on this issue independently as
> a
> > > >> > spike. Please point me to the appropriate files in NUnit v2.
> > > >> >
> > > >> > I will be working on finding if the async threads' context can be
> > > >> > independently established.
> > > >> >
> > > >> > This will help in maintaining that tests "await"-ing a async
> result
> > is
> > > >> > testing the right context and will also help in establishing the
> > > "void"
> > > >> > context.
> > > >> >
> > > >> > Jv
> > > >> >
> > > >> > --
> > > >> > You received this bug notification because you are subscribed to
> > NUnit
> > > >> > Extended Testing Platform.
> > > >> > https://bugs.launchpad.net/bugs/1057981
> > > >> >
> > > >> > Title:
> > > >> > C#5 async tests are not supported
> > > >> >
> > > >> > To manage notific...

Read more...

Jv (jv-ravichandran) wrote :
Download full text (5.8 KiB)

Hi Charlie,

1. Will start with the scenarios outlined by you plus some of my own. Maybe
they could feature in the help section.

2. Waiting for the merge to happen or can NUnit GUI work with Simone's
commit?

Because I also want to test the GCConcurrent (for previous .net versions)
and serverGc (for .net 4.5) element and this can be done only through the
App config file. I guess this is more important due to it being the new
feature in .Net 4.5.

3. The unmanaged aspect to it, where the above configuration settings can
be overridden by the requesting app.What happens in the test (this is not a
question) when the config settings can be overridden by a call to
IsServerGC call from the unmanaged app. Is this consideration important?
And to complicate things further, some processor.architectures are not
supported.

I am not sure if this should be documented as a known issue in NUnit or
should NUnit provide a hint when the Async tests are run or executed?

4. The SynchronizationContext and the AsynchronizationContext can be quite
tricky when GcCocurrent and ServerGC elements can both be used. Please
comment on this with reference to #2 above.

Jv

On Mon, Oct 1, 2012 at 3:37 AM, Charlie Poole <email address hidden> wrote:

> Sounds good! One thing we need is a test assembly built in VS2012,
> which contains all sorts of combinations of test features, for example,
> test cases that use an async method, methods with timeout plus async,
> methods using testcasesource, etc. The existing NUnit tests have lots
> of examples but of course none of them can use async.
>
> This is actually something that would help us implement async tests
> in all three projects... NUnit V2, NUnit 3.0 and NUnitLite
>
> Charlie
>
> On Sun, Sep 30, 2012 at 2:39 PM, Jv <email address hidden> wrote:
> > Sure, Charlie, but this particular problem does require more than one
> > person I thought and hence suggested to help. I will try to independently
> > simulate some similar async scenarios and then seek help on how it can be
> > merged with Simone's work.
> >
> > Jv
> >
> > On Mon, Oct 1, 2012 at 2:45 AM, Charlie Poole <email address hidden> wrote:
> >
> >> Hi Jv,
> >>
> >> You should coordinate with Simone on this, since he has the
> >> bug assigned. OTOH, there are tons of things to do other
> >> than this if you want something of your own!
> >>
> >> Charlie
> >>
> >> On Sun, Sep 30, 2012 at 4:02 AM, Jv <email address hidden> wrote:
> >> > Since I am fairly free, I can work on this issue independently as a
> >> > spike. Please point me to the appropriate files in NUnit v2.
> >> >
> >> > I will be working on finding if the async threads' context can be
> >> > independently established.
> >> >
> >> > This will help in maintaining that tests "await"-ing a async result is
> >> > testing the right context and will also help in establishing the
> "void"
> >> > context.
> >> >
> >> > Jv
> >> >
> >> > --
> >> > You received this bug notification because you are subscribed to NUnit
> >> > Extended Testing Platform.
> >> > https://bugs.launchpad.net/bugs/1057981
> >> >
> >> > Title:
> >> > C#5 async tests are not supported
> >> >
> >> > To manage notifications about this bug ...

Read more...

Simone Busoli (simone.busoli) wrote :
Download full text (7.7 KiB)

For anyone who would like to try it out and improve the test coverage these
are the steps:

   1. bzr branch
   lp:~simone.busoli/nunitv2/async-support-void-and-task-return-types
   2. cd into the directory
   3. [optional] modify the NUnitTests.v2.nunit to contain only the 4.5
   core test assembly
   4. build.bat test net-4.0

Of course existing runners/core cannot run the new tests, so they have to
be built from the source, which is what the above steps do.
I'd say that GC modes have nothing to do with this though.

Simone

On Tue, Oct 2, 2012 at 4:56 PM, Jv <email address hidden> wrote:

> Hi Charlie,
>
> 1. Will start with the scenarios outlined by you plus some of my own. Maybe
> they could feature in the help section.
>
> 2. Waiting for the merge to happen or can NUnit GUI work with Simone's
> commit?
>
> Because I also want to test the GCConcurrent (for previous .net versions)
> and serverGc (for .net 4.5) element and this can be done only through the
> App config file. I guess this is more important due to it being the new
> feature in .Net 4.5.
>
> 3. The unmanaged aspect to it, where the above configuration settings can
> be overridden by the requesting app.What happens in the test (this is not a
> question) when the config settings can be overridden by a call to
> IsServerGC call from the unmanaged app. Is this consideration important?
> And to complicate things further, some processor.architectures are not
> supported.
>
> I am not sure if this should be documented as a known issue in NUnit or
> should NUnit provide a hint when the Async tests are run or executed?
>
> 4. The SynchronizationContext and the AsynchronizationContext can be quite
> tricky when GcCocurrent and ServerGC elements can both be used. Please
> comment on this with reference to #2 above.
>
> Jv
>
> On Mon, Oct 1, 2012 at 3:37 AM, Charlie Poole <email address hidden> wrote:
>
> > Sounds good! One thing we need is a test assembly built in VS2012,
> > which contains all sorts of combinations of test features, for example,
> > test cases that use an async method, methods with timeout plus async,
> > methods using testcasesource, etc. The existing NUnit tests have lots
> > of examples but of course none of them can use async.
> >
> > This is actually something that would help us implement async tests
> > in all three projects... NUnit V2, NUnit 3.0 and NUnitLite
> >
> > Charlie
> >
> > On Sun, Sep 30, 2012 at 2:39 PM, Jv <email address hidden> wrote:
> > > Sure, Charlie, but this particular problem does require more than one
> > > person I thought and hence suggested to help. I will try to
> independently
> > > simulate some similar async scenarios and then seek help on how it can
> be
> > > merged with Simone's work.
> > >
> > > Jv
> > >
> > > On Mon, Oct 1, 2012 at 2:45 AM, Charlie Poole <email address hidden>
> wrote:
> > >
> > >> Hi Jv,
> > >>
> > >> You should coordinate with Simone on this, since he has the
> > >> bug assigned. OTOH, there are tons of things to do other
> > >> than this if you want something of your own!
> > >>
> > >> Charlie
> > >>
> > >> On Sun, Sep 30, 2012 at 4:02 AM, Jv <email address hidden>
> wrote:
> > >> > Since I am fair...

Read more...

Download full text (7.5 KiB)

Hi Jv,

You have to pull and build Simone's branch from source in order to be
able to work on this at all. As I remember from some previous work
you did, you were unable to do that on your machine. Is that still
a problem for you?

Charlie

On Tue, Oct 2, 2012 at 7:56 AM, Jv <email address hidden> wrote:
> Hi Charlie,
>
> 1. Will start with the scenarios outlined by you plus some of my own. Maybe
> they could feature in the help section.
>
> 2. Waiting for the merge to happen or can NUnit GUI work with Simone's
> commit?
>
> Because I also want to test the GCConcurrent (for previous .net versions)
> and serverGc (for .net 4.5) element and this can be done only through the
> App config file. I guess this is more important due to it being the new
> feature in .Net 4.5.
>
> 3. The unmanaged aspect to it, where the above configuration settings can
> be overridden by the requesting app.What happens in the test (this is not a
> question) when the config settings can be overridden by a call to
> IsServerGC call from the unmanaged app. Is this consideration important?
> And to complicate things further, some processor.architectures are not
> supported.
>
> I am not sure if this should be documented as a known issue in NUnit or
> should NUnit provide a hint when the Async tests are run or executed?
>
> 4. The SynchronizationContext and the AsynchronizationContext can be quite
> tricky when GcCocurrent and ServerGC elements can both be used. Please
> comment on this with reference to #2 above.
>
> Jv
>
> On Mon, Oct 1, 2012 at 3:37 AM, Charlie Poole <email address hidden> wrote:
>
>> Sounds good! One thing we need is a test assembly built in VS2012,
>> which contains all sorts of combinations of test features, for example,
>> test cases that use an async method, methods with timeout plus async,
>> methods using testcasesource, etc. The existing NUnit tests have lots
>> of examples but of course none of them can use async.
>>
>> This is actually something that would help us implement async tests
>> in all three projects... NUnit V2, NUnit 3.0 and NUnitLite
>>
>> Charlie
>>
>> On Sun, Sep 30, 2012 at 2:39 PM, Jv <email address hidden> wrote:
>> > Sure, Charlie, but this particular problem does require more than one
>> > person I thought and hence suggested to help. I will try to independently
>> > simulate some similar async scenarios and then seek help on how it can be
>> > merged with Simone's work.
>> >
>> > Jv
>> >
>> > On Mon, Oct 1, 2012 at 2:45 AM, Charlie Poole <email address hidden> wrote:
>> >
>> >> Hi Jv,
>> >>
>> >> You should coordinate with Simone on this, since he has the
>> >> bug assigned. OTOH, there are tons of things to do other
>> >> than this if you want something of your own!
>> >>
>> >> Charlie
>> >>
>> >> On Sun, Sep 30, 2012 at 4:02 AM, Jv <email address hidden> wrote:
>> >> > Since I am fairly free, I can work on this issue independently as a
>> >> > spike. Please point me to the appropriate files in NUnit v2.
>> >> >
>> >> > I will be working on finding if the async threads' context can be
>> >> > independently established.
>> >> >
>> >> > This will help in maintaining that tests "await"-ing a async result is
>> >> ...

Read more...

Jv (jv-ravichandran) wrote :
Download full text (9.8 KiB)

Hi Charlie,

No problems. Branched Simone's three times for different reasons/tests. All
builds succeed. Building with VS 2012 Express edition for Windows Desktop
since it will be required by you later, I guess.

I am working on the await scenarios, in an independent project file, but
with the .core dlls built of Simone's branch.

My contribution, here, I guess will be to provide you with help examples
for the wiki and if something comes up related to the tests, will post it
here!

A question though. Is it necessary for the Test method to be marked Async?
Since await returns a Task, can there be a scenario for the NUnit test
method to not be Async ?

Thanks,

Jv

On Tue, Oct 2, 2012 at 9:40 PM, Charlie Poole <email address hidden> wrote:

> Hi Jv,
>
> You have to pull and build Simone's branch from source in order to be
> able to work on this at all. As I remember from some previous work
> you did, you were unable to do that on your machine. Is that still
> a problem for you?
>
> Charlie
>
> On Tue, Oct 2, 2012 at 7:56 AM, Jv <email address hidden> wrote:
> > Hi Charlie,
> >
> > 1. Will start with the scenarios outlined by you plus some of my own.
> Maybe
> > they could feature in the help section.
> >
> > 2. Waiting for the merge to happen or can NUnit GUI work with Simone's
> > commit?
> >
> > Because I also want to test the GCConcurrent (for previous .net versions)
> > and serverGc (for .net 4.5) element and this can be done only through the
> > App config file. I guess this is more important due to it being the new
> > feature in .Net 4.5.
> >
> > 3. The unmanaged aspect to it, where the above configuration settings can
> > be overridden by the requesting app.What happens in the test (this is
> not a
> > question) when the config settings can be overridden by a call to
> > IsServerGC call from the unmanaged app. Is this consideration important?
> > And to complicate things further, some processor.architectures are not
> > supported.
> >
> > I am not sure if this should be documented as a known issue in NUnit or
> > should NUnit provide a hint when the Async tests are run or executed?
> >
> > 4. The SynchronizationContext and the AsynchronizationContext can be
> quite
> > tricky when GcCocurrent and ServerGC elements can both be used. Please
> > comment on this with reference to #2 above.
> >
> > Jv
> >
> > On Mon, Oct 1, 2012 at 3:37 AM, Charlie Poole <email address hidden> wrote:
> >
> >> Sounds good! One thing we need is a test assembly built in VS2012,
> >> which contains all sorts of combinations of test features, for example,
> >> test cases that use an async method, methods with timeout plus async,
> >> methods using testcasesource, etc. The existing NUnit tests have lots
> >> of examples but of course none of them can use async.
> >>
> >> This is actually something that would help us implement async tests
> >> in all three projects... NUnit V2, NUnit 3.0 and NUnitLite
> >>
> >> Charlie
> >>
> >> On Sun, Sep 30, 2012 at 2:39 PM, Jv <email address hidden> wrote:
> >> > Sure, Charlie, but this particular problem does require more than one
> >> > person I thought and hence suggested to help. I will try to
> independently
> >> > s...

Jv (jv-ravichandran) wrote :
Download full text (9.2 KiB)

Is not the branch pull-ed by me not visible in the lp log?

Jv

On Tue, Oct 2, 2012 at 9:40 PM, Charlie Poole <email address hidden> wrote:

> Hi Jv,
>
> You have to pull and build Simone's branch from source in order to be
> able to work on this at all. As I remember from some previous work
> you did, you were unable to do that on your machine. Is that still
> a problem for you?
>
> Charlie
>
> On Tue, Oct 2, 2012 at 7:56 AM, Jv <email address hidden> wrote:
> > Hi Charlie,
> >
> > 1. Will start with the scenarios outlined by you plus some of my own.
> Maybe
> > they could feature in the help section.
> >
> > 2. Waiting for the merge to happen or can NUnit GUI work with Simone's
> > commit?
> >
> > Because I also want to test the GCConcurrent (for previous .net versions)
> > and serverGc (for .net 4.5) element and this can be done only through the
> > App config file. I guess this is more important due to it being the new
> > feature in .Net 4.5.
> >
> > 3. The unmanaged aspect to it, where the above configuration settings can
> > be overridden by the requesting app.What happens in the test (this is
> not a
> > question) when the config settings can be overridden by a call to
> > IsServerGC call from the unmanaged app. Is this consideration important?
> > And to complicate things further, some processor.architectures are not
> > supported.
> >
> > I am not sure if this should be documented as a known issue in NUnit or
> > should NUnit provide a hint when the Async tests are run or executed?
> >
> > 4. The SynchronizationContext and the AsynchronizationContext can be
> quite
> > tricky when GcCocurrent and ServerGC elements can both be used. Please
> > comment on this with reference to #2 above.
> >
> > Jv
> >
> > On Mon, Oct 1, 2012 at 3:37 AM, Charlie Poole <email address hidden> wrote:
> >
> >> Sounds good! One thing we need is a test assembly built in VS2012,
> >> which contains all sorts of combinations of test features, for example,
> >> test cases that use an async method, methods with timeout plus async,
> >> methods using testcasesource, etc. The existing NUnit tests have lots
> >> of examples but of course none of them can use async.
> >>
> >> This is actually something that would help us implement async tests
> >> in all three projects... NUnit V2, NUnit 3.0 and NUnitLite
> >>
> >> Charlie
> >>
> >> On Sun, Sep 30, 2012 at 2:39 PM, Jv <email address hidden> wrote:
> >> > Sure, Charlie, but this particular problem does require more than one
> >> > person I thought and hence suggested to help. I will try to
> independently
> >> > simulate some similar async scenarios and then seek help on how it
> can be
> >> > merged with Simone's work.
> >> >
> >> > Jv
> >> >
> >> > On Mon, Oct 1, 2012 at 2:45 AM, Charlie Poole <email address hidden>
> wrote:
> >> >
> >> >> Hi Jv,
> >> >>
> >> >> You should coordinate with Simone on this, since he has the
> >> >> bug assigned. OTOH, there are tons of things to do other
> >> >> than this if you want something of your own!
> >> >>
> >> >> Charlie
> >> >>
> >> >> On Sun, Sep 30, 2012 at 4:02 AM, Jv <email address hidden>
> wrote:
> >> >> > Since I am fairly free, I can work on this issue indep...

Read more...

Charlie Poole (charlie.poole) wrote :
Download full text (10.0 KiB)

That's a scary idea. Anybody can see what you are accessing? No,
not as far as I know. :-) Perhaps the LP guys can.

Charlie

On Tue, Oct 2, 2012 at 9:56 AM, Jv <email address hidden> wrote:
> Is not the branch pull-ed by me not visible in the lp log?
>
> Jv
>
> On Tue, Oct 2, 2012 at 9:40 PM, Charlie Poole <email address hidden> wrote:
>
>> Hi Jv,
>>
>> You have to pull and build Simone's branch from source in order to be
>> able to work on this at all. As I remember from some previous work
>> you did, you were unable to do that on your machine. Is that still
>> a problem for you?
>>
>> Charlie
>>
>> On Tue, Oct 2, 2012 at 7:56 AM, Jv <email address hidden> wrote:
>> > Hi Charlie,
>> >
>> > 1. Will start with the scenarios outlined by you plus some of my own.
>> Maybe
>> > they could feature in the help section.
>> >
>> > 2. Waiting for the merge to happen or can NUnit GUI work with Simone's
>> > commit?
>> >
>> > Because I also want to test the GCConcurrent (for previous .net versions)
>> > and serverGc (for .net 4.5) element and this can be done only through the
>> > App config file. I guess this is more important due to it being the new
>> > feature in .Net 4.5.
>> >
>> > 3. The unmanaged aspect to it, where the above configuration settings can
>> > be overridden by the requesting app.What happens in the test (this is
>> not a
>> > question) when the config settings can be overridden by a call to
>> > IsServerGC call from the unmanaged app. Is this consideration important?
>> > And to complicate things further, some processor.architectures are not
>> > supported.
>> >
>> > I am not sure if this should be documented as a known issue in NUnit or
>> > should NUnit provide a hint when the Async tests are run or executed?
>> >
>> > 4. The SynchronizationContext and the AsynchronizationContext can be
>> quite
>> > tricky when GcCocurrent and ServerGC elements can both be used. Please
>> > comment on this with reference to #2 above.
>> >
>> > Jv
>> >
>> > On Mon, Oct 1, 2012 at 3:37 AM, Charlie Poole <email address hidden> wrote:
>> >
>> >> Sounds good! One thing we need is a test assembly built in VS2012,
>> >> which contains all sorts of combinations of test features, for example,
>> >> test cases that use an async method, methods with timeout plus async,
>> >> methods using testcasesource, etc. The existing NUnit tests have lots
>> >> of examples but of course none of them can use async.
>> >>
>> >> This is actually something that would help us implement async tests
>> >> in all three projects... NUnit V2, NUnit 3.0 and NUnitLite
>> >>
>> >> Charlie
>> >>
>> >> On Sun, Sep 30, 2012 at 2:39 PM, Jv <email address hidden> wrote:
>> >> > Sure, Charlie, but this particular problem does require more than one
>> >> > person I thought and hence suggested to help. I will try to
>> independently
>> >> > simulate some similar async scenarios and then seek help on how it
>> can be
>> >> > merged with Simone's work.
>> >> >
>> >> > Jv
>> >> >
>> >> > On Mon, Oct 1, 2012 at 2:45 AM, Charlie Poole <email address hidden>
>> wrote:
>> >> >
>> >> >> Hi Jv,
>> >> >>
>> >> >> You should coordinate with Simone on this, since he has the
>> >> >> bug assign...

Charlie Poole (charlie.poole) wrote :
Download full text (11.0 KiB)

Hi Jv,

On Tue, Oct 2, 2012 at 9:54 AM, Jv <email address hidden> wrote:
> Hi Charlie,
>
> No problems. Branched Simone's three times for different reasons/tests. All
> builds succeed. Building with VS 2012 Express edition for Windows Desktop
> since it will be required by you later, I guess.

No, that won't be required and won't even work I'm afraid.

First, NUnit V2 will never be built for .NET 4.5. That's what 3.0 is for.

Second, what we are trying to test here is whether NUnit V2, built for
.NET 2.0, can run tests built for .NET 4.5, which use async. Simone has
used reflection to do it and has not used any 4.5 features.

Of course, to test this, we need Tests built for .NET 4.5 but NUnit has
to be built as normally. Will the Express edition allow targeting .NET 2.0
when you build NUnit?

Charlie

> I am working on the await scenarios, in an independent project file, but
> with the .core dlls built of Simone's branch.
>
> My contribution, here, I guess will be to provide you with help examples
> for the wiki and if something comes up related to the tests, will post it
> here!
>
> A question though. Is it necessary for the Test method to be marked Async?
> Since await returns a Task, can there be a scenario for the NUnit test
> method to not be Async ?
>
> Thanks,
>
> Jv
>
> On Tue, Oct 2, 2012 at 9:40 PM, Charlie Poole <email address hidden> wrote:
>
>> Hi Jv,
>>
>> You have to pull and build Simone's branch from source in order to be
>> able to work on this at all. As I remember from some previous work
>> you did, you were unable to do that on your machine. Is that still
>> a problem for you?
>>
>> Charlie
>>
>> On Tue, Oct 2, 2012 at 7:56 AM, Jv <email address hidden> wrote:
>> > Hi Charlie,
>> >
>> > 1. Will start with the scenarios outlined by you plus some of my own.
>> Maybe
>> > they could feature in the help section.
>> >
>> > 2. Waiting for the merge to happen or can NUnit GUI work with Simone's
>> > commit?
>> >
>> > Because I also want to test the GCConcurrent (for previous .net versions)
>> > and serverGc (for .net 4.5) element and this can be done only through the
>> > App config file. I guess this is more important due to it being the new
>> > feature in .Net 4.5.
>> >
>> > 3. The unmanaged aspect to it, where the above configuration settings can
>> > be overridden by the requesting app.What happens in the test (this is
>> not a
>> > question) when the config settings can be overridden by a call to
>> > IsServerGC call from the unmanaged app. Is this consideration important?
>> > And to complicate things further, some processor.architectures are not
>> > supported.
>> >
>> > I am not sure if this should be documented as a known issue in NUnit or
>> > should NUnit provide a hint when the Async tests are run or executed?
>> >
>> > 4. The SynchronizationContext and the AsynchronizationContext can be
>> quite
>> > tricky when GcCocurrent and ServerGC elements can both be used. Please
>> > comment on this with reference to #2 above.
>> >
>> > Jv
>> >
>> > On Mon, Oct 1, 2012 at 3:37 AM, Charlie Poole <email address hidden> wrote:
>> >
>> >> Sounds good! One thing we need is a test assembly built in VS2012,
>> >> which contai...

Jv (jv-ravichandran) wrote :
Download full text (13.1 KiB)

Yes, it does, attached is the project properties page but the Express
distribution says it is meant for evaluation purposes only. I do not know
what help it can be from your perspective.

Yes, but the Reflection class (in nunit.core.tests.net45) uses
LinqExpressions. Will this not pose a problem if the target framework is
2.0? Sorry if this is a stupid question.

Jv

On Tue, Oct 2, 2012 at 11:23 PM, Charlie Poole <email address hidden> wrote:

> Hi Jv,
>
> On Tue, Oct 2, 2012 at 9:54 AM, Jv <email address hidden> wrote:
> > Hi Charlie,
> >
> > No problems. Branched Simone's three times for different reasons/tests.
> All
> > builds succeed. Building with VS 2012 Express edition for Windows Desktop
> > since it will be required by you later, I guess.
>
> No, that won't be required and won't even work I'm afraid.
>
> First, NUnit V2 will never be built for .NET 4.5. That's what 3.0 is
> for.
>
> Second, what we are trying to test here is whether NUnit V2, built for
> .NET 2.0, can run tests built for .NET 4.5, which use async. Simone has
> used reflection to do it and has not used any 4.5 features.
>
> Of course, to test this, we need Tests built for .NET 4.5 but NUnit has
> to be built as normally. Will the Express edition allow targeting .NET 2.0
> when you build NUnit?
>
> Charlie
>
> > I am working on the await scenarios, in an independent project file, but
> > with the .core dlls built of Simone's branch.
> >
> > My contribution, here, I guess will be to provide you with help examples
> > for the wiki and if something comes up related to the tests, will post it
> > here!
> >
> > A question though. Is it necessary for the Test method to be marked
> Async?
> > Since await returns a Task, can there be a scenario for the NUnit test
> > method to not be Async ?
> >
> > Thanks,
> >
> > Jv
> >
> > On Tue, Oct 2, 2012 at 9:40 PM, Charlie Poole <email address hidden> wrote:
> >
> >> Hi Jv,
> >>
> >> You have to pull and build Simone's branch from source in order to be
> >> able to work on this at all. As I remember from some previous work
> >> you did, you were unable to do that on your machine. Is that still
> >> a problem for you?
> >>
> >> Charlie
> >>
> >> On Tue, Oct 2, 2012 at 7:56 AM, Jv <email address hidden> wrote:
> >> > Hi Charlie,
> >> >
> >> > 1. Will start with the scenarios outlined by you plus some of my own.
> >> Maybe
> >> > they could feature in the help section.
> >> >
> >> > 2. Waiting for the merge to happen or can NUnit GUI work with Simone's
> >> > commit?
> >> >
> >> > Because I also want to test the GCConcurrent (for previous .net
> versions)
> >> > and serverGc (for .net 4.5) element and this can be done only through
> the
> >> > App config file. I guess this is more important due to it being the
> new
> >> > feature in .Net 4.5.
> >> >
> >> > 3. The unmanaged aspect to it, where the above configuration settings
> can
> >> > be overridden by the requesting app.What happens in the test (this is
> >> not a
> >> > question) when the config settings can be overridden by a call to
> >> > IsServerGC call from the unmanaged app. Is this consideration
> important?
> >> > And to complicate things further, some processor.archit...

Charlie Poole (charlie.poole) wrote :
Download full text (14.5 KiB)

OK then, so you're safe. I know that their are various express releases and
some of them are limited in what they support.

I haven't loaded and tested that code yet. But the net45 test program is
just a set of tests, not NUnit. It is of course built for .NET 4.5. Simone
is working on making sure it will run under NUnit so it may not yet be
complete. Note that some code in nunit.core.tests is under the control
of #if statements, which keep it from being compiled when not wanted.

Charlie

On Tue, Oct 2, 2012 at 12:03 PM, Jv <email address hidden> wrote:
> Yes, it does, attached is the project properties page but the Express
> distribution says it is meant for evaluation purposes only. I do not know
> what help it can be from your perspective.
>
> Yes, but the Reflection class (in nunit.core.tests.net45) uses
> LinqExpressions. Will this not pose a problem if the target framework is
> 2.0? Sorry if this is a stupid question.
>
> Jv
>
> On Tue, Oct 2, 2012 at 11:23 PM, Charlie Poole <email address hidden>
> wrote:
>
>> Hi Jv,
>>
>> On Tue, Oct 2, 2012 at 9:54 AM, Jv <email address hidden> wrote:
>> > Hi Charlie,
>> >
>> > No problems. Branched Simone's three times for different reasons/tests.
>> All
>> > builds succeed. Building with VS 2012 Express edition for Windows Desktop
>> > since it will be required by you later, I guess.
>>
>> No, that won't be required and won't even work I'm afraid.
>>
>> First, NUnit V2 will never be built for .NET 4.5. That's what 3.0 is
>> for.
>>
>> Second, what we are trying to test here is whether NUnit V2, built for
>> .NET 2.0, can run tests built for .NET 4.5, which use async. Simone has
>> used reflection to do it and has not used any 4.5 features.
>>
>> Of course, to test this, we need Tests built for .NET 4.5 but NUnit has
>> to be built as normally. Will the Express edition allow targeting .NET 2.0
>> when you build NUnit?
>>
>> Charlie
>>
>> > I am working on the await scenarios, in an independent project file, but
>> > with the .core dlls built of Simone's branch.
>> >
>> > My contribution, here, I guess will be to provide you with help examples
>> > for the wiki and if something comes up related to the tests, will post it
>> > here!
>> >
>> > A question though. Is it necessary for the Test method to be marked
>> Async?
>> > Since await returns a Task, can there be a scenario for the NUnit test
>> > method to not be Async ?
>> >
>> > Thanks,
>> >
>> > Jv
>> >
>> > On Tue, Oct 2, 2012 at 9:40 PM, Charlie Poole <email address hidden> wrote:
>> >
>> >> Hi Jv,
>> >>
>> >> You have to pull and build Simone's branch from source in order to be
>> >> able to work on this at all. As I remember from some previous work
>> >> you did, you were unable to do that on your machine. Is that still
>> >> a problem for you?
>> >>
>> >> Charlie
>> >>
>> >> On Tue, Oct 2, 2012 at 7:56 AM, Jv <email address hidden> wrote:
>> >> > Hi Charlie,
>> >> >
>> >> > 1. Will start with the scenarios outlined by you plus some of my own.
>> >> Maybe
>> >> > they could feature in the help section.
>> >> >
>> >> > 2. Waiting for the merge to happen or can NUnit GUI work with Simone's
>> >> > commit?
>> >> >
>> >> > Because I also...

Simone Busoli (simone.busoli) wrote :
Download full text (18.0 KiB)

To summarize, the async feature works under NUnit built for CLR 2, of
course it will use an agent to run tests built for CLR > 2.

There is a sort of infrastructure problem that I posed already which
concerns how to build and test the async thing. Currently I didn't make any
explicit choice and the build fails if you try to build for CLR < 4,
because it tries to build the .NET 4.5 test assembly.
So far therefore you can successfully run a build with net-4.0, which will
run the new tests as well. Of course I also ran them under NUnit built for
CLR 2 but it's a manual process: exclude the tests from the build, build
for CLR 2, invoke nunit-console.exe (CLR 2) on the 4.5 assembly previously
built.

Ideally we would have to come up with a way to say that even when we build
for < 4.5 (there's no 4.5 now but only 4.0 as NAnt doesn't support it yet),
that assembly is still built for 4.5 so that tests can be run on it with
NUnit built for .NET < 4.5. I hope it makes sense. I would like to clarify
this with Charlie.

Also one question for Charlie: in order to see if tests are run correctly I
created some fixtures which are not supposed to be run directly but via my
own test code. In order to accomplish that I marked the suite as ignored,
but those tests then end up in the build results as ignored, which is not
really the case 'cause I'm running them by some other means. I wanted to
figure out if there was a way to make NUnit /ignore/ those tests so that
they don't show up as ignored.

Simone

On Tue, Oct 2, 2012 at 9:34 PM, Charlie Poole <email address hidden> wrote:

> OK then, so you're safe. I know that their are various express releases and
> some of them are limited in what they support.
>
> I haven't loaded and tested that code yet. But the net45 test program is
> just a set of tests, not NUnit. It is of course built for .NET 4.5. Simone
> is working on making sure it will run under NUnit so it may not yet be
> complete. Note that some code in nunit.core.tests is under the control
> of #if statements, which keep it from being compiled when not wanted.
>
> Charlie
>
> On Tue, Oct 2, 2012 at 12:03 PM, Jv <email address hidden> wrote:
> > Yes, it does, attached is the project properties page but the Express
> > distribution says it is meant for evaluation purposes only. I do not know
> > what help it can be from your perspective.
> >
> > Yes, but the Reflection class (in nunit.core.tests.net45) uses
> > LinqExpressions. Will this not pose a problem if the target framework is
> > 2.0? Sorry if this is a stupid question.
> >
> > Jv
> >
> > On Tue, Oct 2, 2012 at 11:23 PM, Charlie Poole <email address hidden>
> > wrote:
> >
> >> Hi Jv,
> >>
> >> On Tue, Oct 2, 2012 at 9:54 AM, Jv <email address hidden> wrote:
> >> > Hi Charlie,
> >> >
> >> > No problems. Branched Simone's three times for different
> reasons/tests.
> >> All
> >> > builds succeed. Building with VS 2012 Express edition for Windows
> Desktop
> >> > since it will be required by you later, I guess.
> >>
> >> No, that won't be required and won't even work I'm afraid.
> >>
> >> First, NUnit V2 will never be built for .NET 4.5. That's what 3.0 is
> >> for.
> >>
> >> Second, what we are tr...

Charlie Poole (charlie.poole) wrote :
Download full text (19.3 KiB)

On Tue, Oct 2, 2012 at 1:03 PM, Simone Busoli
<email address hidden> wrote:
> To summarize, the async feature works under NUnit built for CLR 2, of
> course it will use an agent to run tests built for CLR > 2.
>
> There is a sort of infrastructure problem that I posed already which
> concerns how to build and test the async thing. Currently I didn't make any
> explicit choice and the build fails if you try to build for CLR < 4,
> because it tries to build the .NET 4.5 test assembly.
> So far therefore you can successfully run a build with net-4.0, which will
> run the new tests as well. Of course I also ran them under NUnit built for
> CLR 2 but it's a manual process: exclude the tests from the build, build
> for CLR 2, invoke nunit-console.exe (CLR 2) on the 4.5 assembly previously
> built.

Yes, that's the infrastructure change I was hoping to avoid by postponing to
NUnit 3.0. :-) But never mind... you convinced me.

> Ideally we would have to come up with a way to say that even when we build
> for < 4.5 (there's no 4.5 now but only 4.0 as NAnt doesn't support it yet),
> that assembly is still built for 4.5 so that tests can be run on it with
> NUnit built for .NET < 4.5. I hope it makes sense. I would like to clarify
> this with Charlie.

What we need is a .NET 4.5 config. This guy has one...
http://stackoverflow.com/questions/11837795/building-net-4-5-projects-with-nant

> Also one question for Charlie: in order to see if tests are run correctly I
> created some fixtures which are not supposed to be run directly but via my
> own test code. In order to accomplish that I marked the suite as ignored,
> but those tests then end up in the build results as ignored, which is not
> really the case 'cause I'm running them by some other means. I wanted to
> figure out if there was a way to make NUnit /ignore/ those tests so that
> they don't show up as ignored.

Put those tests in the test-assembly dll. That's what it's for. To see how
it's used by other tests, just pick any class there and find references.

Charlie

> Simone
>
>
> On Tue, Oct 2, 2012 at 9:34 PM, Charlie Poole <email address hidden> wrote:
>
>> OK then, so you're safe. I know that their are various express releases and
>> some of them are limited in what they support.
>>
>> I haven't loaded and tested that code yet. But the net45 test program is
>> just a set of tests, not NUnit. It is of course built for .NET 4.5. Simone
>> is working on making sure it will run under NUnit so it may not yet be
>> complete. Note that some code in nunit.core.tests is under the control
>> of #if statements, which keep it from being compiled when not wanted.
>>
>> Charlie
>>
>> On Tue, Oct 2, 2012 at 12:03 PM, Jv <email address hidden> wrote:
>> > Yes, it does, attached is the project properties page but the Express
>> > distribution says it is meant for evaluation purposes only. I do not know
>> > what help it can be from your perspective.
>> >
>> > Yes, but the Reflection class (in nunit.core.tests.net45) uses
>> > LinqExpressions. Will this not pose a problem if the target framework is
>> > 2.0? Sorry if this is a stupid question.
>> >
>> > Jv
>> >
>> > On Tue, Oct 2, 2012 at 11:23 PM, Char...

Simone Busoli (simone.busoli) wrote :
Download full text (21.9 KiB)

inline

On Tue, Oct 2, 2012 at 10:29 PM, Charlie Poole <email address hidden> wrote:

> On Tue, Oct 2, 2012 at 1:03 PM, Simone Busoli
> <email address hidden> wrote:
> > To summarize, the async feature works under NUnit built for CLR 2, of
> > course it will use an agent to run tests built for CLR > 2.
> >
> > There is a sort of infrastructure problem that I posed already which
> > concerns how to build and test the async thing. Currently I didn't make
> any
> > explicit choice and the build fails if you try to build for CLR < 4,
> > because it tries to build the .NET 4.5 test assembly.
> > So far therefore you can successfully run a build with net-4.0, which
> will
> > run the new tests as well. Of course I also ran them under NUnit built
> for
> > CLR 2 but it's a manual process: exclude the tests from the build, build
> > for CLR 2, invoke nunit-console.exe (CLR 2) on the 4.5 assembly
> previously
> > built.
>
> Yes, that's the infrastructure change I was hoping to avoid by postponing
> to
> NUnit 3.0. :-) But never mind... you convinced me.
>

So you'll take care of that, right? :) Or just share how you would do it
and I'll do the rest.

>
> > Ideally we would have to come up with a way to say that even when we
> build
> > for < 4.5 (there's no 4.5 now but only 4.0 as NAnt doesn't support it
> yet),
> > that assembly is still built for 4.5 so that tests can be run on it with
> > NUnit built for .NET < 4.5. I hope it makes sense. I would like to
> clarify
> > this with Charlie.
>
> What we need is a .NET 4.5 config. This guy has one...
>
> http://stackoverflow.com/questions/11837795/building-net-4-5-projects-with-nant

Ah cool, I'll start by adding 4.5 to the whole build script system then.

>
>
> > Also one question for Charlie: in order to see if tests are run
> correctly I
> > created some fixtures which are not supposed to be run directly but via
> my
> > own test code. In order to accomplish that I marked the suite as ignored,
> > but those tests then end up in the build results as ignored, which is not
> > really the case 'cause I'm running them by some other means. I wanted to
> > figure out if there was a way to make NUnit /ignore/ those tests so that
> > they don't show up as ignored.
>
> Put those tests in the test-assembly dll. That's what it's for. To see how
> it's used by other tests, just pick any class there and find references.
>

I see, it makes sense. According to how you would like to do the
"infrastructure change" I guess they may need to stay in a 4.5 isolated
assembly though.

>
> Charlie
>
> > Simone
> >
> >
> > On Tue, Oct 2, 2012 at 9:34 PM, Charlie Poole <email address hidden> wrote:
> >
> >> OK then, so you're safe. I know that their are various express releases
> and
> >> some of them are limited in what they support.
> >>
> >> I haven't loaded and tested that code yet. But the net45 test program is
> >> just a set of tests, not NUnit. It is of course built for .NET 4.5.
> Simone
> >> is working on making sure it will run under NUnit so it may not yet be
> >> complete. Note that some code in nunit.core.tests is under the control
> >> of #if statements, which keep it from being compiled when not wanted.
> >>...

Charlie Poole (charlie.poole) wrote :
Download full text (23.4 KiB)

Hi Simone,

On Tue, Oct 2, 2012 at 1:59 PM, Simone Busoli
<email address hidden> wrote:
> inline

Ditto

> On Tue, Oct 2, 2012 at 10:29 PM, Charlie Poole <email address hidden>
> wrote:
>
>> On Tue, Oct 2, 2012 at 1:03 PM, Simone Busoli
>> <email address hidden> wrote:
>> > To summarize, the async feature works under NUnit built for CLR 2, of
>> > course it will use an agent to run tests built for CLR > 2.
>> >
>> > There is a sort of infrastructure problem that I posed already which
>> > concerns how to build and test the async thing. Currently I didn't make
>> any
>> > explicit choice and the build fails if you try to build for CLR < 4,
>> > because it tries to build the .NET 4.5 test assembly.
>> > So far therefore you can successfully run a build with net-4.0, which
>> will
>> > run the new tests as well. Of course I also ran them under NUnit built
>> for
>> > CLR 2 but it's a manual process: exclude the tests from the build, build
>> > for CLR 2, invoke nunit-console.exe (CLR 2) on the 4.5 assembly
>> previously
>> > built.
>>
>> Yes, that's the infrastructure change I was hoping to avoid by postponing
>> to
>> NUnit 3.0. :-) But never mind... you convinced me.
>>
>
> So you'll take care of that, right? :) Or just share how you would do it
> and I'll do the rest.

I'll take a look after I get VS2012 re-installed. I had to remove the RC because
it messed up C++ compilation under VS2010 - also had to reapply VS2010 SP1.

My thought is to have a build for .NET 4.5 in the script and to modify the
commands to allow you to run tests across different .NET versions.
>
>>
>> > Ideally we would have to come up with a way to say that even when we
>> build
>> > for < 4.5 (there's no 4.5 now but only 4.0 as NAnt doesn't support it
>> yet),
>> > that assembly is still built for 4.5 so that tests can be run on it with
>> > NUnit built for .NET < 4.5. I hope it makes sense. I would like to
>> clarify
>> > this with Charlie.
>>
>> What we need is a .NET 4.5 config. This guy has one...
>>
>> http://stackoverflow.com/questions/11837795/building-net-4-5-projects-with-nant
>
>
> Ah cool, I'll start by adding 4.5 to the whole build script system then.
>

I'm in the process of adding it to the NUnitLite script myself.

>>
>>
>> > Also one question for Charlie: in order to see if tests are run
>> correctly I
>> > created some fixtures which are not supposed to be run directly but via
>> my
>> > own test code. In order to accomplish that I marked the suite as ignored,
>> > but those tests then end up in the build results as ignored, which is not
>> > really the case 'cause I'm running them by some other means. I wanted to
>> > figure out if there was a way to make NUnit /ignore/ those tests so that
>> > they don't show up as ignored.
>>
>> Put those tests in the test-assembly dll. That's what it's for. To see how
>> it's used by other tests, just pick any class there and find references.
>>
>
> I see, it makes sense. According to how you would like to do the
> "infrastructure change" I guess they may need to stay in a 4.5 isolated
> assembly though.

Or you could use the regular NUnit tests but conditionally include some
extra tests with async.

Charlie...

Jv (jv-ravichandran) wrote :
  • test45.txt Edit (740 bytes, text/plain; charset=US-ASCII; name="test45.txt")
Download full text (26.4 KiB)

Hi Charlie,

Attached is a test for checking the thread id of the task running. If you
can confirm if the test scenario is correctly running as expected, I will
go ahead with the other scenarios.

But for this to happen, NUnit must be able to run this test. Please let me
know the tweak to nunit-agent or any other to make NUnit GUI to run a 4.5
targeted test. Thanks.

Jv

On Wed, Oct 3, 2012 at 10:59 AM, Charlie Poole <email address hidden> wrote:

> Hi Simone,
>
> On Tue, Oct 2, 2012 at 1:59 PM, Simone Busoli
> <email address hidden> wrote:
> > inline
>
> Ditto
>
> > On Tue, Oct 2, 2012 at 10:29 PM, Charlie Poole <email address hidden>
> > wrote:
> >
> >> On Tue, Oct 2, 2012 at 1:03 PM, Simone Busoli
> >> <email address hidden> wrote:
> >> > To summarize, the async feature works under NUnit built for CLR 2, of
> >> > course it will use an agent to run tests built for CLR > 2.
> >> >
> >> > There is a sort of infrastructure problem that I posed already which
> >> > concerns how to build and test the async thing. Currently I didn't
> make
> >> any
> >> > explicit choice and the build fails if you try to build for CLR < 4,
> >> > because it tries to build the .NET 4.5 test assembly.
> >> > So far therefore you can successfully run a build with net-4.0, which
> >> will
> >> > run the new tests as well. Of course I also ran them under NUnit built
> >> for
> >> > CLR 2 but it's a manual process: exclude the tests from the build,
> build
> >> > for CLR 2, invoke nunit-console.exe (CLR 2) on the 4.5 assembly
> >> previously
> >> > built.
> >>
> >> Yes, that's the infrastructure change I was hoping to avoid by
> postponing
> >> to
> >> NUnit 3.0. :-) But never mind... you convinced me.
> >>
> >
> > So you'll take care of that, right? :) Or just share how you would do it
> > and I'll do the rest.
>
> I'll take a look after I get VS2012 re-installed. I had to remove the RC
> because
> it messed up C++ compilation under VS2010 - also had to reapply VS2010 SP1.
>
> My thought is to have a build for .NET 4.5 in the script and to modify the
> commands to allow you to run tests across different .NET versions.
> >
> >>
> >> > Ideally we would have to come up with a way to say that even when we
> >> build
> >> > for < 4.5 (there's no 4.5 now but only 4.0 as NAnt doesn't support it
> >> yet),
> >> > that assembly is still built for 4.5 so that tests can be run on it
> with
> >> > NUnit built for .NET < 4.5. I hope it makes sense. I would like to
> >> clarify
> >> > this with Charlie.
> >>
> >> What we need is a .NET 4.5 config. This guy has one...
> >>
> >>
> http://stackoverflow.com/questions/11837795/building-net-4-5-projects-with-nant
> >
> >
> > Ah cool, I'll start by adding 4.5 to the whole build script system then.
> >
>
> I'm in the process of adding it to the NUnitLite script myself.
>
> >>
> >>
> >> > Also one question for Charlie: in order to see if tests are run
> >> correctly I
> >> > created some fixtures which are not supposed to be run directly but
> via
> >> my
> >> > own test code. In order to accomplish that I marked the suite as
> ignored,
> >> > but those tests then end up in the build results as ignored, which is
> not
> >> > really t...

Jv (jv-ravichandran) wrote :
Download full text (27.6 KiB)

Fyip,

I am using the same RealFixtures file in Simone's project with the same
references but with different test code so the name of the test method is
same but it does not test a void return value.

Jv

On Wed, Oct 3, 2012 at 2:28 PM, RJV <email address hidden> wrote:

> Hi Charlie,
>
> Attached is a test for checking the thread id of the task running. If you
> can confirm if the test scenario is correctly running as expected, I will
> go ahead with the other scenarios.
>
> But for this to happen, NUnit must be able to run this test. Please let me
> know the tweak to nunit-agent or any other to make NUnit GUI to run a 4.5
> targeted test. Thanks.
>
> Jv
>
>
> On Wed, Oct 3, 2012 at 10:59 AM, Charlie Poole <email address hidden> wrote:
>
>> Hi Simone,
>>
>> On Tue, Oct 2, 2012 at 1:59 PM, Simone Busoli
>> <email address hidden> wrote:
>> > inline
>>
>> Ditto
>>
>> > On Tue, Oct 2, 2012 at 10:29 PM, Charlie Poole <email address hidden>
>> > wrote:
>> >
>> >> On Tue, Oct 2, 2012 at 1:03 PM, Simone Busoli
>> >> <email address hidden> wrote:
>> >> > To summarize, the async feature works under NUnit built for CLR 2, of
>> >> > course it will use an agent to run tests built for CLR > 2.
>> >> >
>> >> > There is a sort of infrastructure problem that I posed already which
>> >> > concerns how to build and test the async thing. Currently I didn't
>> make
>> >> any
>> >> > explicit choice and the build fails if you try to build for CLR < 4,
>> >> > because it tries to build the .NET 4.5 test assembly.
>> >> > So far therefore you can successfully run a build with net-4.0, which
>> >> will
>> >> > run the new tests as well. Of course I also ran them under NUnit
>> built
>> >> for
>> >> > CLR 2 but it's a manual process: exclude the tests from the build,
>> build
>> >> > for CLR 2, invoke nunit-console.exe (CLR 2) on the 4.5 assembly
>> >> previously
>> >> > built.
>> >>
>> >> Yes, that's the infrastructure change I was hoping to avoid by
>> postponing
>> >> to
>> >> NUnit 3.0. :-) But never mind... you convinced me.
>> >>
>> >
>> > So you'll take care of that, right? :) Or just share how you would do it
>> > and I'll do the rest.
>>
>> I'll take a look after I get VS2012 re-installed. I had to remove the RC
>> because
>> it messed up C++ compilation under VS2010 - also had to reapply VS2010
>> SP1.
>>
>> My thought is to have a build for .NET 4.5 in the script and to modify the
>> commands to allow you to run tests across different .NET versions.
>> >
>> >>
>> >> > Ideally we would have to come up with a way to say that even when we
>> >> build
>> >> > for < 4.5 (there's no 4.5 now but only 4.0 as NAnt doesn't support it
>> >> yet),
>> >> > that assembly is still built for 4.5 so that tests can be run on it
>> with
>> >> > NUnit built for .NET < 4.5. I hope it makes sense. I would like to
>> >> clarify
>> >> > this with Charlie.
>> >>
>> >> What we need is a .NET 4.5 config. This guy has one...
>> >>
>> >>
>> http://stackoverflow.com/questions/11837795/building-net-4-5-projects-with-nant
>> >
>> >
>> > Ah cool, I'll start by adding 4.5 to the whole build script system then.
>> >
>>
>> I'm in the process of adding it to the NUnitLite script m...

Download full text (31.2 KiB)

Jv, here's a list of issues in the code you provided:

   - it does not compile
   - even if you make it compile by assigning "await t" to a local
   variable, you are asserting that a Task<int?> is equal to a int?
   - even if you await on ob.TaskMethod() so that you get back an int? it
   still doesn't make much sense to compare those two values, and you should
   actually expect them to be different
   - the test will nonetheless pass because the two integers? will be
   always null as you are invoking Task.FromResult, which completes
   synchronously and therefore will have null Task.CurrentId

Simone

On Wed, Oct 3, 2012 at 11:07 AM, Jv <email address hidden> wrote:

> Fyip,
>
> I am using the same RealFixtures file in Simone's project with the same
> references but with different test code so the name of the test method is
> same but it does not test a void return value.
>
> Jv
>
> On Wed, Oct 3, 2012 at 2:28 PM, RJV <email address hidden> wrote:
>
> > Hi Charlie,
> >
> > Attached is a test for checking the thread id of the task running. If you
> > can confirm if the test scenario is correctly running as expected, I will
> > go ahead with the other scenarios.
> >
> > But for this to happen, NUnit must be able to run this test. Please let
> me
> > know the tweak to nunit-agent or any other to make NUnit GUI to run a 4.5
> > targeted test. Thanks.
> >
> > Jv
> >
> >
> > On Wed, Oct 3, 2012 at 10:59 AM, Charlie Poole <email address hidden>
> wrote:
> >
> >> Hi Simone,
> >>
> >> On Tue, Oct 2, 2012 at 1:59 PM, Simone Busoli
> >> <email address hidden> wrote:
> >> > inline
> >>
> >> Ditto
> >>
> >> > On Tue, Oct 2, 2012 at 10:29 PM, Charlie Poole <email address hidden>
> >> > wrote:
> >> >
> >> >> On Tue, Oct 2, 2012 at 1:03 PM, Simone Busoli
> >> >> <email address hidden> wrote:
> >> >> > To summarize, the async feature works under NUnit built for CLR 2,
> of
> >> >> > course it will use an agent to run tests built for CLR > 2.
> >> >> >
> >> >> > There is a sort of infrastructure problem that I posed already
> which
> >> >> > concerns how to build and test the async thing. Currently I didn't
> >> make
> >> >> any
> >> >> > explicit choice and the build fails if you try to build for CLR <
> 4,
> >> >> > because it tries to build the .NET 4.5 test assembly.
> >> >> > So far therefore you can successfully run a build with net-4.0,
> which
> >> >> will
> >> >> > run the new tests as well. Of course I also ran them under NUnit
> >> built
> >> >> for
> >> >> > CLR 2 but it's a manual process: exclude the tests from the build,
> >> build
> >> >> > for CLR 2, invoke nunit-console.exe (CLR 2) on the 4.5 assembly
> >> >> previously
> >> >> > built.
> >> >>
> >> >> Yes, that's the infrastructure change I was hoping to avoid by
> >> postponing
> >> >> to
> >> >> NUnit 3.0. :-) But never mind... you convinced me.
> >> >>
> >> >
> >> > So you'll take care of that, right? :) Or just share how you would do
> it
> >> > and I'll do the rest.
> >>
> >> I'll take a look after I get VS2012 re-installed. I had to remove the RC
> >> because
> >> it messed up C++ compilation under VS2010 - also had to reapply VS2010
> >> SP1.
> >>
> >> My thought ...

Jv (jv-ravichandran) wrote :
Download full text (34.5 KiB)

Yes, it compiles alright. That is not my concern.

I want to test it on NUnit and I want to do the tweaks locally to my NUnit
source by running NUnit on target 2.0 but use the .net 4.5 assembly.

Jv

On Wed, Oct 3, 2012 at 3:36 PM, Simone Busoli <email address hidden>wrote:

> Jv, here's a list of issues in the code you provided:
>
> - it does not compile
> - even if you make it compile by assigning "await t" to a local
> variable, you are asserting that a Task<int?> is equal to a int?
> - even if you await on ob.TaskMethod() so that you get back an int? it
> still doesn't make much sense to compare those two values, and you
> should
> actually expect them to be different
> - the test will nonetheless pass because the two integers? will be
> always null as you are invoking Task.FromResult, which completes
> synchronously and therefore will have null Task.CurrentId
>
> Simone
>
> On Wed, Oct 3, 2012 at 11:07 AM, Jv <email address hidden> wrote:
>
> > Fyip,
> >
> > I am using the same RealFixtures file in Simone's project with the same
> > references but with different test code so the name of the test method is
> > same but it does not test a void return value.
> >
> > Jv
> >
> > On Wed, Oct 3, 2012 at 2:28 PM, RJV <email address hidden> wrote:
> >
> > > Hi Charlie,
> > >
> > > Attached is a test for checking the thread id of the task running. If
> you
> > > can confirm if the test scenario is correctly running as expected, I
> will
> > > go ahead with the other scenarios.
> > >
> > > But for this to happen, NUnit must be able to run this test. Please let
> > me
> > > know the tweak to nunit-agent or any other to make NUnit GUI to run a
> 4.5
> > > targeted test. Thanks.
> > >
> > > Jv
> > >
> > >
> > > On Wed, Oct 3, 2012 at 10:59 AM, Charlie Poole <email address hidden>
> > wrote:
> > >
> > >> Hi Simone,
> > >>
> > >> On Tue, Oct 2, 2012 at 1:59 PM, Simone Busoli
> > >> <email address hidden> wrote:
> > >> > inline
> > >>
> > >> Ditto
> > >>
> > >> > On Tue, Oct 2, 2012 at 10:29 PM, Charlie Poole <email address hidden>
> > >> > wrote:
> > >> >
> > >> >> On Tue, Oct 2, 2012 at 1:03 PM, Simone Busoli
> > >> >> <email address hidden> wrote:
> > >> >> > To summarize, the async feature works under NUnit built for CLR
> 2,
> > of
> > >> >> > course it will use an agent to run tests built for CLR > 2.
> > >> >> >
> > >> >> > There is a sort of infrastructure problem that I posed already
> > which
> > >> >> > concerns how to build and test the async thing. Currently I
> didn't
> > >> make
> > >> >> any
> > >> >> > explicit choice and the build fails if you try to build for CLR <
> > 4,
> > >> >> > because it tries to build the .NET 4.5 test assembly.
> > >> >> > So far therefore you can successfully run a build with net-4.0,
> > which
> > >> >> will
> > >> >> > run the new tests as well. Of course I also ran them under NUnit
> > >> built
> > >> >> for
> > >> >> > CLR 2 but it's a manual process: exclude the tests from the
> build,
> > >> build
> > >> >> > for CLR 2, invoke nunit-console.exe (CLR 2) on the 4.5 assembly
> > >> >> previously
> > >> >> > built.
> > >> >>
> > >> >> Yes, that's the infrastr...

Jv (jv-ravichandran) wrote :
Download full text (34.5 KiB)

The actual unit test functionality that I am looking at can be similar to
the output of the main method in this progam -
http://ravichandranjv.blogspot.in/2012/10/async-and-await-c-5.html

Jv

On Wed, Oct 3, 2012 at 3:36 PM, Simone Busoli <email address hidden>wrote:

> Jv, here's a list of issues in the code you provided:
>
> - it does not compile
> - even if you make it compile by assigning "await t" to a local
> variable, you are asserting that a Task<int?> is equal to a int?
> - even if you await on ob.TaskMethod() so that you get back an int? it
> still doesn't make much sense to compare those two values, and you
> should
> actually expect them to be different
> - the test will nonetheless pass because the two integers? will be
> always null as you are invoking Task.FromResult, which completes
> synchronously and therefore will have null Task.CurrentId
>
> Simone
>
> On Wed, Oct 3, 2012 at 11:07 AM, Jv <email address hidden> wrote:
>
> > Fyip,
> >
> > I am using the same RealFixtures file in Simone's project with the same
> > references but with different test code so the name of the test method is
> > same but it does not test a void return value.
> >
> > Jv
> >
> > On Wed, Oct 3, 2012 at 2:28 PM, RJV <email address hidden> wrote:
> >
> > > Hi Charlie,
> > >
> > > Attached is a test for checking the thread id of the task running. If
> you
> > > can confirm if the test scenario is correctly running as expected, I
> will
> > > go ahead with the other scenarios.
> > >
> > > But for this to happen, NUnit must be able to run this test. Please let
> > me
> > > know the tweak to nunit-agent or any other to make NUnit GUI to run a
> 4.5
> > > targeted test. Thanks.
> > >
> > > Jv
> > >
> > >
> > > On Wed, Oct 3, 2012 at 10:59 AM, Charlie Poole <email address hidden>
> > wrote:
> > >
> > >> Hi Simone,
> > >>
> > >> On Tue, Oct 2, 2012 at 1:59 PM, Simone Busoli
> > >> <email address hidden> wrote:
> > >> > inline
> > >>
> > >> Ditto
> > >>
> > >> > On Tue, Oct 2, 2012 at 10:29 PM, Charlie Poole <email address hidden>
> > >> > wrote:
> > >> >
> > >> >> On Tue, Oct 2, 2012 at 1:03 PM, Simone Busoli
> > >> >> <email address hidden> wrote:
> > >> >> > To summarize, the async feature works under NUnit built for CLR
> 2,
> > of
> > >> >> > course it will use an agent to run tests built for CLR > 2.
> > >> >> >
> > >> >> > There is a sort of infrastructure problem that I posed already
> > which
> > >> >> > concerns how to build and test the async thing. Currently I
> didn't
> > >> make
> > >> >> any
> > >> >> > explicit choice and the build fails if you try to build for CLR <
> > 4,
> > >> >> > because it tries to build the .NET 4.5 test assembly.
> > >> >> > So far therefore you can successfully run a build with net-4.0,
> > which
> > >> >> will
> > >> >> > run the new tests as well. Of course I also ran them under NUnit
> > >> built
> > >> >> for
> > >> >> > CLR 2 but it's a manual process: exclude the tests from the
> build,
> > >> build
> > >> >> > for CLR 2, invoke nunit-console.exe (CLR 2) on the 4.5 assembly
> > >> >> previously
> > >> >> > built.
> > >> >>
> > >> >> Yes, that's the infrastructure ...

Charlie Poole (charlie.poole) wrote :
Download full text (36.3 KiB)

Jv,

It seems like this bug is getting crowded with general discussion of async.

Let's only post to the bug when we're talking about the bug from now on.
The test is "will this be helpful to folks checking the bug?"

For more general discussions, you can use the developer list or direct
email.

Charlie

On Wed, Oct 3, 2012 at 3:55 PM, Jv <email address hidden> wrote:
> The actual unit test functionality that I am looking at can be similar to
> the output of the main method in this progam -
> http://ravichandranjv.blogspot.in/2012/10/async-and-await-c-5.html
>
> Jv
>
> On Wed, Oct 3, 2012 at 3:36 PM, Simone Busoli
> <email address hidden>wrote:
>
>> Jv, here's a list of issues in the code you provided:
>>
>> - it does not compile
>> - even if you make it compile by assigning "await t" to a local
>> variable, you are asserting that a Task<int?> is equal to a int?
>> - even if you await on ob.TaskMethod() so that you get back an int? it
>> still doesn't make much sense to compare those two values, and you
>> should
>> actually expect them to be different
>> - the test will nonetheless pass because the two integers? will be
>> always null as you are invoking Task.FromResult, which completes
>> synchronously and therefore will have null Task.CurrentId
>>
>> Simone
>>
>> On Wed, Oct 3, 2012 at 11:07 AM, Jv <email address hidden> wrote:
>>
>> > Fyip,
>> >
>> > I am using the same RealFixtures file in Simone's project with the same
>> > references but with different test code so the name of the test method is
>> > same but it does not test a void return value.
>> >
>> > Jv
>> >
>> > On Wed, Oct 3, 2012 at 2:28 PM, RJV <email address hidden> wrote:
>> >
>> > > Hi Charlie,
>> > >
>> > > Attached is a test for checking the thread id of the task running. If
>> you
>> > > can confirm if the test scenario is correctly running as expected, I
>> will
>> > > go ahead with the other scenarios.
>> > >
>> > > But for this to happen, NUnit must be able to run this test. Please let
>> > me
>> > > know the tweak to nunit-agent or any other to make NUnit GUI to run a
>> 4.5
>> > > targeted test. Thanks.
>> > >
>> > > Jv
>> > >
>> > >
>> > > On Wed, Oct 3, 2012 at 10:59 AM, Charlie Poole <email address hidden>
>> > wrote:
>> > >
>> > >> Hi Simone,
>> > >>
>> > >> On Tue, Oct 2, 2012 at 1:59 PM, Simone Busoli
>> > >> <email address hidden> wrote:
>> > >> > inline
>> > >>
>> > >> Ditto
>> > >>
>> > >> > On Tue, Oct 2, 2012 at 10:29 PM, Charlie Poole <email address hidden>
>> > >> > wrote:
>> > >> >
>> > >> >> On Tue, Oct 2, 2012 at 1:03 PM, Simone Busoli
>> > >> >> <email address hidden> wrote:
>> > >> >> > To summarize, the async feature works under NUnit built for CLR
>> 2,
>> > of
>> > >> >> > course it will use an agent to run tests built for CLR > 2.
>> > >> >> >
>> > >> >> > There is a sort of infrastructure problem that I posed already
>> > which
>> > >> >> > concerns how to build and test the async thing. Currently I
>> didn't
>> > >> make
>> > >> >> any
>> > >> >> > explicit choice and the build fails if you try to build for CLR <
>> > 4,
>> > >> >> > because it tries to build the .NET 4.5 test assembly.
>...

Download full text (27.6 KiB)

Hi Charlie, I've committed some changes regarding the build scripts mainly.
Here's what I've done:

   - added "net-4.5" support to NAnt as described in the SO question you
   linked
   - created a .net 4.5 assembly containing tests for async. Created a .net
   4.5 assembly containing fixtures which are run programmatically by the
   former. The build file of these two assemblies forces the
   "nant.settings.currentframework" property to "net-4.5" as they can only
   be built if 4.5 is installed (regardless of the target framework of the
   build itself)
   - modified the build scripts to support net-4.5 as a target framework
   (this includes setting some properties and defining the precompiler
   conditionals CLR_4_0, NET_4_5, CS_5_0
   - modified the code with precompiler conditionals to include NET_4_5
   where meaningful
   - modified the build scripts so that even if you target other versions
   of the .NET fx BUT .NET 4.5 is installed, then:
      - the two assemblies above are built
      - the tests contained therein are run

This required adding a new NUnit test project containing the 4.5 test
assembly in addition to all the others, without any "runtimeFramework"
attribute specified so that the console will be able to spawn an agent when
it's not itself built for 4.5 but the test assemblies are there.

I hope this makes sense. I admit that I'm not super-happy with the solution
because it involves a lot of conditionals, mainly in the build scripts, all
over the place, but I'm not sure we can do much better with what we have
right now in V2.
The changes are not many though, so it should not take you long to figure
out what I did exactly.

Simone

On Wed, Oct 3, 2012 at 7:29 AM, Charlie Poole <email address hidden> wrote:

> Hi Simone,
>
> On Tue, Oct 2, 2012 at 1:59 PM, Simone Busoli
> <email address hidden> wrote:
> > inline
>
> Ditto
>
> > On Tue, Oct 2, 2012 at 10:29 PM, Charlie Poole <email address hidden>
> > wrote:
> >
> >> On Tue, Oct 2, 2012 at 1:03 PM, Simone Busoli
> >> <email address hidden> wrote:
> >> > To summarize, the async feature works under NUnit built for CLR 2, of
> >> > course it will use an agent to run tests built for CLR > 2.
> >> >
> >> > There is a sort of infrastructure problem that I posed already which
> >> > concerns how to build and test the async thing. Currently I didn't
> make
> >> any
> >> > explicit choice and the build fails if you try to build for CLR < 4,
> >> > because it tries to build the .NET 4.5 test assembly.
> >> > So far therefore you can successfully run a build with net-4.0, which
> >> will
> >> > run the new tests as well. Of course I also ran them under NUnit built
> >> for
> >> > CLR 2 but it's a manual process: exclude the tests from the build,
> build
> >> > for CLR 2, invoke nunit-console.exe (CLR 2) on the 4.5 assembly
> >> previously
> >> > built.
> >>
> >> Yes, that's the infrastructure change I was hoping to avoid by
> postponing
> >> to
> >> NUnit 3.0. :-) But never mind... you convinced me.
> >>
> >
> > So you'll take care of that, right? :) Or just share how you would do it
> > and I'll do the rest.
>
> I'll take a look after I get VS2012 re-installed. I had to remov...

Download full text (40.1 KiB)

Hi Charlie,

Yes, sure.

An observation related to tests from the user perspective only. The "async"
or "Task" or "await", in a test scenario, seems like it will overcook the
way a test method will be written unless the Assert.That makes use of an
expression that will allow an async test to await the expression result.

Jv

On Thu, Oct 4, 2012 at 4:49 AM, Charlie Poole <email address hidden> wrote:

> Jv,
>
> It seems like this bug is getting crowded with general discussion of
> async.
>
> Let's only post to the bug when we're talking about the bug from now on.
> The test is "will this be helpful to folks checking the bug?"
>
> For more general discussions, you can use the developer list or direct
> email.
>
> Charlie
>
> On Wed, Oct 3, 2012 at 3:55 PM, Jv <email address hidden> wrote:
> > The actual unit test functionality that I am looking at can be similar to
> > the output of the main method in this progam -
> > http://ravichandranjv.blogspot.in/2012/10/async-and-await-c-5.html
> >
> > Jv
> >
> > On Wed, Oct 3, 2012 at 3:36 PM, Simone Busoli
> > <email address hidden>wrote:
> >
> >> Jv, here's a list of issues in the code you provided:
> >>
> >> - it does not compile
> >> - even if you make it compile by assigning "await t" to a local
> >> variable, you are asserting that a Task<int?> is equal to a int?
> >> - even if you await on ob.TaskMethod() so that you get back an int?
> it
> >> still doesn't make much sense to compare those two values, and you
> >> should
> >> actually expect them to be different
> >> - the test will nonetheless pass because the two integers? will be
> >> always null as you are invoking Task.FromResult, which completes
> >> synchronously and therefore will have null Task.CurrentId
> >>
> >> Simone
> >>
> >> On Wed, Oct 3, 2012 at 11:07 AM, Jv <email address hidden> wrote:
> >>
> >> > Fyip,
> >> >
> >> > I am using the same RealFixtures file in Simone's project with the
> same
> >> > references but with different test code so the name of the test
> method is
> >> > same but it does not test a void return value.
> >> >
> >> > Jv
> >> >
> >> > On Wed, Oct 3, 2012 at 2:28 PM, RJV <email address hidden>
> wrote:
> >> >
> >> > > Hi Charlie,
> >> > >
> >> > > Attached is a test for checking the thread id of the task running.
> If
> >> you
> >> > > can confirm if the test scenario is correctly running as expected, I
> >> will
> >> > > go ahead with the other scenarios.
> >> > >
> >> > > But for this to happen, NUnit must be able to run this test. Please
> let
> >> > me
> >> > > know the tweak to nunit-agent or any other to make NUnit GUI to run
> a
> >> 4.5
> >> > > targeted test. Thanks.
> >> > >
> >> > > Jv
> >> > >
> >> > >
> >> > > On Wed, Oct 3, 2012 at 10:59 AM, Charlie Poole <email address hidden>
> >> > wrote:
> >> > >
> >> > >> Hi Simone,
> >> > >>
> >> > >> On Tue, Oct 2, 2012 at 1:59 PM, Simone Busoli
> >> > >> <email address hidden> wrote:
> >> > >> > inline
> >> > >>
> >> > >> Ditto
> >> > >>
> >> > >> > On Tue, Oct 2, 2012 at 10:29 PM, Charlie Poole <
> <email address hidden>>
> >> > >> > wrote:
> >> > >> >
> >> > >> >> On Tue, Oct 2, 2012 at 1:03 PM, Simone Busoli
>...

Download full text (29.2 KiB)

Hi Simone,

Just reading your note, this all sounds like the right thing. I'll get to
the point of actually running your changes in a few days, after some
meetings I'm preparing for.

In fact, I just added a .NET 4.5 build to NUnitLite using pretty much
the same steps, with the exception that NUnitLite tests run themselves,
so there is no issue with needing to run .NET 4.5 using a runner
compiled with .NET 2.0.

Charlie

On Wed, Oct 3, 2012 at 4:27 PM, Simone Busoli
<email address hidden> wrote:
> Hi Charlie, I've committed some changes regarding the build scripts mainly.
> Here's what I've done:
>
> - added "net-4.5" support to NAnt as described in the SO question you
> linked
> - created a .net 4.5 assembly containing tests for async. Created a .net
> 4.5 assembly containing fixtures which are run programmatically by the
> former. The build file of these two assemblies forces the
> "nant.settings.currentframework" property to "net-4.5" as they can only
> be built if 4.5 is installed (regardless of the target framework of the
> build itself)
> - modified the build scripts to support net-4.5 as a target framework
> (this includes setting some properties and defining the precompiler
> conditionals CLR_4_0, NET_4_5, CS_5_0
> - modified the code with precompiler conditionals to include NET_4_5
> where meaningful
> - modified the build scripts so that even if you target other versions
> of the .NET fx BUT .NET 4.5 is installed, then:
> - the two assemblies above are built
> - the tests contained therein are run
>
> This required adding a new NUnit test project containing the 4.5 test
> assembly in addition to all the others, without any "runtimeFramework"
> attribute specified so that the console will be able to spawn an agent when
> it's not itself built for 4.5 but the test assemblies are there.
>
> I hope this makes sense. I admit that I'm not super-happy with the solution
> because it involves a lot of conditionals, mainly in the build scripts, all
> over the place, but I'm not sure we can do much better with what we have
> right now in V2.
> The changes are not many though, so it should not take you long to figure
> out what I did exactly.
>
> Simone
>
> On Wed, Oct 3, 2012 at 7:29 AM, Charlie Poole <email address hidden> wrote:
>
>> Hi Simone,
>>
>> On Tue, Oct 2, 2012 at 1:59 PM, Simone Busoli
>> <email address hidden> wrote:
>> > inline
>>
>> Ditto
>>
>> > On Tue, Oct 2, 2012 at 10:29 PM, Charlie Poole <email address hidden>
>> > wrote:
>> >
>> >> On Tue, Oct 2, 2012 at 1:03 PM, Simone Busoli
>> >> <email address hidden> wrote:
>> >> > To summarize, the async feature works under NUnit built for CLR 2, of
>> >> > course it will use an agent to run tests built for CLR > 2.
>> >> >
>> >> > There is a sort of infrastructure problem that I posed already which
>> >> > concerns how to build and test the async thing. Currently I didn't
>> make
>> >> any
>> >> > explicit choice and the build fails if you try to build for CLR < 4,
>> >> > because it tries to build the .NET 4.5 test assembly.
>> >> > So far therefore you can successfully run a build with net-4.0, which
>> >> will...

Download full text (42.1 KiB)

That idea introduces asynchronous processing, which would be a new feature.
All we want to do here is make tests marked async run without causing
problems. That's what this bug is about. We'll do that by waiting for the
test to finish, so that only one test runs at a time, even if marked async.

For more than that, see NUnitLite or wait for NUnit 3.0!

Charlie

On Wed, Oct 3, 2012 at 4:35 PM, Jv <email address hidden> wrote:
> Hi Charlie,
>
> Yes, sure.
>
> An observation related to tests from the user perspective only. The "async"
> or "Task" or "await", in a test scenario, seems like it will overcook the
> way a test method will be written unless the Assert.That makes use of an
> expression that will allow an async test to await the expression result.
>
> Jv
>
> On Thu, Oct 4, 2012 at 4:49 AM, Charlie Poole <email address hidden> wrote:
>
>> Jv,
>>
>> It seems like this bug is getting crowded with general discussion of
>> async.
>>
>> Let's only post to the bug when we're talking about the bug from now on.
>> The test is "will this be helpful to folks checking the bug?"
>>
>> For more general discussions, you can use the developer list or direct
>> email.
>>
>> Charlie
>>
>> On Wed, Oct 3, 2012 at 3:55 PM, Jv <email address hidden> wrote:
>> > The actual unit test functionality that I am looking at can be similar to
>> > the output of the main method in this progam -
>> > http://ravichandranjv.blogspot.in/2012/10/async-and-await-c-5.html
>> >
>> > Jv
>> >
>> > On Wed, Oct 3, 2012 at 3:36 PM, Simone Busoli
>> > <email address hidden>wrote:
>> >
>> >> Jv, here's a list of issues in the code you provided:
>> >>
>> >> - it does not compile
>> >> - even if you make it compile by assigning "await t" to a local
>> >> variable, you are asserting that a Task<int?> is equal to a int?
>> >> - even if you await on ob.TaskMethod() so that you get back an int?
>> it
>> >> still doesn't make much sense to compare those two values, and you
>> >> should
>> >> actually expect them to be different
>> >> - the test will nonetheless pass because the two integers? will be
>> >> always null as you are invoking Task.FromResult, which completes
>> >> synchronously and therefore will have null Task.CurrentId
>> >>
>> >> Simone
>> >>
>> >> On Wed, Oct 3, 2012 at 11:07 AM, Jv <email address hidden> wrote:
>> >>
>> >> > Fyip,
>> >> >
>> >> > I am using the same RealFixtures file in Simone's project with the
>> same
>> >> > references but with different test code so the name of the test
>> method is
>> >> > same but it does not test a void return value.
>> >> >
>> >> > Jv
>> >> >
>> >> > On Wed, Oct 3, 2012 at 2:28 PM, RJV <email address hidden>
>> wrote:
>> >> >
>> >> > > Hi Charlie,
>> >> > >
>> >> > > Attached is a test for checking the thread id of the task running.
>> If
>> >> you
>> >> > > can confirm if the test scenario is correctly running as expected, I
>> >> will
>> >> > > go ahead with the other scenarios.
>> >> > >
>> >> > > But for this to happen, NUnit must be able to run this test. Please
>> let
>> >> > me
>> >> > > know the tweak to nunit-agent or any other to make NUnit GUI to run
>> a
>> >> 4.5
>> >> >...

Download full text (32.2 KiB)

On Thu, Oct 4, 2012 at 1:42 AM, Charlie Poole <email address hidden> wrote:

> Hi Simone,
>
> Just reading your note, this all sounds like the right thing. I'll get to
> the point of actually running your changes in a few days, after some
> meetings I'm preparing for.
>

Sure, no prob.

>
> In fact, I just added a .NET 4.5 build to NUnitLite using pretty much
> the same steps, with the exception that NUnitLite tests run themselves,
> so there is no issue with needing to run .NET 4.5 using a runner
> compiled with .NET 2.0.
>

Sounds way easier :)

>
> Charlie
>
>
> On Wed, Oct 3, 2012 at 4:27 PM, Simone Busoli
> <email address hidden> wrote:
> > Hi Charlie, I've committed some changes regarding the build scripts
> mainly.
> > Here's what I've done:
> >
> > - added "net-4.5" support to NAnt as described in the SO question you
> > linked
> > - created a .net 4.5 assembly containing tests for async. Created a
> .net
> > 4.5 assembly containing fixtures which are run programmatically by the
> > former. The build file of these two assemblies forces the
> > "nant.settings.currentframework" property to "net-4.5" as they can
> only
> > be built if 4.5 is installed (regardless of the target framework of
> the
> > build itself)
> > - modified the build scripts to support net-4.5 as a target framework
> > (this includes setting some properties and defining the precompiler
> > conditionals CLR_4_0, NET_4_5, CS_5_0
> > - modified the code with precompiler conditionals to include NET_4_5
> > where meaningful
> > - modified the build scripts so that even if you target other versions
> > of the .NET fx BUT .NET 4.5 is installed, then:
> > - the two assemblies above are built
> > - the tests contained therein are run
> >
> > This required adding a new NUnit test project containing the 4.5 test
> > assembly in addition to all the others, without any "runtimeFramework"
> > attribute specified so that the console will be able to spawn an agent
> when
> > it's not itself built for 4.5 but the test assemblies are there.
> >
> > I hope this makes sense. I admit that I'm not super-happy with the
> solution
> > because it involves a lot of conditionals, mainly in the build scripts,
> all
> > over the place, but I'm not sure we can do much better with what we have
> > right now in V2.
> > The changes are not many though, so it should not take you long to figure
> > out what I did exactly.
> >
> > Simone
> >
> > On Wed, Oct 3, 2012 at 7:29 AM, Charlie Poole <email address hidden> wrote:
> >
> >> Hi Simone,
> >>
> >> On Tue, Oct 2, 2012 at 1:59 PM, Simone Busoli
> >> <email address hidden> wrote:
> >> > inline
> >>
> >> Ditto
> >>
> >> > On Tue, Oct 2, 2012 at 10:29 PM, Charlie Poole <email address hidden>
> >> > wrote:
> >> >
> >> >> On Tue, Oct 2, 2012 at 1:03 PM, Simone Busoli
> >> >> <email address hidden> wrote:
> >> >> > To summarize, the async feature works under NUnit built for CLR 2,
> of
> >> >> > course it will use an agent to run tests built for CLR > 2.
> >> >> >
> >> >> > There is a sort of infrastructure problem that I posed already
> which
> >> >> > concerns how to build and test the as...

Download full text (46.0 KiB)

Sure, Charlie!

I am just waiting for the NUnit GUI built with 2.0 to be 4.5 friendly so
that I could test a few simple scenarios.

Jv

On Thu, Oct 4, 2012 at 5:23 AM, Charlie Poole <email address hidden> wrote:

> That idea introduces asynchronous processing, which would be a new feature.
> All we want to do here is make tests marked async run without causing
> problems. That's what this bug is about. We'll do that by waiting for the
> test to finish, so that only one test runs at a time, even if marked async.
>
> For more than that, see NUnitLite or wait for NUnit 3.0!
>
> Charlie
>
> On Wed, Oct 3, 2012 at 4:35 PM, Jv <email address hidden> wrote:
> > Hi Charlie,
> >
> > Yes, sure.
> >
> > An observation related to tests from the user perspective only. The
> "async"
> > or "Task" or "await", in a test scenario, seems like it will overcook the
> > way a test method will be written unless the Assert.That makes use of an
> > expression that will allow an async test to await the expression result.
> >
> > Jv
> >
> > On Thu, Oct 4, 2012 at 4:49 AM, Charlie Poole <email address hidden> wrote:
> >
> >> Jv,
> >>
> >> It seems like this bug is getting crowded with general discussion of
> >> async.
> >>
> >> Let's only post to the bug when we're talking about the bug from now on.
> >> The test is "will this be helpful to folks checking the bug?"
> >>
> >> For more general discussions, you can use the developer list or direct
> >> email.
> >>
> >> Charlie
> >>
> >> On Wed, Oct 3, 2012 at 3:55 PM, Jv <email address hidden> wrote:
> >> > The actual unit test functionality that I am looking at can be
> similar to
> >> > the output of the main method in this progam -
> >> > http://ravichandranjv.blogspot.in/2012/10/async-and-await-c-5.html
> >> >
> >> > Jv
> >> >
> >> > On Wed, Oct 3, 2012 at 3:36 PM, Simone Busoli
> >> > <email address hidden>wrote:
> >> >
> >> >> Jv, here's a list of issues in the code you provided:
> >> >>
> >> >> - it does not compile
> >> >> - even if you make it compile by assigning "await t" to a local
> >> >> variable, you are asserting that a Task<int?> is equal to a int?
> >> >> - even if you await on ob.TaskMethod() so that you get back an
> int?
> >> it
> >> >> still doesn't make much sense to compare those two values, and you
> >> >> should
> >> >> actually expect them to be different
> >> >> - the test will nonetheless pass because the two integers? will be
> >> >> always null as you are invoking Task.FromResult, which completes
> >> >> synchronously and therefore will have null Task.CurrentId
> >> >>
> >> >> Simone
> >> >>
> >> >> On Wed, Oct 3, 2012 at 11:07 AM, Jv <email address hidden>
> wrote:
> >> >>
> >> >> > Fyip,
> >> >> >
> >> >> > I am using the same RealFixtures file in Simone's project with the
> >> same
> >> >> > references but with different test code so the name of the test
> >> method is
> >> >> > same but it does not test a void return value.
> >> >> >
> >> >> > Jv
> >> >> >
> >> >> > On Wed, Oct 3, 2012 at 2:28 PM, RJV <email address hidden>
> >> wrote:
> >> >> >
> >> >> > > Hi Charlie,
> >> >> > >
> >> >> > > Attached is a test for checking the thread id of ...

Charlie Poole (charlie.poole) wrote :
Download full text (48.0 KiB)

Jv,

I'm not understanding what you are waiting for. Simone has published a
branch which will do what you want. You can pull, build and use it.

Charlie

On Wed, Oct 3, 2012 at 5:07 PM, Jv <email address hidden> wrote:
> Sure, Charlie!
>
> I am just waiting for the NUnit GUI built with 2.0 to be 4.5 friendly so
> that I could test a few simple scenarios.
>
> Jv
>
> On Thu, Oct 4, 2012 at 5:23 AM, Charlie Poole <email address hidden> wrote:
>
>> That idea introduces asynchronous processing, which would be a new feature.
>> All we want to do here is make tests marked async run without causing
>> problems. That's what this bug is about. We'll do that by waiting for the
>> test to finish, so that only one test runs at a time, even if marked async.
>>
>> For more than that, see NUnitLite or wait for NUnit 3.0!
>>
>> Charlie
>>
>> On Wed, Oct 3, 2012 at 4:35 PM, Jv <email address hidden> wrote:
>> > Hi Charlie,
>> >
>> > Yes, sure.
>> >
>> > An observation related to tests from the user perspective only. The
>> "async"
>> > or "Task" or "await", in a test scenario, seems like it will overcook the
>> > way a test method will be written unless the Assert.That makes use of an
>> > expression that will allow an async test to await the expression result.
>> >
>> > Jv
>> >
>> > On Thu, Oct 4, 2012 at 4:49 AM, Charlie Poole <email address hidden> wrote:
>> >
>> >> Jv,
>> >>
>> >> It seems like this bug is getting crowded with general discussion of
>> >> async.
>> >>
>> >> Let's only post to the bug when we're talking about the bug from now on.
>> >> The test is "will this be helpful to folks checking the bug?"
>> >>
>> >> For more general discussions, you can use the developer list or direct
>> >> email.
>> >>
>> >> Charlie
>> >>
>> >> On Wed, Oct 3, 2012 at 3:55 PM, Jv <email address hidden> wrote:
>> >> > The actual unit test functionality that I am looking at can be
>> similar to
>> >> > the output of the main method in this progam -
>> >> > http://ravichandranjv.blogspot.in/2012/10/async-and-await-c-5.html
>> >> >
>> >> > Jv
>> >> >
>> >> > On Wed, Oct 3, 2012 at 3:36 PM, Simone Busoli
>> >> > <email address hidden>wrote:
>> >> >
>> >> >> Jv, here's a list of issues in the code you provided:
>> >> >>
>> >> >> - it does not compile
>> >> >> - even if you make it compile by assigning "await t" to a local
>> >> >> variable, you are asserting that a Task<int?> is equal to a int?
>> >> >> - even if you await on ob.TaskMethod() so that you get back an
>> int?
>> >> it
>> >> >> still doesn't make much sense to compare those two values, and you
>> >> >> should
>> >> >> actually expect them to be different
>> >> >> - the test will nonetheless pass because the two integers? will be
>> >> >> always null as you are invoking Task.FromResult, which completes
>> >> >> synchronously and therefore will have null Task.CurrentId
>> >> >>
>> >> >> Simone
>> >> >>
>> >> >> On Wed, Oct 3, 2012 at 11:07 AM, Jv <email address hidden>
>> wrote:
>> >> >>
>> >> >> > Fyip,
>> >> >> >
>> >> >> > I am using the same RealFixtures file in Simone's project with the
>> >> same
>> >> >> > references but with different test code so the name...

Jv (jv-ravichandran) wrote :
Download full text (52.3 KiB)

Yes, all messages happening almost in parallel! :) Will do so and start
sending in the examples. Tell me how to put them on the wiki.

Jv

On Thu, Oct 4, 2012 at 6:20 AM, Charlie Poole <email address hidden> wrote:

> Jv,
>
> I'm not understanding what you are waiting for. Simone has published a
> branch which will do what you want. You can pull, build and use it.
>
> Charlie
>
> On Wed, Oct 3, 2012 at 5:07 PM, Jv <email address hidden> wrote:
> > Sure, Charlie!
> >
> > I am just waiting for the NUnit GUI built with 2.0 to be 4.5 friendly so
> > that I could test a few simple scenarios.
> >
> > Jv
> >
> > On Thu, Oct 4, 2012 at 5:23 AM, Charlie Poole <email address hidden> wrote:
> >
> >> That idea introduces asynchronous processing, which would be a new
> feature.
> >> All we want to do here is make tests marked async run without causing
> >> problems. That's what this bug is about. We'll do that by waiting for
> the
> >> test to finish, so that only one test runs at a time, even if marked
> async.
> >>
> >> For more than that, see NUnitLite or wait for NUnit 3.0!
> >>
> >> Charlie
> >>
> >> On Wed, Oct 3, 2012 at 4:35 PM, Jv <email address hidden> wrote:
> >> > Hi Charlie,
> >> >
> >> > Yes, sure.
> >> >
> >> > An observation related to tests from the user perspective only. The
> >> "async"
> >> > or "Task" or "await", in a test scenario, seems like it will overcook
> the
> >> > way a test method will be written unless the Assert.That makes use of
> an
> >> > expression that will allow an async test to await the expression
> result.
> >> >
> >> > Jv
> >> >
> >> > On Thu, Oct 4, 2012 at 4:49 AM, Charlie Poole <email address hidden>
> wrote:
> >> >
> >> >> Jv,
> >> >>
> >> >> It seems like this bug is getting crowded with general discussion of
> >> >> async.
> >> >>
> >> >> Let's only post to the bug when we're talking about the bug from now
> on.
> >> >> The test is "will this be helpful to folks checking the bug?"
> >> >>
> >> >> For more general discussions, you can use the developer list or
> direct
> >> >> email.
> >> >>
> >> >> Charlie
> >> >>
> >> >> On Wed, Oct 3, 2012 at 3:55 PM, Jv <email address hidden>
> wrote:
> >> >> > The actual unit test functionality that I am looking at can be
> >> similar to
> >> >> > the output of the main method in this progam -
> >> >> > http://ravichandranjv.blogspot.in/2012/10/async-and-await-c-5.html
> >> >> >
> >> >> > Jv
> >> >> >
> >> >> > On Wed, Oct 3, 2012 at 3:36 PM, Simone Busoli
> >> >> > <email address hidden>wrote:
> >> >> >
> >> >> >> Jv, here's a list of issues in the code you provided:
> >> >> >>
> >> >> >> - it does not compile
> >> >> >> - even if you make it compile by assigning "await t" to a local
> >> >> >> variable, you are asserting that a Task<int?> is equal to a
> int?
> >> >> >> - even if you await on ob.TaskMethod() so that you get back an
> >> int?
> >> >> it
> >> >> >> still doesn't make much sense to compare those two values, and
> you
> >> >> >> should
> >> >> >> actually expect them to be different
> >> >> >> - the test will nonetheless pass because the two integers?
> will be
> >> >> >> always null as you are invoking Task.FromResult,...

Changed in nunitv2:
status: In Progress → Fix Committed
Changed in nunitlite:
milestone: none → 0.9
assignee: Simone Busoli (simone.busoli) → Charlie Poole (charlie.poole)
Jv (jv-ravichandran) wrote :

Despite the fact that the bug has been fixed and NUnit can run async tests
correctly, there is this test that can still produce the same result
because of a deliberate bug I introduced in code to simulate the pre-bug
scenario.

Have a look at the code in this link -
http://ravichandranjv.blogspot.in/2012/10/when-synchronous-is-ahead-of.html

Thought it might be of interest and illuminative for some !

Jv

On Sat, Oct 6, 2012 at 8:25 PM, Charlie Poole <email address hidden> wrote:

> ** Changed in: nunitlite
> Milestone: None => 0.9
>
> ** Changed in: nunitlite
> Assignee: Simone Busoli (simone.busoli) => Charlie Poole
> (charlie.poole)
>
> --
> You received this bug notification because you are a member of NUnit
> Developers, which is subscribed to NUnit V2.
> https://bugs.launchpad.net/bugs/1057981
>
> Title:
> C#5 async tests are not supported
>
> Status in NUnit Test Framework:
> Triaged
> Status in NUnitLite Testing Framework:
> Triaged
> Status in NUnit V2 Test Framework:
> Fix Committed
>
> Bug description:
> If a method is marked async, nunit does not recognise it as a test,
> and some test runners may incorrectly pass it while it is still
> running. These methods actually return a Task not void, and the test
> can only be passed if the task completes without a failure.
>
> As detailed here http://anthonysteele.co.uk/async-and-await-with-nunit
>
> MSTest supports async tests
>
> http://blogs.msdn.com/b/visualstudioalm/archive/2012/03/13/what-s-new-for-mstest-unit-tests-in-visual-studio-11-beta.aspx
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/nunit-3.0/+bug/1057981/+subscriptions
>

--
Regards,

Ravichandran Jv
http://ravichandranjv.blogspot.com

Charlie Poole (charlie.poole) wrote :

At first glance, this seems to be an error in the test, not a bug
in nunit. But if you think it's a bug, please provide some more
information...

1) Tell us what version of NUnit you used to reproduce it.

2) If possible, please provide a test case (in text form, not a picture)
that will reproduce the bug.

3) Tell us what you think NUnit should do instead of what it's doing.

charlie

Jv (jv-ravichandran) wrote :
  • theTests.txt Edit (984 bytes, text/plain; charset=US-ASCII; name="theTests.txt")
  • cut.txt Edit (1.1 KiB, text/plain; charset=US-ASCII; name="cut.txt")

Hi Charlie,

The bug that I have highlighted is *a bug in code (reproduced)* not a bug
in NUnit. If it were a bug in NUnit obviously it would have passed.

>> 1) Tell us what version of NUnit you used to reproduce it. - The fixed
branch (although explained above)

It is not a bug in NUnit; it is a bug in code that I reproduced to simulate
the "pre-bug fix" scenario of a test passing regardless.

>>2) If possible, please provide a test case (in text form, not a
picture)that will reproduce the bug.

Attached is the code & test. The attached code and tests also demonstrates,
through the "taskId", that both the tasks are independent of each other and
provides the mechanism to test it, too!

>> 3) Tell us what you think NUnit should do instead of what it's doing.

I hope my "buggy "code/test helps. :) The intent was to test asynchronicity
in tests and have the mechanism to test it. The taskIds and the failing
tests prove that NUnit is functioning correctly despite the buggy code.

Jv

On Sun, Oct 7, 2012 at 9:12 AM, Charlie Poole <email address hidden> wrote:

> At first glance, this seems to be an error in the test, not a bug
> in nunit. But if you think it's a bug, please provide some more
> information...
>
> 1) Tell us what version of NUnit you used to reproduce it.
>
> 2) If possible, please provide a test case (in text form, not a picture)
> that will reproduce the bug.
>
> 3) Tell us what you think NUnit should do instead of what it's doing.
>
> charlie
>
> --
> You received this bug notification because you are a member of NUnit
> Developers, which is subscribed to NUnit V2.
> https://bugs.launchpad.net/bugs/1057981
>
> Title:
> C#5 async tests are not supported
>
> Status in NUnit Test Framework:
> Triaged
> Status in NUnitLite Testing Framework:
> Triaged
> Status in NUnit V2 Test Framework:
> Fix Committed
>
> Bug description:
> If a method is marked async, nunit does not recognise it as a test,
> and some test runners may incorrectly pass it while it is still
> running. These methods actually return a Task not void, and the test
> can only be passed if the task completes without a failure.
>
> As detailed here http://anthonysteele.co.uk/async-and-await-with-nunit
>
> MSTest supports async tests
>
> http://blogs.msdn.com/b/visualstudioalm/archive/2012/03/13/what-s-new-for-mstest-unit-tests-in-visual-studio-11-beta.aspx
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/nunit-3.0/+bug/1057981/+subscriptions
>

--
Regards,

Ravichandran Jv
http://ravichandranjv.blogspot.com

Jv (jv-ravichandran) wrote :
  • cut.txt Edit (1.1 KiB, text/plain; charset=US-ASCII; name="cut.txt")

Sorry, I had modified the CUT, in the previous email, to make it pass and
sent you the corrected one instead.

Attached is the "buggy" one with the Thread.Sleep() on a synchronous Task
within an *async task method*.

Jv

On Sun, Oct 7, 2012 at 9:12 AM, Charlie Poole <email address hidden> wrote:

> At first glance, this seems to be an error in the test, not a bug
> in nunit. But if you think it's a bug, please provide some more
> information...
>
> 1) Tell us what version of NUnit you used to reproduce it.
>
> 2) If possible, please provide a test case (in text form, not a picture)
> that will reproduce the bug.
>
> 3) Tell us what you think NUnit should do instead of what it's doing.
>
> charlie
>
> --
> You received this bug notification because you are a member of NUnit
> Developers, which is subscribed to NUnit V2.
> https://bugs.launchpad.net/bugs/1057981
>
> Title:
> C#5 async tests are not supported
>
> Status in NUnit Test Framework:
> Triaged
> Status in NUnitLite Testing Framework:
> Triaged
> Status in NUnit V2 Test Framework:
> Fix Committed
>
> Bug description:
> If a method is marked async, nunit does not recognise it as a test,
> and some test runners may incorrectly pass it while it is still
> running. These methods actually return a Task not void, and the test
> can only be passed if the task completes without a failure.
>
> As detailed here http://anthonysteele.co.uk/async-and-await-with-nunit
>
> MSTest supports async tests
>
> http://blogs.msdn.com/b/visualstudioalm/archive/2012/03/13/what-s-new-for-mstest-unit-tests-in-visual-studio-11-beta.aspx
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/nunit-3.0/+bug/1057981/+subscriptions
>

--
Regards,

Ravichandran Jv
http://ravichandranjv.blogspot.com

Changed in nunitlite:
status: Triaged → Fix Committed
Changed in nunitv2:
status: Fix Committed → Fix Released
Changed in nunit-3.0:
assignee: Simone Busoli (simone.busoli) → Charlie Poole (charlie.poole)
milestone: none → 2.9.6
Changed in nunitlite:
status: Fix Committed → Fix Released
Changed in nunit-3.0:
importance: Wishlist → High
Changed in nunit-3.0:
status: Triaged → Fix Committed
Changed in nunit-3.0:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers