First, why do front-end automated tests
-
Fixing these bugs takes a lot of time, and we have to stop working on other things. A rough estimate is that each Bug will cost the developer at least 30 minutes, not counting the time it takes to fix them.
-
All bug reports must be double-checked “by the developer himself or QA”.
-
Opportunity cost: The development team must wait until bugs are fixed before continuing to develop or release as planned.
-
Front-end bugs will directly affect user experience, leading to poor body sense of users, reducing users and even driving away potential customers in serious cases.
-
Some code vulnerabilities, not through the black box or white box automated test coverage, it is difficult to reproduce and check these problems in a limited time, especially when modifying the previous code.
-
Sometimes, the people who diagnose these bugs are not the people who developed them, which leads to developers spending more time because they are unfamiliar with the code.
Two, front-end automation test classification
**1. Unit test **
Unit testing: Refers to the examination and verification of the smallest testable units in an application, usually by independently testing a single function
Consider a scenario where you want to remodel an old front-end framework and develop a new backward compatible framework based on it. At this point, the old framework wrote sufficient single test cases for its internal API functions. So, when developing the new framework, run the single test cases of the old front-end framework directly, so that all test cases PASS (PASS), it can quickly ensure the consistency of internal API functions, and quickly verify all functional scenarios.
2. Integration testing
Integration testing: testing how different modules (components) in an application integrate and work together. This, as its name suggests, is used to ensure proper collaboration between different components.
**3. UI test **
UI testing: Is the testing of graphical interactive interfaces. The UI layer is the entry point for the user to use the product, and all functionality is provided to the user through this layer.
For example: now you want to compare whether the “visual style of a particular page” strictly meets the “visual design produced by the designer”, which involves UI testing. Generally, it involves the comparison of UI snapshots (screenshot).
End to End (E2E) testing/functional testing: Testing from the user’s point of view, treating our application as a black box to ensure that the entire application will perform as expected.
Three, business automation test to grasp the core point
In a continuous integration process, testing typically occurs in the following three phases.
-
Unit tests are useful in the coding phase, where developers test their own logical code.
-
The middle stage of development is about being able to stop as soon as a problem is found. Integration testing, UI testing, and end-to-end testing are all available.
-
The production phase (before it officially impacts users) is primarily about running a subset of the functional test suite called “smoke testing” to ensure that there are no exceptions due to changes in dependencies and so on at deployment time.
-
That’s what students do. As good developers, we are expected to ensure that our code is robust and forward extensible.
-
Unit test code is redundant. Whether the overall function of the software system is normal or not is strongly related to the test of each unit component.
-
Unit test code does not need to be maintained. A year and a half later, unit testing is almost obsolete.
-
Unit tests are not dialectically related to online failures. Good unit testing minimizes online failures.
4. Core tool recommendation
V. Conclusion:
Read more: