---
title: "Comment by Roman Izosimov on \"Unit Tests Done Right (Part 2)\" | Hashnode"
description: "Sometimes in the arrange section of tests we can see repeatable (or very similar) code blocks and looks like it is a good candidate to extract identical (or ver"
url: "https://hashnode.com/posts/unit-tests-done-right-part-2/62790151ffdd2d96c766f2a6/comment/62bb334ec2f205e7cdb18670"
---

[Discussion](https://hashnode.com/posts/unit-tests-done-right-part-2/62790151ffdd2d96c766f2a6)

Comment [Unit Tests Done Right (Part 2)](https://hashnode.com/posts/unit-tests-done-right-part-2/62790151ffdd2d96c766f2a6)

[Roman Izosimov](https://hashnode.com/@RomanIzosimov)

[Jun 28, 2022](https://hashnode.com/posts/unit-tests-done-right-part-2/62790151ffdd2d96c766f2a6/comment/62bb334ec2f205e7cdb18670)

Sometimes in the arrange section of tests we can see repeatable (or very similar) code blocks and looks like it is a good candidate to extract identical (or very similar) code to a method to reuse by several tests. But I think the readability and maintainability of the test could degrade. What do you think about this? Should we apply the same best practices for writing tests as for business logic? There are very similar code in the Arrange sections of `Should_return_user_by_id_unless_deleted` and `Should_return_null_when_user_is_deleted` tests, which could be extracted, so I wonder if you prefer to duplicate or not in such cases.

[Aleksei Zagoskin](https://hashnode.com/@azagoskin)

[Jun 28, 2022](https://hashnode.com/posts/unit-tests-done-right-part-2/62790151ffdd2d96c766f2a6/comment/62bb334ec2f205e7cdb18670#reply-62bb42dec2f205e7cdb1887e)

Good question, [Roman Izosimov](https://hashnode.com/@RomanIzosimov). Usually I prefer to declare simple things explicitly in the "arrange" section, while more complex setup may deserve reusable methods or extension methods for Fixture e.g. F.CreateCustomerWithOrders().
