# Clean Tests

### Connection - Mythbusters

Connect participants to the topic by making them relate on Facts and Myths regarding Unit Tests

![](/files/E4v6mBbwTJrRnkSLPyBw)

Debriefing is available in the slide deck

### Concepts

![](/files/4qEq1gX5tksHq8hVAQKv)Before going further regarding the concepts, invite them to reflect on they define :

* What is a Unit ?
* Which tests they would write on the giving piece of code ?
* How they would write it ?

![](/files/P1XR8jaty8IHbj7UFDqw)

Then explain all those concepts :

* Schools of testing
* Pillars of Good Unit Tests
* FIRST Principles
* Anatomy of Unit Tests
* How to name your Unit Tests
* Styles of Code

![](/files/DTM5wUnwr1CdD6zKupZl)

### Concrete Practice - Anti-Patterns

In groups, make them identify Unit Tests anti-patterns by using Code snippets or the repository provided in this page.

![](/files/o141GwRqKzLlnE8DTTDw)

You can debrief it directly on the Miro board or from the slides :

![](/files/B6hoHN6JcQABHimUwcy1)

![](/files/nAb9VP7A4PF6XBeQMpaV)

My identification logic and refactoring are explained in this step-by-step guide :&#x20;

{% embed url="<https://github.com/ythirion/clean-tests/blob/master/java/src/test/java/antipatterns/solution/step-by-step.md>" %}

### Conclusion

![](/files/4oLiSen0j8nuNOBnuLov)

### Resources

* Repository is available here : <https://github.com/ythirion/clean-tests>
* You can use the miro board here to facilitate this session : <https://miro.com/app/board/o9J_lpq9YGo=/?invite_link_id=764775433309>
* Slides are available here on speakerdeck :&#x20;

{% embed url="<https://speakerdeck.com/thirion/clean-tests>" %}
Clean Tests slides
{% endembed %}

* A lot of stuff from this workshop comes from the book "Unit Testing : Principles, Practices, and Patterns"by [Vladimir Khorikov](https://enterprisecraftsmanship.com/)

![](/files/vt2T5ifDcw0icgUEBPIu)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://yoan-thirion.gitbook.io/knowledge-base/software-craftsmanship/testing/clean-tests.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
