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

Incremental Testing

Incremental Testing

Lightning talk for CS580 Module 1 at Allegheny College

Hawk Weisman

February 06, 2015
Tweet

More Decks by Hawk Weisman

Other Decks in Programming

Transcript

  1. Incremental Testing Shortening the Test Feedback Loop With Incremental Compilation

    Hawk Weisman Department of Computer Science Allegheny College [email protected] http://hawkweisman.me
  2. The Implement-Test-Fix Loop 1. Write code 2. Run tests 3.

    Fix any bugs 4. Repeat ad nauseum 2/8
  3. Problems Running tests often takes a long time Waste of

    programmer time Encourages sloppiness 3/8
  4. A Potential Solution What if tests were only run when

    the code they test has changed? 4/8
  5. A Potential Solution What if tests were only run when

    the code they test has changed? Running individual tests is much quicker than running a whole suite 4/8
  6. A Potential Solution What if tests were only run when

    the code they test has changed? Running individual tests is much quicker than running a whole suite Rapid feedback could be possible 4/8
  7. Incremental Compilers What’s an incremental compiler? Compiles changes to source

    and updates binaries Eliminates re-compilation of unchanged source Much faster compilation 5/8
  8. Incremental Compilers What’s an incremental compiler? Compiles changes to source

    and updates binaries Eliminates re-compilation of unchanged source Much faster compilation Some examples: GNU incremental gcc Zinc incremental Scala compiler Eclipse incremental Java compiler 5/8
  9. Incremental Compilers What’s an incremental compiler? Compiles changes to source

    and updates binaries Eliminates re-compilation of unchanged source Much faster compilation Some examples: GNU incremental gcc Zinc incremental Scala compiler Eclipse incremental Java compiler How does it work? Compiler runs as a server Watches source code for changes 5/8
  10. Continuous Testing With Incremental Compilers On the first test run

    Determine what tests target what code Targeting information cached at function level 6/8
  11. Continuous Testing With Incremental Compilers On the first test run

    Determine what tests target what code Targeting information cached at function level When code is changed Get change set from compiler Run only the tests that target changed functions Alert programmer to any failures 6/8
  12. Continuous Testing With Incremental Compilers On the first test run

    Determine what tests target what code Targeting information cached at function level When code is changed Get change set from compiler Run only the tests that target changed functions Alert programmer to any failures After changes If new functions were added, run all tests to determine what target them If tests were added, run them immediately to determine targets 6/8
  13. Potential Issues Works best for pure functional code Integration tests

    still need to be rerun every time Incremental compiler cannot apply all optimizations 7/8