A summary of the most easily encountered interface automation testing problems

This article shares a summary of the problems encountered in the process of writing interface automation use cases, and hopes to provide a small number of ideas for solving problems for small partners who are exploring interface automation testing for the first time.

Error in sql statement content

Space: Since some fields are judged to be variables, sql needs to be spliced ​​together, but no space is added when splicing strings, resulting in an error.

Error status: It is easy to check after printing it out. When the and is connected with the time, it turns out that there is an error here:

After modification, the content in the database can be read:

sql statement format error

Some retrieval types need to be quoted, because the sql statement contains the XXXX type. For the date type in the above example, datetime.date, it is not feasible to use qiandao = t_date directly.

Assert the type of the returned data

When judging the business status code, you need to pay attention to the type of the returned code value. The development may write int or string types that are not uniform. The PHP language int/string distinction is not very strict, but python has a distinction, so it needs to be written in combination with the server code, such as :

Business logic coverage judgment

A certain interface logic will definitely judge and return different values ​​under different conditions, just like a game upgrade.

When constructing, we must first construct the conditions of the test environment, or make judgment assertions on the test environment and results after knowing the judgment conditions.

The following example includes the above two inspection methods. It is not convenient to disclose here. The construction of the environment is unified in Chinese first, and the function is called corresponding to the corresponding environment.

The judgment of the number of days of registration time for which the result is known is judged in the assertion. Such as:

Need to encapsulate api

For example, the time a few days ago is judged according to the natural day or according to the time interval, the conversion of decimals and the encapsulation, the addition, deletion, modification and encapsulation of the database & redis, etc. Said it was very practical.

The most important point here is to be able to understand your own needs and think of ways to split and implement them in more detailed steps.

For example, of course, there are operations on hash types, etc. Another important point is to write clear comments to facilitate calls and other people's calls:

end


Finally, I would like to thank everyone who has read my article carefully. Watching the rise and attention of fans all the way, there is always a need for ritual exchanges. Although it is not a very valuable thing, if you can use it, you can take it directly.

These materials should be the most comprehensive and complete preparation warehouse for friends who do [software testing]. This warehouse has also accompanied me through the most difficult journey. I hope it can also help you! Everything should be done as early as possible, especially in the technology industry, and the technical foundation must be improved. I hope to be helpful…….

Guess you like

Origin blog.csdn.net/jiangjunsss/article/details/124297541
Recommended