Testing is definitely useful. It's always nice to have both modular and integration and end-to-end tests available. However, in practice Almost always you have to make compromises between writing code and writing tests, and it is quite obvious that the priority is shifting towards writing code.
The intensification of development results in a shortage of tests, and in general, such the situation seems justified. Numerous code refactorings, sometimes changes in business logic can be quite an argument for postpone testing until the main processes in the code have acquired stable outlines.
How, then, can you improve the efficiency of writing tests? We We propose an approach in which the main processes are tested first. Moreover, such a process is tested entirely, passing through different parts of the code, and sometimes also system components. pytest test framework allows you to parameterize input data of the process and check the result at the output, using a minimum code. One advantage of this approach is that if any areas of the main process change, changes in tests will be required minimal. In addition, it is often possible to encounter a situation where the function is called a few times in the code, and the input data format of such functions are definitely known. For example, the logic is encapsulated in some function, a function is part of a more global process and is called only within it. Testing such functions separately does not add efficiency compared to testing the main process to which the function belongs.
In general, such a methodology can be briefly formulated as:
1) we cover the entire main working processes with tests (i.e. the process itself acts as a testing module, sometimes intercomponent)
2) if resources are available, we focus on coverage and supplement with unit tests rest of the code
By the way, in ecosystem54 we use an approach based primarily on the entire core process (flow). The main process (flow) is indicated in the description of functions and methods. Then the assembler goes through the descriptions and builds a flowchart of the entire process.