Ten minutes to take you to understand the interface test, 2023 the most complete ultra-large interface test strategy

1. What is interface testing?

The so-called interface refers to the data transmission interface between modules in the same system, front-end and back-end interaction, and cross-system, cross-platform, and cross-database connection. The interface test is to compare the output through the input of the interface in different situations to see whether it meets the functional, security and performance requirements stipulated in the interface specification.

2. Why do interface tests?

1. Compared with system testing, intervene in testing earlier to improve efficiency

2. You can find problems that cannot be tested by the front end and improve the quality of the version

3. The interface is standardized, it is easier to realize automation and continuous integration, and reduce the cost of testing

Therefore, in the requirements of software testing recruitment positions, whether it is functional testing, automated testing, performance testing or test development positions, interface testing must be mastered!

3. How to carry out interface testing?

The development of interface testing generally includes five parts: interface document analysis, interface use case design, implementation of interface use cases, locating bugs, submitting and tracking, and outputting interface test reports.

1. Interface document analysis

Interface documents are generally provided by back-end development, which can be online swagger or word.

If the development does not provide interface documents, you can use the packet capture tool fiddler or charles to capture interface information for analysis and interface testing.

After obtaining the interface document, we need to sort out the request and response information contained in each interface, which can be summarized into five elements of interface information:

1) Interface address url:

http-request protocol, api.lemonban.com-domain name or ip, 8765-port number, /futureloan/member/register-resource path

2) Request method:

See what the request method defined by the development is, and what method is applied to the test. Common request methods in restful style are post, get, put, patch, delete, etc.

3) Request header:

Send a request to the server, including header information. Common content-types.

4) Request body:

Send a request to the server, specifying the data to be passed. For example, to complete the call of the registration interface, the request body includes mobile phone number mobile_phone, password pwd, username reg_name, and verification code verification_code.

5) Response content:

Comparing the response content described in the interface document with the actual result of the interface test, it can be judged whether the current interface is passed. The response content includes: response code-http status code, response header, and response body.

2. Interface use case design

Interface use case design and functional test thinking are interlinked, need: 1) clear project business 2) use 8 major methods of use case design: equivalence class, boundary value, scenario method, cause and effect diagram, decision table, orthogonal test method, state transition method, wrong guesswork.

The following is the interface use case template reference:

3. Execute interface use cases and conduct interface tests

Interface testing principle: Simulate a process in which the client sends a request to the server, the server receives the request and processes it, returns a response to the client, and the client receives the response.

According to the principle of interface testing, it is known that tools or codes are needed for interface testing. Mainstream interface testing tools Jmeter, postman. Using tools to write scripts needs to be designed in conjunction with the specific application scenarios of the interface project, using technologies such as association, parameterization, and assertion.

4. Find bugs, locate, submit and track

How to judge whether it is a bug?

1) The response result in the interface test is wrong, and the wrong code and msg information are returned:

  • Judging the request: whether the request address, method, request header, and request body are correct, if not, modify the corresponding request information and send it again; if correct, it means that it is a server-side problem

  • Further check server logs, database information, and organize information to submit bugs

2) In the interface test, the response result, code and msg are correct, but the returned data is incorrect:

  • Check the correctness and integrity of the database data, and combine the server logs to sort out the information and submit bugs

3) The response result in the interface test is correct, but if the business operation is added, deleted or modified:

  • It is necessary to further confirm the correctness of data addition, deletion and modification at the database level

4) Consider security: the general interface will impose some restrictions on requests, such as the number of requests and the frequency of requests; whether sensitive information is encrypted

5. Interface test report

The organization of the interface test report depends on the company's requirements. Some companies compile a unified test report after the entire project test is over. Some companies will require the output of periodic test reports.

4. Common interview questions for interface testing

  1. What is an interface?

  2. If the module requests http to https, how should the test plan be formulated and modified?

  3. What is the proxy tool for debugging with HTTP protocol? Explain in detail the setup process for crawling HTTPS protocol?

  4. How to clean up the garbage data generated by the interface?

  5. The request parameters of the next interface depend on the return data of the previous interface?

  6. What are the steps of interface testing?

  7. How to test the interface that depends on the login status in the interface test?

  8. How are interfaces that depend on third-party data tested?

  9. How to handle the file upload interface?

  10. Explain what is SOAP?

  11. Explain what is a REST API?

  12. What types of bugs are found by API testing?

  13. Which class is the interface we are testing?

  14. Tell me how to locate your interface testing problem?

  15. Where are cookies saved?

  16. What request methods does HTTP have?

  17. The process of interface automation testing?

  18. What are the main points of writing interface test cases?

  19. Mention the key difference between UI level testing and API testing?

  20. How does HTTPS work?

  21. What is the difference between HTTPS and HTTP?

  22. What is the difference between POST and GET?

  23. What is the difference between Session and Cookie?

  24. What is the difference between TCP and UDP?

  25. What are the common protocols tested in API testing?

  26. The difference between Jmeter and postman tools?

  27. Tell me how the interface tool operates the database?

  28. What are the other formats of the parameter data besides the json format?

  29. How to test when there is too much interface test data?

  30. How do you request parameter encryption?

  31. What impressive bugs are there in interface testing?

  32. How many interfaces have been tested in the project? How many use cases have you written?

Guess you like

Origin blog.csdn.net/a448335587/article/details/129937998