What could cause errors in automated scripts?
Caused by configuration environment
- Configuration of automated test scripts.
- Configure the test program. For example: whether to restore the initial settings and whether to delete some data.
- Configure the browser.
- Configure programs related to testing programs or programs that affect script stability.
Caused by non-configuration environment
- Network latency, identifying object synchronization issues.
- An unknown factor caused the script to fail.
- An unknown factor caused the script to interrupt.
- The automation script itself uses instability.
- Inheritance of scripts, the failure of the previous script will cause the failure of the next script.
Improve stability
- To improve the stability of scripts, we must not only meet stability requirements, but also be compatible with different environments, platforms, etc.
- Stability, that is, the automated script can be reused and the script does not report errors, except for system errors.
- Compatibility means being able to run on different platforms and environments
solution
- In order to run the script repeatedly, data cleaning should be performed before and after running, which is divided into pre-cleaning and post-cleaning.
- Try not to hard-write the data. The solidified data is easy to be modified by others. Try to make the current execution unit configurable and maintain the data in a centralized manner. You can also rely on the dynamic generation of other interfaces to avoid the failure of the original hard-written data. .
- Script exception handling, adding a failed rerun mechanism, if a failure is encountered, set the number of retries
- Improve the stability of the environment, including the stability of the own environment and the stability of the third-party system environment (the test environment is separated and the operating environment can be flexibly configured)
- File paths must be compatible under Windows and Linux environments because the two systems have different ways of obtaining file paths.
- Exception capture processing, with exception skipping or marking
- Ensure the use cases are complete, independent, coupled, and can run independently
- Interfaces that rely on third-party services need to set a reasonable timeout period
- Continuously verify and maintain a certain running frequency, such as daily inspections, etc., to avoid long periodic maintenance time due to long periods of inactivity and insufficient script maturity.
Finally, I would like to thank everyone who has read my article carefully. Looking at the increase in fans and attention, there is always some courtesy. Although it is not a very valuable thing, if you can use it, you can take it directly!
Software Testing Interview Document
We must study to find a high-paying job. The following interview questions are the latest interview materials from first-tier Internet companies such as Alibaba, Tencent, Byte, etc., and some Byte bosses have given authoritative answers. After finishing this set I believe everyone can find a satisfactory job based on the interview information.