✅ Test Explorer Skips Async Tests

When I change the test to public async void TestMethod1, the function is skipped by Test Explorer (even when there isn't actually an await function and it's just a Console.WriteLine). When it is switched back to not async (public void TestMethod1) the test is run and successful. I need to test some async functions. How can I do this?
6 Replies
333fred
333fred4mo ago
Have your tests return Task, not void It's not that it skips them: they start, and the method immediately returns and the test framework has no way to know they're still running
big very sad man
big very sad manOP4mo ago
Thanks for your help! I also just figured this out before I checked discord again. RIP 30 minutes
333fred
333fred4mo ago
No worries, I only just responded anyway Make sure you $close the thread if that's it
MODiX
MODiX4mo ago
If you have no further questions, please use /close to mark the forum thread as answered
big very sad man
big very sad manOP4mo ago
Thanks! $close
MODiX
MODiX4mo ago
If you have no further questions, please use /close to mark the forum thread as answered
Want results from more Discord servers?
Add your server