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 · 590 words · George Bell

Spring Security private key jwt with AWS KMS

As part of our proof of concepts in to the adoption of One Login we setup a Spring Security OAuth 2.0 demo that tested out the integration guide provided by Government Digital Service (GDS). Spring security has long had great OAuth2.0 support from both the server and client elements. Over the last year spring security added support for the private_key_jwt client authentication method as part of the authorization code grant flow. Spring Security GitHub ref ...

December 5, 2023 · 4 min · 819 words · Greg Simons

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. But first, lets take a look at what we mean by artefacts, and we used them in tests we’d written in Cucumber. ...

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

Linux timeout command

When a drone build is configured to both deploy and then delete AWS services, it is vital the AWS clean up step runs to maintain the AWS stacks within their limit. To ensure these steps run before the build times out, you can wrap your cucumber command in the linux timeout command within the drone pipeline Example commands: cd functional-tests || exit 1 timeout -k 10 10m bundle exec rake test Linux Timeout The timeout command is a command-line utility that will run the specified command for a given period of time, once that period of time is reached if the given command is still running it will be terminated. ...

October 14, 2023 · 2 min · 329 words · Paul Lewis

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. This isn’t great when you need these scripts to execute on every run, regardless of the exit reason. ...

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