Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

What you actually want to do is test the methods with the highest cyclomatic complexity first (where it's greater than 1)

IntelliJ has a plugin



Most standard unit coverage tools will do this for you, often with the CRAP (Change-risk anti-patterns) score:

http://www.ncover.com/blog/change-risk-anti-patterns-code-co...

"This is based on the methodology that the more complex code is the more likely it is to have errors, hence the need for greater code coverage.

To better understand, let’s assume a scenario where you wanted to keep your change risk anti-patterns score below 30. To maintain this level with a code set that has a cyclomatic complexity of 10, you would need to achieve a code coverage (as defined by branch coverage) ratio of approximately 42%. If however, the complexity of your code was greater and you had a cyclomatic complexity of 20, you would need almost 72% code coverage if you wanted to maintain the same risk level.

Complexity increases risk. Testing decreases risk. The change risk anti-patterns score give you a metric to measure the correlation between the two."




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: