When should you choose for test-based development?

My question is the same as the title. I haven’t finished the test-based development yet, I have done unit testing and I am aware of testing in general, but have I heard that it is very useful to follow TDD ?. So I have to choose this every time or there are some prerequisites ... I just need to know some basic or important requirements when I have to choose TDD. Sorry if this question is too trivial.

+4
source share
4 answers

I would say whenever you code a project. By this, I mean that you hope to create code that people will use. This is basically all the code, except for studies in which you learn and discover new methods.

Even if you think that the project is only small, often everything is getting out of control because of what. You'll be happy with the trials when you have to reorganize the big sprawl of code.

Also note that tdd is not just testing. This is a development methodology that encourages you to create clean and durable designs.

How do you start all tdd. Once you have more experience, you may be able to step back and determine when not to do tdd.

+5
source

IMHO, if you do not like TDD, trying to apply it in projects where you will need to interact / use outdated code, it is much more complicated than applying it in a project from scratch. In fact, there is a whole book about it.

NTN

+3
source

My advice would be to use unit testing as often as possible.

Warning. In my experience, TDD works best when working with technologies that you already have experience with. It is often difficult to write a test statement if you don’t know exactly what the desired result looks like (for example, try writing a test for an ASP.NET MVC action method if you have never written an action method in your entire life). In such cases, you are probably better off writing block tests after you inject the code.

+2
source

If I develop something without a user interface, I always use TDD these days. In the end, you need to test the software. You can either do extra work, or do TDD, or do extra work and combine the user client for testing only. The first tests are more complete and more repeatable.

Running TDD with user interface code, on the other hand, didn't really really matter much to me. For various business reasons, I am limited to Visual Studio out of the box for my work, and “recording” tests with VS is a huge time, especially when you have to rewrite them if you change the user interface. I am doing TDD for business user interface logic, but not the user interface itself.

+1
source

Source: https://habr.com/ru/post/1312361/


All Articles