Automated testing of software and web applications usually involves reproducing procedures, processes or functions once by means of a test sequence and then executing them automatically on a regular basis, e.g. after each change to the program code. In this way, it can be ensured that individual functions still work after a change in the code. In principle, however, software tests - just like manual, hands-on tests - can never ensure that the system is completely free of errors, since they only cover the exact case and section for which they were built.
Different methods in development
In development we speak of different types of tests, some of which we would like to briefly introduce to you today.
One of the best known and most common test methods are the so-called unit tests. Here a section of an application is isolated & specifically tested. It is only about testing a single section and a single component. The complete testing of a contact form would not fall therefore under it, however e.g. the writing of a single form content into an object, but not beyond that. If functions from different components are required, these are usually simulated by dummy objects.
If you want to test several components with each other (e.g. receiving the data from the contact form and sending it), we talk about so-called integration tests. These can be used to ensure communication between individual components of the application.
In functional tests, individual functional requirements are tested completely from the beginning (input) to the end (output). For example, receiving data from the contact form, writing to the database and sending emails. However, here again it must be taken into account that we are still talking about testing the program code. Important: There is still no "real" testing on a "real" web server at this point.
E2E Tests - End To End
The complete testing of a function is achieved with End To End tests.
However, these are more complex to develop and also cost a lot of execution time. The browser is programmed in such a way that it is controlled by the test program to perform certain actions. Here, a complete test, including clicks, form input, login, etc. is simulated and the output result is checked.
Advantages and disadvantages
Each of the presented methods has certain advantages and disadvantages, which I often express in the effort of development and execution. That is why we speak here of the so-called test pyramid. At the bottom - little effort and high automation - are the unit tests. At the top - high effort, long runtime and difficult to automate - are the E2E tests.
It is important to understand that tests can only ever cover a very specific test scenario, namely the one for which they were programmed. However, the more granularly one covers even small, trivial functions with unit tests, the higher the overall quality of the basic system can become.
There are, of course, other test methods that have not been presented here.
In practice, unfortunately, many clients do not see how valuable the development of tests really is. Often, little or no budget is allocated for this, preferring to spend it on "more functions". However, the development of tests is indispensable for good software. At the same time, it must be said that development can be time-consuming and expensive. It is therefore advisable to implement at least some test methods for critical functions.