The latest interface automation interview questions

1. What is the difference between get and post?

l HTTP is the upper layer request protocol, which mainly defines the interaction specifications between the server and the client. The bottom layer is the TCP/IP protocol.

l Get will append the parameters after the url, use? Split, & connect different parameters, Get obtains resources, Post will place the parameters in the http request body, and Post sends the request data

l Get generates one tcp data packet, and post generates two tcp data packets.

l Get request, the browser will send the http header and data together, and the server returns a 200 response code

l Psot request, the browser first sends the header, the server responds with 100 (continue), and then sends the data, the server returns a 200 response code

l Post is more secure than get. If the browser caches it, the get parameters will be left in the cache and the user can see the parameter information.

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

Application/x-www-form-urlencoded: Send parameters as a set of key pairs

Multipart/form-data: supports single and multiple groups of file uploads

Application/json: supports data types according to the definition of the backend interface

Text/xml

3. What do the http status codes 302, 403, and 503 represent?

302: Temporarily redirect to a certain page, such as a page that can only be entered after logging in. It will first be temporarily redirected to the login interface.

403: Insufficient permissions. The server understands the client's request, but rejects the request.

503: The server is currently unavailable, overloaded or under maintenance.

500: Server-side exception

404: The request failed. The requested resource was not found on the server.

401: Requesting authentication

1XX series: Specify certain actions that the client should take accordingly, 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 ones in this series are 200 and 201 status codes.

3XX series: Represents that the client needs to take further operations to complete the request. These status codes are used for redirection. The subsequent request address (redirect target) is specified in the Location field of this response. The most common ones in this series are 301 and 302 status codes.

4XX series: Indicates a request error. It means that an error may have occurred on the client side, which is hindering the server's processing. Common ones include: 401 and 404 status codes.

5xx series: It means that the server has an error or abnormal state during the process of processing the request. It may also be that the server realizes that it cannot complete the processing of the request with the current software and hardware resources. Common status codes are 500 and 503.

4. The company uses third-party services. When something goes wrong, we call the third party, but the third party refuses to acknowledge it. At this time, the log does not show any errors. What should we do?

1/ Call the third-party service separately and check the status, code, and msg returned by the third-party interface to see if it can support normal services.

2/ Mock the third-party service in your own application to call your own interface to see if it can work normally and feed the results back to the third party

3/ When configuring the log level to debug level, add the log of the third-party request process, view the input parameters, and respond to track the problem

5.How to deal with the association in interface automation?

Pass the result returned by the previous request into the parameters of the next request, reflect the result of the request to a class attribute (using the setattr() function), and call this class attribute on the next request

 

6.How to verify the results of automated testing?

Assertion, expected results compared with actual results

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

7.What is the testing framework used for automation? Briefly describe the design and maintenance of the automation framework

1/Test framework: python+unittest+requests+ddt+openpyxl+pymysql+logging

Test framework:

python: easy to get started, concise syntax

unittest: Define a test case class, specific methods to maintain the life cycle of the test case, test scenario behavior, test case pre-scenario, behavior, expected results, actual results, assertion method, Setup teardown method

requests: interface call, a library that supports http requests, the API is simple, provides different http request methods, supports sessions, cookies,

 ddt: data-driven, ddt class decorator, data test method decorator unpack unpacks iterable data types

Ordinary users, databases, configuration files --- (basic data)

openpyxl: Data management Excel manages data, use the openpyxl module to read and write excel data (excle, csv, json, yaml, txt can all manage test data)

 pymysql: database interaction, data verification

 eval, json: data format conversion Eval converts the formats supported by python into the corresponding format

Logging: log processing, unifies log output format, channel, level, and execution result recording to facilitate problem location

 jenkins: continuous integration

2/Framework design idea: data-driven + structural layering (readability, maintainability, scalability)

Data-driven: Separate maintenance data from code, interface calling behavior is consistent, drive different test scenarios for different parameter combinations, and reduce code redundancy

Structural layering: data layer + use case layer + logic layer

Data layer: support for test data data.xls

Use case layer: execution of use cases test_register.py test_recharge.py

Logic layer: encapsulation and extraction of public methods doexcle.py do_mysql.py http_requests.py logger.py and other modules

3/Framework design steps:

Prepare test data: EXCEL table preparation test case---reading excel data---replacement of parameter values

Initiate a request: request method (get/post method for encapsulation---URL splicing (different---parameters converted into dictionary

Get the return value of the request: parse the return value code, status, msg information

affirmation

  benefit:

1. The perfect combination of automated test cases and manual test cases to reduce duplication of work

2. Flexible configuration, you can switch test environments independently and execute test cases

3. Commonly used functions are encapsulated, with clear logic and easy maintenance.

4. Unified execution entry and management of test case sets:

The run.py module uses fuzzy search to select the test cases that need to be executed.

5. Continuous integration, scheduled construction, and rapid feedback

8, Specifically how automation is applied in practice in this project, and your analysis of the automation results

After completing the design and implementation of all automated testing frameworks, conduct interface testing, then integrate it into Jenkins, configure scheduled execution, generate HTML reports, check the test pass rate, and check the functions of the interface

Every time a version is released, regression testing is performed, and new features are developed before they are tested.

9. What is the key to a good test plan?

Clarify the purpose of testing, enhance the practicality of the test plan, ensure the practicality and coverage of test cases, complete requirements documents and specifications, etc., and strictly define the test cycle, test rounds, test coverage modules, etc.

20200617 Tianyu software first appearance:

1.The difference between post and get requests

2. Key points of interface test cases

3. How to establish the association between interfaces

4.How to store cookies

5. How to handle cookies and tokens during concurrency

6. How to deal with the failure of the three-party interface

7. How to carry out interface automation? Did you build the framework yourself?

First look at Kyushu Street

1. The difference between interface testing and functional testing

2. Key points in interface testing

3. How to carry out automated interface testing---how to design the framework

4. Reasons for resignation

5. Career tendency: Interface, performance, function, and underlying technical content are higher?

Thank you to everyone who reads my article carefully. There is always a courtesy. 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 [software testing] friends, and this warehouse also accompanies Thousands of test engineers have gone through the most difficult journey, and I hope it can help you!Friends in need can click on the small card below to receive it 

 

おすすめ

転載: blog.csdn.net/okcross0/article/details/134809136