Widening your talent pool

Building an effective talent pool is central to an efficient recruiting process. If you find yourself in a position where you need to recruit quickly, having a pool of talented candidates to pull…


独家优惠奖金 100% 高达 1 BTC + 180 免费旋转


An individual review article for PPL UI 2020 course

What is TDD? TDD is an approach and style of software development where tests are made first before implementing any code functionality. The tests done are for every small functionality of the application. This means the tests will fail first and only then will any code implementation be done. Additionally, only enough code is made to make the tests pass. Any further code should wait for the next set of tests to fail first.

As programmers, we are bound to find bugs and failed tests that leave us confused and frustrated. Especially when we are already late in the development stage, where the source code has grown considerably large. This is where TDD can offer a much better coding ‘lifestyle’. In a bit, we will learn how to apply TDD in our work, but before that, let us see what kind of benefits we can gain:

example of our coverage for Tentang Disabilitas PBI using lcov

So how do we apply TDD practice? Simple! there are 3 stages in the TDD cycle:

Additionally, the tests we make should best follow the FIRST principle:

Our team has been following this practice from the start of the project. Here are some screenshots:

test first, with the red lines indicating a mistake
failed pipeline
code implementation to make tests pass
tests passed

Here is an example testing process I’ve done in the back-end part:

In the RED stage, this is a simple example of one of the tests to make sure the correct status code is returned upon success of adding the details of a facility information. This test is surely Fast and will finish executing in a matter of seconds. It is Independent, since it is not influenced by other tests. It is Repeatable, it can be repeated at any time in the development process after creating it. It is Self-Validating as seen with the assertEqual function that contains an expected output. Finally, it is Timely, since this is done in TDD manner, it is written before the implementation code.

In comparison to front-end testing, such as:

Turns out, backend testing is much faster for me to create since it is more clear to me what needs to be done. Front-end testing requires more ‘imaginative abilities’ to properly create thorough tests since it is mostly functional tests. Also, I encounter much more trouble in front-end testing than back-end where in most cases, it directly succeeds. If not, it is easy to debug and solve any errors.

Then in the GREEN stage, the relevant code for the above example test is shown. The response return contains the status, which is what we tested above.

Thank you for reading!

Thank you for reading!

— Wilson


Add a comment

Related posts:

How to securely maintain all of your passwords

If you believe you are technologically challenged and need help with managing all of your passwords — This is for you. One of the most aggravating things about apps and the web is having to maintain…