question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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:closed
  • Created 3 years ago
  • Comments:18 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
dupdobcommented, Jul 24, 2020

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.

1reaction
rodrigogurgelcommented, Jul 23, 2020

Try it dotnet stryker -tr dotnettest

Read more comments on GitHub >

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

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found