Potential problem with coverage analysis on async tests
See original GitHub issue//First Scenario
[HttpPut("api/myendpoint01")]
public async Task<IActionResult> MyEndPoint01(string param)
{
//Here the mutant is killed
if(string.IsNullOrEmpty(param))
{
//Do something...
return BadRequest();
}
//.......
}
//Second Scenario
[HttpPut("api/myendpoint02")]
public async Task<IActionResult> MyEndPoint02(string param)
{
//Here the mutant is survived
if(string.IsNullOrEmpty(param))
{
//Do something...
return BadRequest();
}
//.......
}
I’ve got the unit test for both endpoint covering the BadRequest result and Ok result.
My question is why in the first scenario the mutant is killed but in the second one it is survived?
Info:
Windows 10 Pro .NET Core 2.1.509 NUnit 3.12.0 Stryker 0.18.0
Issue Analytics
- State:
- Created 3 years ago
- Comments:18 (9 by maintainers)
Top Results From Across the Web
Code Coverage not working when using async test methods
I've been having problems with my code coverage for the last few days and this explains it. My only differences are that I'm...
Read more >Why all the async functions seem like they are not covered ...
I have this all over my application: I have a well covered function, however it says "branch not covered" on async function part...
Read more >Code Coverage Criteria for Asynchronous Programs
An evaluation of JScope on 20 JavaScript applications shows that the proposed code coverage criteria can help improve assessment of test adequacy, complementing ......
Read more >Testing-library: avoid these mistakes in async tests
In this article, I would like to show a few common mistakes that could lead to such issues, how to fix these, and...
Read more >Angular Asynchronous Test Patterns and Recipes
In this tutorial, we will first review the various strategies available for testing asynchronous Angular code.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Thanks @Mobrockers : I was about to say the same thing here. It sounds like a coverage issue. I lack experience with tests marked as ‘async’ but those could potentially result in invalid coverage data.
Try it dotnet stryker -tr dotnettest