---
title: "Discussion on \"Clean Code Tip: AAA pattern for tests: why is it important?\" | Hashnode"
description: "Discussion on \"Clean Code Tip: AAA pattern for tests: why is it important?\". The most important trait of Tests? They must be correct. The second one? They must be readable. The AAA pattern helps you write better tests."
url: "https://hashnode.com/posts/clean-code-tip-aaa-pattern-for-tests-why-is-it-important/62334e21bef4c71aa6f0c9ff"
---

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

Discussion

# [Clean Code Tip: AAA pattern for tests: why is it important?](https://code4it.hashnode.dev/clean-code-tip-aaa-pattern-for-tests-why-is-it-important?utm_source=hashnode&utm_medium=feed)

The most important trait of Tests? They must be correct. The second one? They must be readable. The AAA pattern helps you write better tests.

Mar 17, 2022 · 2 min read · code4it.hashnode.dev  
Read the article

-   [#clean-code](https://hashnode.com/tag/clean-code)
-   [#testing](https://hashnode.com/tag/testing)

## Written by

[Davide Bellone](https://hashnode.com/@davidebellone)

@davidebellone · Turin, Italy

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

Principal backend developer | Content Creator | Microsoft MVP

I’m a Principal Backend Developer with more than 10 years of professional experience. I’ve been working with Microsoft platforms and frameworks since 2014. I’ve worked with many tools and frameworks, such as Azure, MongoDB, Docker, and, of course, .NET and C#. I love learning new things, and I think that the best way to learn is to share: that’s why I started my journey as a content creator and conference speaker.

## Responses 2

Markdown supported · ⌘↵ to post

[Pritesh Usadadiya](https://hashnode.com/@priteshusadadiya)

[Mar 24, 2022](https://hashnode.com/posts/clean-code-tip-aaa-pattern-for-tests-why-is-it-important/62334e21bef4c71aa6f0c9ff/comment/623c1de87753c274c2ab67a7)

\[..PingBack..\] This article was curated as a part of the [#50th Issue of Software Testing Notes.](https://softwaretestingnotes.substack.com/p/issue-50-software-testing-notes)

[Miki Szeles](https://hashnode.com/@mszeles)

[Mar 17, 2022](https://hashnode.com/posts/clean-code-tip-aaa-pattern-for-tests-why-is-it-important/62334e21bef4c71aa6f0c9ff/comment/6233604cbef4c71aa6f0cbe4)

Great writing Davide. 👏

Seeing testing topic here is very heartwarming for me.

I hope we will see more great testing content from you. 😊

This AAA pattern is basically the same as Given-When-Then right?

[Davide Bellone](https://hashnode.com/@davidebellone)

[Mar 18, 2022](https://hashnode.com/posts/clean-code-tip-aaa-pattern-for-tests-why-is-it-important/62334e21bef4c71aa6f0c9ff/comment/6233604cbef4c71aa6f0cbe4#reply-623439326647c71acb64141f)

Yes, indeed! They're the same thing, just with an acronym easier to remember.

Both AAA and Given-When-Then just refer to setting up preconditions, executing the main operation, and checking the result.

[Miki Szeles](https://hashnode.com/@mszeles)

[Mar 18, 2022](https://hashnode.com/posts/clean-code-tip-aaa-pattern-for-tests-why-is-it-important/62334e21bef4c71aa6f0c9ff/comment/6233604cbef4c71aa6f0cbe4#reply-62343e206647c71acb6414ca)

Exactly [Davide Bellone](https://hashnode.com/@davidebellone) 😊
