Good day.

1) Are modular tests often used in the development of commercial software?

2) Is it necessary or desirable?

3) Where can I read in Russian about modular tests, preferably "without water".

    3 answers 3

    1) Yes, often. In the majority of any serious projects that I personally had to work with, unit tests were

    2) As for his obligation, there can be one pernicious delusion. A programmer, especially one who has not used it before, may think that it is unnecessary (it is wasting time and energy that could be used to write new features). And in general, they say, simply do not make mistakes, and no tests are needed. However, only the Lord God does not make mistakes, and he seems to have tied up with the development after writing our universe in seven days (well, if, of course, it was him). Ordinary mortals, unfortunately, are prone to errors, and therefore testing refers to mandatory disciplines rather than to desirable ones. Of course, if you do not cover your code with tests, the sky will not fall to the ground, but your software will surely fall. It is necessary only to distinguish between the code that needs to be covered with tests, and the one for which the tests will be a waste of time. Basically, this distinction rests on the volume and complexity of the code that you write. By the way, the picture provided by @Etki illustrates this idea well - as long as you write something small, the tests will only take away your resources. But the more time you spend on your project, the more benefit the testing will bring.

    3) This topic is not to say that it is very complex. The principle of unit testing becomes intuitive after several practical exercises. Therefore, it is likely that two or three articles with examples will suffice. Here is an example with MSDN

      1) When how. Small companies like to work "on a lot”, large ones like to demand completely redundant unnecessary tests. Having an adequate team lead usually improves everything.

      2) Theoretically necessarily! In practice, as you understand ...

      • 2
        I’ll add one picture to the @VladD answer! Imgur In general, I wrote a huge treatise on testing a web application for PHP, which was planned to be pushed into local research along with a turnip (PHP has a lot in common with other languages, selenium is one for all), but now with time trouble. - etki
      1. Depends on the budget usually, because the process is built on the basis of the application of tests "in the load", without changing the process paradigm itself. There is still no understanding that if you change the development paradigm and write the tests to the beginning of the process, the budget will be reduced.
      2. It is necessary if the process is built around it, i.e. development of tests covering the functional, and only then developing the code that covers these tests. It is desirable - this is when the opposite, but in such situations it is rather undesirable. :-) So I would put the question differently - either necessarily, or not desirable.
      3. Most interesting. :-)