In this article, I will tell you how to use a script to start a tested service, database and Amazon AWS services in Docker, then tests on Postman, and after they are completed, stop and delete the created containers. The tests are run every time the code changes. This way, we make sure each version works correctly with the AWS database and services.
The same script is run both by the developers themselves on their Windows desktops and by the Gitlab CI server under Linux.
For the introduction of new tests to be justified, it should not require the installation of additional tools either on the developer's computer or on the server where the tests are run upon commit. Docker solves this problem.
Know more: what is a service technician?
The test should run on a local server for the following reasons:
The network is never completely reliable. Out of a thousand requests, one may fail;
In this case, the automatic test will not work, the work will stop, you will have to look for the reason in the logs;
Too frequent requests are not allowed by some third party services.
In addition, it is undesirable to use the stand, because:
Not only bad code working on it, but also data that the correct code cannot process can break the stand;
As much as we try to revert back all the changes made by the test during the test itself, something can go wrong (otherwise, why the test?).