T S Vallender

testing

Different people have different standards for the speed of unit tests and of their test suites. David Heinemeier Hansson is happy with a compile suite that takes a few seconds and a commit suite that takes a few minutes. Gary Bernhardt finds that unbearably slow, insisting on a compile suite of around 300ms and Dan Bodart doesn't want his commit suite to be more than ten seconds
From https://martinfowler.com/bliki/UnitTest.html

Working links:
Tags:

I'm not a fan of most of RSpec's DSL, so appreciated this article from Test Double suggesting the use of Ruby 3's endless method syntax instead of using let.

def foo = bar.new
instead of
let foo { bar.new }

Not considered that before, and combined with using instance variables instead of let!, it reinforces and makes more obvious the difference.
Tags:

Just learned RSpec has an :aggregate_failures option, to show all failures in specs with multiple assertions.
Tags:

Added a helper script to a project that uses RSpec to replicate the default behaviour of Rails segregation of system tests and get faster feedback more easily.
Tags:

RSpec has a --bisect option which attempts to automatically find the smallest combination of specs causing a failure (use in conjunction with --seed).
Tags:

really need to remember to use --only-failures more often when debugging RSpec specs.
Tags:

Writing a bunch of specs to both thoroughly test and document some API endpoints is giving me a good chance to test my testing abilities. Still struggling to decide on where the limits should be on what a spec is testing, but honestly I don't think there's a single right answer to that in many cases.
Tags:

Note to self that I should learn mocha more thoroughly. The test failure blocking my Kamal PR is mocha-related, and it seems to be a solid addition to a minitest-based test suite.
Tags:

This was a good talk by Jez Humble. Of particular note was HP going from spending ~5% to ~40% of time on feature development by investing ~25% of their time on test automation.
Tags:

Finished reading the RSpec book yesterday. I’m not sure I learned much on a technical level but I have a slightly deeper understanding and respect for the design choices that went into making it what it is, I think.

Not that I like it any more than I did.
Tags: