Interface automation test interview questions (suitable for software testers at all levels)

foreword

This article is organized by Xuzhu! The content is awesome! Very helpful to me too. This article is only for sharing~

material

Due to space reasons , there are still many interview questions for Python automated testing that cannot be shared. I organized the interview questions into documents and shared them in my own automated testing communication community. Click here to join the community to receive .

Now let's get to the point - interface automation test interview questions

1. What is the difference between get and post?

  • http is the upper-layer request protocol, which mainly defines the interaction specifications between the server and the client, and the bottom layer is the tcp/ip protocol
  • Get will append the parameter to the url, use ? Split, & connect different parameters, Get gets the resource, post will place the parameters in the http request body, and Post sends the request data
  • Get generates one tcp packet, post generates two tcp packets
  • Get request, the browser will send the http header and data together, and the server returns a 200 response code
  • For Psot request, the browser first sends the header, the server responds with 100 (continue), and then sends the data, and the server returns a 200 response code
  • The security of Post is higher than that of get. If the browser caches, it will leave the get parameters in the cache, and the user can see the parameter information.

2. What do the HTTP status codes 302, 403, and 503 represent?

  • 302: Temporarily redirected to a certain page, such as a page that can only be entered after logging in, he will first be temporarily redirected to the login interface
  • 403: Insufficient permission. The server understands the client's request, but rejects the request
  • 503: The server is currently unavailable, overloaded or under maintenance
  • 500: Server exception
  • 404: The request failed, the requested resource was not found on the server
  • 401: Authentication requested
  • 1XX series: Specify certain actions that the client should take correspondingly, indicating that the request has been accepted and needs to continue processing
  • 2XX series: Indicates that the request has been successfully received, understood, and accepted by the server. The most common in this series are 200 and 201 status codes.
  • 3XX series: Represents that the client needs to take further action to complete the request. These status codes are used for redirection, and the subsequent request address (redirection target)
    is indicated in the Location field of this response. The most common in this series are the 301 and 302 status codes.
  • 4XX series: Indicates a request error. Indicates that an error may have occurred on the client side, preventing the server from processing. Common ones are: 401, 404 status codes.
  • 5xx series: It means that the server has an error or abnormal state in the process of processing the request. It is also possible that the server realizes that the current software and hardware resources cannot complete the processing of the request. Common status codes are 500 and 503.

3. How to verify the results of automated testing?

Assertions, expected results compared to actual results

Database verification, according to the test scenario to query the data in the database and compare the data before the request.

4. What are the four parameter forms of the post request?

  • Application/x-www-form-urlencoded: Send parameters as a set of key pair values
  • Multipart/form-data: supports single-group and multi-group file uploads
  • Application/json: supports data types according to the definition of the backend interface
  • Text/xml

5. The process of interface automation testing?

The basic interface function automated testing process is: requirement analysis –> use case design –> script development –> test execution –> result analysis

6. What are the common tools for interface testing?

  • Postman
  • JMeter
  • SoapUI

7. What are the request parameter types of the HTTP interface?

  • Query string parameters (Query String Parameters) are generally used for GET requests and will be passed in the form of url string
  • Request Body is generally used for POST requests, and Content-Type can be used to specify different parameter types

8. How to get the relevant response data from the previous interface and pass it to the next interface?

First obtain the corresponding return value from the response data in the previous interface, then use regular expressions or JSON parsing to extract the value to be obtained, then store it in a variable, and finally refer to the variable directly in the next interface.

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

  1. Required fields: request parameters required, optional
  2. Legality: input and output legal and illegal parameters
  3. Boundary: request parameter boundary value, etc.
  4. Fault tolerance: processing of large-capacity data, frequent requests, repeated requests (such as orders), abnormal networks, etc.
  5. Response data verification: assertion, data extraction is passed to the next level interface...
  6. Logic check: If the two requested interfaces have a strict sequence, it is necessary to test the situation of reversing the order
  7. Performance: Simulate concurrent tests on interfaces, gradually pressurize, and analyze bottleneck points
  8. Security: Construct malicious character requests, such as: SQL injection, XSS, sensitive information, business logic (eg: skip certain critical steps; manipulate sensitive data without verification)

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

Depends on the most stateful interface. In essence, every time a request is sent, you need to bring a session or cookie that stores valid account information to send it successfully. Add the necessary session or cookie when constructing a POST request.

11. How to test interfaces that depend on third-party data?

You can use some MOCK tools (such as: JSON Server, Easy Mock) to simulate the data return of the third party, and minimize the dependence on the third-party data interface

Guess you like

Origin blog.csdn.net/qq_40214204/article/details/114693756