Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

shaposhnyk/testcoverage

Open more actions menu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 

Repository files navigation

100% Test Coverage

This little project is created after a discussion with a person from SonarSource, who claimed that 100% test coverage is the most important cornerstone of programming.

Quite often

  • Code and tests are created by the same person, so he/she may overlook some problems, this is especially true so concurency issues, and for NPE handling
  • Tests are copy-pasted, so there are some irrelevant inits, like JEE/WELD frameworks, in-memory tests DB and so on
  • It is tempting to abuse some unit tests metrics
  • It is quite easy to missuse mockito In the result one may have awful 100% coverage as the one show in this project

Here we have:

  • Hundred class with 100%-coverage and "featuring" at least 3 problems like NPEs or IndexOutOfBounds
  • Fifty class with 50%-coverage and all edge cases addressed

All in all, when you are writing your code:

  • know what you are doing
  • remember what you are testing
  • document with tests all edge cases

You do not need 100% code coverage, you need to be sure you covered all relevant cases :)

About

A sample project to illustrate common pitfalls of 100%-convered code

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

Morty Proxy This is a proxified and sanitized view of the page, visit original site.