Testing Ideas - Integration Testing About Interface Testing Part 2

5. Use case design ideas (illustration)

As shown in the above table, it is an interface in an interface description document, course retrieval, where "v1/Lesson/testsrch/?" is the address of the interface call, in addition, the interface function output (ie Server Response) and return value are also given.

Q: How to design?

Answer: The idea should be like this

1. Understand needs

Customer requirements -> business requirements -> test requirements, and the design of interface test cases is no exception. To get the interface, you must first understand what the main function of the interface is for, and what business can be realized by calling it. As mentioned above, the interface function: course retrieval

2. Understand interface parameters

For each parameter, it is necessary to understand their respective meanings. In addition to the simple description on the interface document, it is also necessary to understand its real function. According to my personal point of view, if you want to better understand interface parameters, you should think more about the operation process (or business process) and the scene, and try to map the corresponding operation data or input steps to the interface function.

Example:

Scenario (operation process), general field, for data query operations: enter keywords, and then click query, as shown in the figure

Immediately afterwards, if there is a record with matching data, it will be displayed in the list, and if the page exceeds one page, a page turning operation will appear below the list, and the current page will be displayed, as shown in the figure

Explanation: In practice, product demos or requirements manuals are often not provided. At this time, it is necessary to combine our personal experience or life experience to think about it. It would be better if there is one.

Well, looking back at the interface parameters, it is very clear now

k string The keyword to retrieve, as shown in the above picture, is the query content we entered "interface test"

pageIndex int The current page number, as shown in the picture above, we know that it has a very important function to turn pages

pageSize int The number of pages per page. Although the above figure does not provide page capacity settings, it actually hides the number of records displayed on each page

3. Focus on interface output

It is not enough to only pay attention to the input of interface parameters, but also pay attention to the output of the interface, especially when the output result is not unique: the following course retrieval output.

4. Find test points

remember,

1. Mainly based on step 2 (input) and step 3 (output)

Mining test points and test data according to steps

Example:

Test point: query content k (type > Chinese, English case, number, special character; length > whether the number of characters is limited; whether it can be empty > do not enter, that is, ""; the query content exists; the query content does not exist)

Test point: page turning pageIndex (current page, non-current page, non-existent next page, non-existent previous page, if you provide manual input page number, and then jump, you have to consider fault tolerance such as negative numbers)

Test point: page display record number setting (default; limit the number of display records per page; turn the page to a page that does not exist)

Test point: processing and output of resources (video decoding; review; deletion; whether it is a boutique recommendation judgment)

Second, according to the interface parameters themselves

1. Type -> Can you pass parameter values ​​that do not match the type;

Number -> Can some parameters not be passed;

Type -> Can you pass parameters of different types, for example, if the requirement is int, if you pass in a string type or if you require a string type, you need to pass in an int

Type value > Can you pass a value that exceeds the parameter type? For example, the range of signed int is -32768~32767, while unsigned 0~65535, what about passing 65536?

Notice:

1. Some of 1 and 2 are crossed, and their relationship is complementary

2. You must know that testing is inexhaustible and requires time and cost. It will take a lot of time if every parameter and every situation needs to be carefully tested. Therefore, it is necessary to consider a compromise, consider whether the test data is meaningful, and make an appropriate trade-off, especially when time is limited.

5. Design use cases based on test points

This is the same as the functional design use case. Arrange priorities reasonably, first design common use cases, typical operation process, typical business scenario use cases, and then design use cases such as abnormal fault tolerance.

6. Test method

Functional test case design methods are applicable

Guess you like

Origin blog.csdn.net/NHB456789/article/details/131006654