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

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 · 331 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....

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

TiL: Take full-length screenshots using DevTools

TL:DR Capture full-length webpage screenshots using built in Developer Tools. Sometimes when developing a webpage you may need to send screenshots back and forth between members of your squad or business. When doing this it is important that you capture the full webpage in order to really display what you’re working on. Which is why introducing simple devtools may be of use. In order to do this you will need to firstly open your browser of choice and navigate to the page you would like to capture....

July 12, 2023 · 5 min · 903 words · Iestyn Green