Test driven development

The test driven development or the TDD how i like to call it, is a process software engineering to test part of your code. I have not been to much in the testing part till’ I get to be on my algorithm class, in spite of that

not that kind of test

Testing your code is like testing yourself and your work in some way, you have to make sure that includes all the possibles inputs or scenarios and then you will be able to solve all the possible outcomes. Off course your code is going to be big enough so you won’t know how to start. That is why you will have to implement the Test Driven Development to make it an easy process.

This practice in software instruct developers to write new code only if and automated test for your code have failed recently. So at the end the purpose is tho make the code clearer and bug-free.

This starts by designing test by every tiny functionality of the application. The first approach is to specify and validate what the code will do. In the normal testing way we would generate the code and test it simply. But test might fail if these are develop before the development. This is pretty normal, therefore the developer or developers, might rewrite the code in order to pass this tests or as the common formal term refactoring.

So what is refactoring?. This means change your code as much as you want without affecting his behavior. The following diagram explain better the development process for the testing.

How can I do an TDD test?

warning steps ahead:

  1. Add a new test
  2. Run your program within the test and check if it fails
  3. Write the needed code
  4. Run the test and Refactor the code
  5. Repeat

The TDD cycle define to write and make the test run, then, change the code to make it work and Refactor it. End of the cycle and repeat.

Conclusion and learnings

As you can see TDD can be presented as the traditional testing way of testing and fixing cycle, but in fact TDD try to approach an specify technique, we can assure that it doesn’t mean to do a lot of tests. The idea is to build or improve the system to pass the tests. At the end it helps you to build you system with confidence, and that is the best way to do it.

Leave a comment

Create a website or blog at WordPress.com

Up ↑

Design a site like this with WordPress.com
Get started