[Software Testing] Several stages that must be paid attention to in high-quality interface automation testing

How to build an efficient interface automation testing system and effectively reduce maintenance costs is the core issue in the testing work. This article shares the thinking of testing experts. Welcome to leave a message to discuss

The fundamental goal of interface testing

In the test environment, ensure the correctness of the new interface function and the regression of the original interface (to ensure that the original interface will not be modified "bad");

In the production environment, ensure that the service at the interface level is available and the function is correct (to ensure that when the service hangs up, it will be discovered in time);

Degree of interface automation

1) If the project has no UI front-end pages at all, it should automate interface testing as much as possible (manual interface testing or automatic result judgment can use manual assistance);

2) If the project contains UI front-end pages, there should be as many automated interface tests as possible (manual interface tests or automated result judgments can use manual assistance); cooperate with front-end page tests to return to P1/P2 interfaces;

3) For scenarios with particularly complex business interaction inspection scenarios, scripts can be used to implement them (PS scripts are closely related to business at this time, and it is not suitable to make related scripts into frameworks);

In short, the degree of automation should be judged according to the characteristics of its own project, so that automation can be better combined with manual testing to complete quality assurance.

The role of interface automation testing

1) When the function can be tested manually and automatically at the same time, automation is only used to save manpower and time;

2) The function is more suitable for testing when automation is used, and automation can make up for the deficiency of manual testing;

3) When the function can only be tested manually (such as page UI inspection), automation seems a bit [powerless].

Guaranteeing correctness of interface automation functions (Phase 1)

This stage is mainly to ensure the correctness of the function provided. The so-called correctness means that the returned data is correct and the function is correct.
Stage characteristics: the most detailed inspection of the interface (the correctness of the interface returned json), QA's familiarity with the system and the interface, and the experience of the test itself directly affect the depth of the test at this stage.
Stage goal: In the test stage, directly use the interface script/manually check the correctness of the interface; in the production stage, regularly check the online interface (note: due to the detailed inspection of the interface, the scheduled tasks set at this stage should not be too frequent, otherwise the interface will be slightly If there is a change, or the interface function is unstable, an error will be reported)

Difficulties and key points:
Automated scripts mainly depend on QA's familiarity with the system and interfaces. It is likely that due to use case design problems, problems cannot be found when monitoring online interfaces.

Ease of implementation: ⭐️⭐️⭐️⭐️⭐️

Script change frequency: ⭐️⭐️⭐️⭐️⭐️

Script timing frequency: ⭐️⭐️⭐️

Interface Automation Data Correctness Guarantee (Phase 2)

  • This stage is mainly to ensure the correctness of the data provided. The so-called correctness means that the returned data is correct.

  • Phase features: Check the data returned by the interface (data correctness of the json returned by the interface). There are usually two inspection methods: directly query the DB, and compare and check with SQL; compare with the json returned by the interface of the previous version (at this time It is necessary to ensure that the interfaces of the two versions are identical except for the code branch, other configurations, DB, etc.)

  • Stage goal: In the test stage, directly diff the modified branch and the online branch to return json respectively (check method: under the same conditions, if the returned json is completely consistent, it means that the interface data is correct; otherwise, you need to check whether the difference is within the allowable range )

Difficulties and key points:

The automation script mainly depends on the encapsulation of the two json comparison interfaces, and the comparison of some parameters can be ignored, or only some parameters can be compared.

Ease of implementation: ⭐️⭐️⭐️⭐️

Script change frequency: ⭐️⭐️⭐️⭐️

Script timing frequency: ⭐️⭐️⭐️

Interface Availability Guarantee (Phase 3)

  • This stage is mainly to ensure the availability of the online interface. That is, if the interface returns something other than 200, it can be discovered in time.

  • Stage characteristics: This stage belongs to the monitoring of the interface. The detailed level of interface inspection can be determined according to the frequency of monitoring timing (generally speaking, the more frequently the monitoring runs, the detailed level of interface inspection will decrease. Otherwise, if the interface changes frequently or the interface is unstable, frequent alarms will be issued. ).

  • Phase goal: monitor the availability of the online interface to ensure that when the service suddenly hangs up, it can be monitored in time (of course, if the original online interface is almost unchanged and the interface function is stable, the interface automation script of the first stage can be used for this stage).

Difficulties and key points:

The detailed level of the interface check depends on the frequency requirement of monitoring timing and the stability of the online interface.

Ease of implementation: ⭐️⭐️⭐️⭐️

Script change frequency: ⭐️⭐️⭐️⭐️

Script timing frequency: ⭐️⭐️⭐️⭐️⭐️


Finally: In order to give back to the die-hard fans, I have compiled a complete software testing video learning tutorial for you. If you need it, you can get it for free【保证100%免费】

Software Testing Interview Documentation

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 Ali, Tencent, and Byte, and some Byte bosses have given authoritative answers. Finish this set The interview materials believe that everyone can find a satisfactory job.

Guess you like

Origin blog.csdn.net/IT_LanTian/article/details/131491599