Slide 1

Slide 1 text

@ClareSudbery MenderCon ‘24 Use code coverage and mutation testing to add tests to legacy code

Slide 2

Slide 2 text

Useful links from today Useful Links @ClareSudbery

Slide 3

Slide 3 text

Untested legacy code Add tests before refactoring @ClareSudbery When would you do this?

Slide 4

Slide 4 text

…because safe, confident refactoring rocks! @ClareSudbery When would you do this?

Slide 5

Slide 5 text

Landing in a neat pair-synchronized way. https://www.instagram.com/p/BsY1qBeg5Qg @ClareSudbery

Slide 6

Slide 6 text

Bamboo, by No Fit State

Slide 7

Slide 7 text

@ClareSudbery https://www.geepawhill.org/2021/09/29/many-more-much-smaller-steps-first-sketch/

Slide 8

Slide 8 text

Demo: Using code coverage to add tests to existing code @ClareSudbery Using coverage to add tests

Slide 9

Slide 9 text

Code coverage tools @ClareSudbery Using coverage to add tests

Slide 10

Slide 10 text

@ClareSudbery Use coverage to find missing test data Doing the exercise yourself • Original code is here: https://github.com/emilybache/GildedRose-Refactoring-Kata • Requirements are in the readme • Run this command to clone the code: • git clone https://github.com/emilybache/GildedRose-Refactoring-Kata.git • Choose your language • My demo code is here: https://github.com/claresudbery/GildedRose-Refactoring- Kata/blob/coverage-demo-complete/csharpcore/GildedRoseTests/GildedRoseTest.cs

Slide 11

Slide 11 text

Demo Using mutation testing to improve your test suite @ClareSudbery Using mutation testing to improve tests

Slide 12

Slide 12 text

@ClareSudbery • Original code is here: https://github.com/emilybache/GildedRose-Refactoring-Kata • Requirements are in the readme • Run this command to clone the code: • git clone https://github.com/emilybache/GildedRose-Refactoring-Kata.git • Choose your language • My demo code is here: https://github.com/claresudbery/GildedRose-Refactoring- Kata/blob/csharp-mutation-complete/csharpcore/GildedRoseTests/GildedRoseTest.cs Use mutation testing to find missing untested edge cases Doing the exercise yourself

Slide 13

Slide 13 text

Questions? @ClareSudbery Using coverage and mutation testing to add and improve tests

Slide 14

Slide 14 text

Useful links from today Useful Links @ClareSudbery

Slide 15

Slide 15 text

I hosted a podcast… https://www.madetech.com/podcast/ @ClareSudbery

Slide 16

Slide 16 text

Relevant podcast episodes… @ClareSudbery Test Driven Development: tinyurl.com/mtb-geepaw-hill Refactoring: tinyurl.com/mtb-emily-bache Balancing Change: tinyurl.com/kevlin-henney-twitter Changing legacy systems: tinyurl.com/meri-williams- twitter

Slide 17

Slide 17 text

No content

Slide 18

Slide 18 text

Sudbery Software Engineering Ltd Does your team want help to improve their software delivery? Coaching, keynotes & workshops Events and info: tinyurl.com/csudbery Mastodon: mastodon.social/@ClareSudbery LinkedIn: tinyurl.com/lin-csudbery Podcast: tinyurl.com/tech-better-pod

Slide 19

Slide 19 text

Thank you!