Answer the question
In order to leave comments, you need to log in
Where to start learning how to write TDD tests?
Hello!
There is an opinion that in order to really improve your skills and knowledge of a programmer, you need to write TDD tests.
What is it in general and what to write?
Please provide an example of these tests as they are written.
Thank you.
Answer the question
In order to leave comments, you need to log in
you need to write TDD tests.
TDD looks good at first glance, but then the pandemonium begins.
On the one hand, the code that is under the control of tests looks very nice, you can’t dig into it, because the tests, as it were, “clamp” it into the correct form. There is such an expression "bulletproof code". When there is a lot of such code, looking at it is a pleasure.
On the other hand, I once sat for about a month, putting tests on a future program in which there was nothing but air. And then I just lost motivation and I didn’t want to write the program anymore.
It looks like this:
One day you want to write a cool program that does this, this, and that. You, being impressed by its capabilities (in your imagination), think through all its components in your head to the smallest detail and are ready to rush into battle. You can already see this data obtained from it as a result, and you are already climbing on it, applying it here and there.
But you have to follow the rules of TDD and you are drowning in these coatings of each groove with tests from all sides. As a result, you have a lot of tests, a long history in the repository from their creation, and zero programs.
And after all the program, instead of tests to it is necessary.
Therefore, now I am making a program without tests at all (a prototype) in order to reveal all the pitfalls, and then I write tests and a new program. At the same time, all this happens under the motivation obtained from the data (prototype), for the sake of which this whole program was started.
But that is not all. Once there comes a moment when the program should not be refactored, but radically changed. (And this is the most important thing - to remove some kind of dead end in time, to which everything is heading. If this is not done, the program will be a conglomerate of plugs - and there is already an example, the tenth version.) And it becomes just a pity to erase tests that the new version does not fit at all.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question