完 Cleaning up after your integration test?

by Jun 21, 2023

完 Cleaning up after your integration test?

Stop doing that!

When you do an integration test, you often need to create a record in the database.

These tests are often wrapped in a try..finally statement, where the just created record is being cleaned up in the finally section.

Don’t clean-up after te test.

Do clean-up before you do the test!

Benefits:

儭 Really start with a clean state, even when you are debugging your test and stop half-way.

儭 Get rid of the try…finally statement around your test.

儭 When the test fails, you can still review the created record for problems. It’s still there!

#

Subscribe to
The Daily Friction

A daily newsletter on automation and eliminating friction

Related Content

SpecFlow: Great concept, flawed execution.

SpecFlow: Great concept, flawed execution. SpecFlow, a BDD framework designed to make writing scenarios a breeze for requirement analysts. The problem: It falls short of its promise. The reality? Analysts rarely, if ever, write the specs themselves. Instead,...

read more

What if…? Production has a Staging slot.

What if...? Production has a Staging slot. Staging or QA environment needs to be the same or as close to production as it can be. Preferably, you want to restore a recent backup from Production as Staging and then deploy your changes . Kudos if you've fully...

read more

UUID v7 coming in .NET 9

UUID v7 coming in .NET 9 For those that didn't know, you can create Guids in different ways (algorithms). System.Guid supports UUID v4 out-of-the-box, the most used version. UUID v7 is now added, which creates Guids based on the current time. This means Guids can be...

read more