Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Mutation Testing with Mutant

Mutation Testing with Mutant

Tests are a good tool to verify your code but how do you verify your tests? Mutation testing is a technique to evaluate the quality of your tests by programmatically mutating (i.e. making a series of small modifications to) your code and ensuring that the tests no longer pass. This talk will attempt to demonstrate the value of mutation testing and show you how to use Mutant to improve the quality of your tests and your code.

Erik Berlin

April 22, 2014
Tweet

More Decks by Erik Berlin

Other Decks in Programming

Transcript

  1. flickr.com/photos/tomtolkien
    Mutation
    Testing with
    Mutant

    View Slide

  2. A carpenter
    is only as good
    as their tools.
    flickr.com/photos/matthigh

    View Slide

  3. What’s in
    your toolbox?
    flickr.com/photos/dk_spook

    View Slide

  4. Editor
    flickr.com/photos/audringje

    View Slide

  5. flickr.com/photos/laughingsquid
    Vim 1.0

    View Slide

  6. Debugger
    flickr.com/photos/[email protected]

    View Slide

  7. Profiler
    flickr.com/photos/anndouglas

    View Slide

  8. Testing

    View Slide

  9. Testing
    flickr.com/photos/onepointfour

    View Slide

  10. Code has bugs
    Tests are code ∴
    Tests have bugs
    flickr.com/photos/birdseyeview

    View Slide

  11. Code Coverage

    View Slide

  12. twitter.com/bloerwald/status/448415935926255618

    View Slide

  13. Mutation
    flickr.com/photos/tambako

    View Slide

  14. Original
    def foo(arg = true)
    arg || fail
    end
    assert_nothing_raised { foo }

    View Slide

  15. Mutant
    def foo(arg = true)
    arg
    end
    assert_nothing_raised { foo }

    View Slide

  16. twitter.com/kytrinyx/status/453567958317428736

    View Slide

  17. Demo

    View Slide