---
title: "Discussion on \"Keeping Tests Valuable: Be Careful With Regressions!\" | Hashnode"
description: "Discussion on \"Keeping Tests Valuable: Be Careful With Regressions!\". The more effective the tests are, the more security they convey to us in the fight against regressions!"
url: "https://hashnode.com/posts/keeping-tests-valuable-be-careful-with-regressions/6424753dc22b33a63ad94fdd"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Keeping Tests Valuable: Be Careful With Regressions!](https://thepragmaticengineer.hashnode.dev/keeping-tests-valuable-be-careful-with-regressions?utm_source=hashnode&utm_medium=feed)

The more effective the tests are, the more security they convey to us in the fight against regressions!

Mar 29, 2023 · 19 min read · thepragmaticengineer.hashnode.dev  
Read the article

-   [#unit-testing](https://hashnode.com/tag/unit-testing)
-   [#programming-blogs](https://hashnode.com/tag/programming-blogs)
-   [#web-development](https://hashnode.com/tag/web-development)
-   [#developer](https://hashnode.com/tag/developer)
-   [#programming](https://hashnode.com/tag/programming)

## Written by

[Rafael dos Santos Miguel Filho](https://hashnode.com/@ThePragmaticEngineer)

@ThePragmaticEngineer · Brazil

  
[View profile](https://hashnode.com/@ThePragmaticEngineer)

Software Engineer

Hi, I'm Rafael, but you can call me Rafa! 😄 I'm a software engineer passionate about everything that involves technology, with more than 5 years of experience in the market. Throughout my career, I worked in banking institutions, developing innovative solutions and contributing to the digital transformation of the financial sector. With a strong interest in software architecture and testing, I am constantly looking to specialize and improve my skills in this area. Here, you will find tips, tutorials and discussions on the most varied topics related to architecture, good practices and software testing, always with the aim of sharing knowledge and learning from other developers. I value the exchange of experiences and I am always willing to listen and learn from my professional colleagues. Feel free to get in contact, leave your comments and share your own experiences and knowledge. Together, we can build a stronger, more collaborative community in the software development world.

## Responses 1

Markdown supported · ⌘↵ to post

[Anthony Fung](https://hashnode.com/@anthonyf)

[Mar 29, 2023](https://hashnode.com/posts/keeping-tests-valuable-be-careful-with-regressions/6424753dc22b33a63ad94fdd/comment/6424c8fcbb5fefa80796c518)

A very comprehensive article!

In my experience there are two things that we should be careful of when writing tests to avoid potential false outcomes.

Firstly, we should try to control all variables in the test. If a function relies on the date, and we use something like `DateTime.UtcNow`, there could be times of the month where this fails but passes at others. In this case, a good idea is creating a separate 'time' service where we can mock such values.

Another is when testing logic that has some aspect of concurrency, as the threading can potentially complete in a different order each time. In this case, it's best to try to get the logic to run single threaded for the tests, if possible.

[Rafael dos Santos Miguel Filho](https://hashnode.com/@ThePragmaticEngineer)

[Mar 30, 2023](https://hashnode.com/posts/keeping-tests-valuable-be-careful-with-regressions/6424753dc22b33a63ad94fdd/comment/6424c8fcbb5fefa80796c518#reply-6424eb4ebb5fefa80796c90d)

Thanks for reading! I agree with what you said, we need to be aware of these details too!
