# Structuring Effective Unit Tests

> [![Mentoring](https://cdn.mentorcruise.com/img/banner/navy-mentoring-badge.svg align="left")](https://mentorcruise.com/mentor/adriankodja/)
> 
> "Maximizing Test Coverage and Efficiency: A guide to structuring Unit Tests"

**𝑨𝑨𝑨 𝒑𝒂𝒕𝒕𝒆𝒓𝒏** - ( 𝘢𝘳𝘳𝘢𝘯𝘨𝘦, 𝘢𝘤𝘵, 𝘢𝘴𝘴𝘦𝘳𝘵)

𝐆𝐢𝐯𝐞𝐧-𝐖𝐡𝐞𝐧-𝐓𝐡𝐞𝐧- very similar to 3A

In the 𝒂𝒓𝒓𝒂𝒏𝒈𝒆 section you bring the SUT and its dependencies to a desired state.

In the 𝒂𝒄𝒕 section, you call the methods on SUT, pass the prepared dependencies, and capture the output value ( if any )

In the 𝒂𝒔𝒔𝒆𝒓𝒕 section, you verify the outcome.

𝐆𝐢𝐯𝐞𝐧 corresponds to arrange

𝐖𝐡𝐞𝐧 corresponds to act

𝐓𝐡𝐞𝐧 corresponds to assert

There's no difference between these two patterns, it's just that the Given-When-Then pattern is more readable to non-programmers.
