In his book, Beck strongly recommends running test

Description of your first forum.
Post Reply
rakibhasanbd4723
Posts: 5
Joined: Sun Dec 22, 2024 10:08 am

In his book, Beck strongly recommends running test

Post by rakibhasanbd4723 »

s after we wrote it even if we know that some error occurred because we don’t create class/module/file or implementation of the feature. Benefits of running a test at this moment are:

Making sure (but not guarantee) that the implementation is correct.
The failed test gives us confirmation that feature russian virtual mobile number we want to implement doesn’t exist in a system.
The fulfilled test (change status color from Red to Green) gives us the feeling that we achieved our goal and also increased our trust to them.

There is only one case worse than project without test – a project with the test that we can’t trust.

Implement
In this step, we are focusing to change color from Red to Green. We shouldn’t think about anything else and try to achieve the pass test with every possible solution.

Image


Based on our experience and knowledge about business rules of apps, we can achieve it in many ways. The easiest way to achieve Green color is to hardcode expected value to go swiftly to Refactor part. The most common way of achieving this step is to write code that makes this and every previous test to pass. If a developer feels comfortable with the code and business logic, he can start with obvious implementation and then add test for edge cases of the feature.

Remove duplication
Many people think that in this step they should refactor code to improve its quality, what is true (this is one of the main reason to create test – to be able to safely experiment with code to create better implementation) but first, we should focus on removing common code fragments from test and production code.

I
Post Reply