It is very common for developers to think that their code is bug-free because they wrote it themselves. They might have tried it in two or three cases where it did not fail. Nonetheless, these small tests are not enough to ensure the correct functioning of the solution, since most of them run the so-called “happy path” testing, the option where everything runs correctly, which is why it is necessary to resort to what we formally call as Testing.
These tests are divided into four types, mentioned below, from the simplest to the most complex, respectively: unit, integration, system, and situation. The complexity of implementing such tests depends on the situation, the type of development, the methodology, and the available resources.
For example, starting unit testing on a development that has been running for three months would last approximately one person’s full time for a couple of weeks. Besides, it could generate delay when the need to change code arises, due to an unhandled failure, which, after all, is extra time and money. Hence the importance of defining in time, what tests will be carried out on the solutions.
Next, I will explain two types of tests that have a lesser degree of difficulty but that, when carried out, will give a high degree of certainty of the operation of software development. They are unit tests and integration tests.
The purpose of this type of testing is to ensure that each component of the system works in isolation, that is, that operations are performed properly, that it receives only the types of parameters defined, that it responds correctly and that it fails when it should fail.
These tests take into account the minimum unit of work, which is nothing more than a function or a method that executes a specific operation or a set of operations, for which it is necessary to design tests in which the result is successful and in which , the execution fails.
It is important to spend enough time validating the largest number of successful and failed execution cases to have more certainty of the code to test. These tests are limited to specific code blocks, therefore, their coding is simple, but given the need to perform it on many of these blocks, in “large” developments it takes a long time.
The recommendation is to do them immediately on the new code made so as not to accumulate technical debts that in the future may affect delivery times.
Its purpose is to ensure that the previously tested components, in isolation, work well with each other, that is, that they interact correctly in the sending and receiving of requests, validating that they are executed and that the responses generated are appropriate. Again success and error cases are validated to make sure that contingency methods work.
Its execution takes a little more time since it is necessary to lift the application context, since the integration tests also validate calls to the requests to the databases, using as a starting point the Endpoints defined in the rest of the services, therefore, it is important to integrate the security management implemented in the development into the tests.
Although unit and integration tests are not all that must be carried out on a system to ensure its operation, they are a good start since these will give you a solid base that will allow you to be certain of the development carried out. It is important to start planning how and when your development will start.