Skip to content

kevin-j-m/ruby_cover_band

Repository files navigation

Enough Coverage To Beat The Band

Abstract

The lights cut out. The crowd roars. It’s time. The band takes the stage. They’ve practiced the songs, particularly the covers. They’ve sound checked the coverage of the speakers. They know the lighting rig has the proper colored gels covering the lamps. They’re nervous, but they’ve got it all covered.

Similarly, code coverage can give you confidence before your app performs on production and also tell you how live code is used (or not used). We’ll cover how to leverage ruby’s different coverage measurement techniques in concert to assist your crew and delight your audience.

Presentation Details

This talk is an explanation of the different modes ruby’s Coverage module provides. It uses the theme of staging a concert as the through line.

For each mode, we examine how it works and what it tells you. We examine the coverage results of code that models performing a concert as example scenarios where that code coverage mode yields actionable insights. While code coverage is frequently talked about in regards to an application’s test suite, this talk explores how coverage can be used for instrumenting a running application in production.

Each coverage mode answers a different question about the code that was run under coverage:

  • Lines - how many times was each line executed?
  • Oneshot Lines - which lines were executed?
  • Methods - how many times was each method executed?
  • Branches - how many times was each conditional executed?

Slides

The latest iteration of the slides that accompany this presentation are available here in this repository. The slide deck in this repo is in macOS's Keynote format. A copy of the slides are also available on SpeakerDeck.

Code Examples

Lines Coverage

In order for the ten shows or the coverages script to run, Sonic Pi must be installed and be running. The sonic-pi-cli gem is used to communicate with Sonic Pi.

This script will take a long time to run, as it actually plays the (one song) setlist for the tour ten times, with opportunities for strings to break.

Oneshot Lines Coverage

Methods Coverage

Branches Coverage

Seen At

About

Enough Coverage To Beat The Band

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks