akkadotnet / akka.analyzers

Roslyn analyzers for Akka.NET developers.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Akka.TestKit: all tests should be asynchronous

Aaronontheweb opened this issue · comments

Is your feature request related to a problem? Please describe.

TL;DR; - all test methods should return a Task and use await-able methods in the TestKit. Goal behind this is to reduce blocking threads, which can have side effects on the test suite. This is something we've wanted for Akka.NET itself for years a way of combatting racy specs inside our own test suite.

Describe the solution you'd like

We're probably better off not going after the actual test members (i,e. Fact in xUnit) since the TestKit has to support multiple testing frameworks, but we should go after the individual methods called inside the TestKit

  • AwaitAssert --> AwaitAssertAsync
  • AwaitCondition --> AwaitConditionAsync
  • ExpectMsg --> ExpectMsgAsync
  • Watch --> WatchAsync

Describe alternatives you've considered

The default "there's an async overload of this method" C# tool can pick up some of this, but not most - especially in situations where the return type and input methods are different.

This would fall under AK2000 - API usage.

Not a complete list of TestKit methods we should try to make async, btw.