TiL: Adding numerous tags to ParallelTests in cucumber elegantly

Trying to run tests in parallel in your CI/CD pipeline is tricky at the best of times, but what if you have tests which should only be run in a certain environment and not as part of the CI build stage? It is fairly simple to just tag a feature file with a unique tag that can then be passed to the bundle exec rake command in the functional-tests step, as an environment variable....

July 2, 2024 · 3 min · 580 words · Tomos Griffiths

TiL: Save CPU cycles by logging blocks

We log a lot in our functional tests. In fact, we log so much we wrote our own logger called Herodotus that extends the default Ruby logger so we can have a correlation id added to the log to help keep track of which scenario a given log is from1. But with that much logging, we want to keep things lightweight. That’s where we want to make sure our logs aren’t doing more work than we expect....

December 15, 2023 · 3 min · 587 words · George Bell

Artefacts in tests and managing them with Atlas

We’ve recently publicly released a Gem called dvla-atlas1 and today we are going to take you through a bit of history surrounding testing at the DVLA that led to use developing Atlas, along with a dive into some of the code that makes it tick. Atlas is designed to make the managing of properties in functional tests easier while also ensuring that each test is run in isolation and without any cross-pollination of test data....

November 14, 2023 · 8 min · 1658 words · Nigel Brookes-Thomas & George Bell

The at_exit function

Traditionally, in functional testing, a clean up/tear down script would be run in something called an After hook. These hooks are part of the Cucumber DSL and are designed to execute when a scenario has finished. Cucumber example: After do |scenario| if scenario.failed? MultiLogger.clean_logs end end There is a drawback to these hooks where they will fail to run when certain exit codes are returned from the scenario or the program is interrupted....

August 23, 2023 · 2 min · 255 words · Thomas Feathers

TiL: Generating numerous FakerMaker objects in one call

Trying to generate numerous, realistic-looking objects for automation testing can be difficult. Using FakerMaker to do just that is preferable; using factories with Faker to dynamically create the test data you need in whatever format you need, is far better than using fixtures. But what if you needed more than one object of the particular factory that you have created? Creating a factory We can use Faker and FakerMaker to create an individual factory for an API request body like this:...

August 22, 2023 · 2 min · 309 words · Tomos Griffiths