← Back to team overview

nunit-core team mailing list archive

[Bug 1057981] Re: C#5 async tests are not supported

 

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.


** Project changed: nunitv2 => nunit-3.0

** Also affects: nunitlite
   Importance: Undecided
       Status: New

** Changed in: nunitlite
       Status: New => Triaged

** Changed in: nunitlite
   Importance: Undecided => Wishlist

** Changed in: nunitlite
     Assignee: (unassigned) => Simone Busoli (simone.busoli)

** Changed in: nunitlite
   Importance: Wishlist => High

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

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


References