Slide 1

Slide 1 text

Diff-Cover Bring your coverage from 0 to 100 one patch at a time Matt Bachmann

Slide 2

Slide 2 text

Batman Just Hired Us To Improve The Batputer

Slide 3

Slide 3 text

Lets check the project

Slide 4

Slide 4 text

Holy Untested Code Batman!

Slide 5

Slide 5 text

http://3.bp.blogspot.com/_x71ibPMLr4Y/TJu15YJoEaI/AAAAAAAAAys/Sy0lv3GCaEo/s400/LIL+SAD+BATMAN.jpg

Slide 6

Slide 6 text

Lets Talk Reality ● We are on a deadline ○ Covering the entire project may be infeasible ● We don’t necessarily understand everything ○ This can make for weak tests ● But… we can at least improve going forward

Slide 7

Slide 7 text

Diff-Cover ● Runs reports on Changes in a branch ● Verify that any new change is covered by tests ● Works with any language that can generate Cobertura XML reports (in theory)

Slide 8

Slide 8 text

So we write our new feature

Slide 9

Slide 9 text

Coverage has improved Very easy to stop here and say things are better.

Slide 10

Slide 10 text

Running Diff-Cover

Slide 11

Slide 11 text

Write More Tests! Bugs are a superstitious and cowardly lot. When tested they will show themselves. Developers must fight against chaos. Good tests are a critical tool.

Slide 12

Slide 12 text

Run it again!

Slide 13

Slide 13 text

WINNER! ● You merge the code ● The project is better than you found it ● Batman is pleased to code that works for once http://dorkhorde.blogspot.com/2010/09/happy-little-batman.html

Slide 14

Slide 14 text

Diff Quality ● Use static analyzers over Changes rather than the entire project ● Today supports pep8, pyflakes, pylint

Slide 15

Slide 15 text

No content

Slide 16

Slide 16 text

No content

Slide 17

Slide 17 text

More features! ● --fail-under option allows you to fail a build if the coverage percent or quality percent is not up to snuff ○ Very nice when integrating into CI ● --html-report Make super snazzy reports ○ Display nicely with the html-publisher jenkins plugin

Slide 18

Slide 18 text

No content

Slide 19

Slide 19 text

No content

Slide 20

Slide 20 text

Acknowledgments ● https://github.com/wedaly ○ Creator of diff-cover ● https://github.com/sarina ○ Implemented diff-quality ● 14 other contributors to date ● https://github.com/bachmann1234/diff-cover

Slide 21

Slide 21 text

Slides: http://goo.gl/C3o6WG Me: @MattBachmann