Requesting a master, I am a novice, and I have seen end-to-end testing mentioned in many places. Is this used a lot in the web development process? Is end-to-end testing important?
Compared with unit testing/integration testing, E2E testing can cover more test scenarios with less code, at the cost of insufficient testing detail.
It should be noted that not all projects are suitable for writing E2E tests. The following points can help you judge whether your project is suitable for E2E testing.
The project cycle is long. Writing E2E tests will consume a lot of time and energy. If it is not a long-term maintenance project, there is no need to make these investments.
The project iteration frequency is high. If the iteration intervals are very long and there is sufficient testing time and manpower, meticulous manual interface testing will be more reliable.
The page structure is stable. E2E testing generally relies on CSS/XPath selectors as a method of locating elements. If the DOM deconstruction of the page changes frequently, the cost of maintaining test cases will increase.
In addition, the effect of E2E testing is better in the following scenarios:
Purely static pages, preferably pages whose content does not change. You can take screenshots at the browser level and compare the screenshots of the two iterations before and after to determine whether the changes have damaged the final display of the page or whether the changes in display are consistent with expectations.
Compatibility testing. If you need to test the compatibility issues of the project under various browsers, you can use E2E testing to cover multiple different browsers at one time.
The interaction is complex and there are many interaction steps. For example, when filling out a complex multi-step form, the greater the manual operation cost, the greater the benefits will be brought by using E2E to automatically complete it. But be careful, like other tests, if your test process has data written, the written data should be cleared after the test is completed to ensure a consistent environment when running again.
Manpower may make mistakes, but machines are more stable. It is very important to release labor, especially for some core business pages. It is difficult to cover every situation, so E2E is to solve this problem.
However, if you use Angular, writing E2E is more fun
Compared with unit testing/integration testing, E2E testing can cover more test scenarios with less code, at the cost of insufficient testing detail.
It should be noted that not all projects are suitable for writing E2E tests. The following points can help you judge whether your project is suitable for E2E testing.
The project cycle is long. Writing E2E tests will consume a lot of time and energy. If it is not a long-term maintenance project, there is no need to make these investments.
The project iteration frequency is high. If the iteration intervals are very long and there is sufficient testing time and manpower, meticulous manual interface testing will be more reliable.
The page structure is stable. E2E testing generally relies on CSS/XPath selectors as a method of locating elements. If the DOM deconstruction of the page changes frequently, the cost of maintaining test cases will increase.
In addition, the effect of E2E testing is better in the following scenarios:
Purely static pages, preferably pages whose content does not change. You can take screenshots at the browser level and compare the screenshots of the two iterations before and after to determine whether the changes have damaged the final display of the page or whether the changes in display are consistent with expectations.
Compatibility testing. If you need to test the compatibility issues of the project under various browsers, you can use E2E testing to cover multiple different browsers at one time.
The interaction is complex and there are many interaction steps. For example, when filling out a complex multi-step form, the greater the manual operation cost, the greater the benefits will be brought by using E2E to automatically complete it.
But be careful, like other tests, if your test process has data written, the written data should be cleared after the test is completed to ensure a consistent environment when running again.
Manpower may make mistakes, but machines are more stable. It is very important to release labor, especially for some core business pages. It is difficult to cover every situation, so E2E is to solve this problem.
However, if you use Angular, writing E2E is more fun