Explosive compilation, frequently asked interface automation testing interview questions + answers (detailed)


Preface

Interview question: How do you do interface testing?

Generally speaking, it goes through the following processes: interface requirement research, interface test tool selection, interface test case writing, interface test execution, interface test regression, and interface test automation continuous integration.

Specifically, the interface testing process is divided into the following nine steps:

Step one: Analyze the test requirements and ask the developer to provide interface documentation;

Step 2: Organize the interface test cases from the interface description document, which should include detailed input parameters (normal conditions, abnormal conditions include the number of input parameters, type, optional/required, consider whether the parameters are mutually exclusive or related situation) and output parameter data (in line with interface document requirements) as well as clear formats and checkpoints;

Step 3: Review the interface test cases with development;

Step 4: Combined with the development library, prepare the input parameter data and output parameter data in the interface test case, and organize them into files in Excel format;

Step 5: Combine the interface test case document and the data document in Excel format to write the business logic code for the interface automation test;

Step 6: Start executing the interface automated test case;
Step 7: If there are bugs in the execution, submit it to the defect management platform;
Step 8: After the development and modification is completed, return the bug and track the status;
Step 9: Continue the automation after completion integrated;

Interview question: How to design test cases for interface testing?

Interface use cases are mainly designed from four aspects: function, business logic, exceptions, and security.

Function: Whether it meets the requirements
1) From the user's perspective, whether the interface can achieve business requirements and whether the function is normal;
2) Whether the function is implemented in accordance with the interface document;

Business logic: whether it depends on business
1) interface implementation logic;
2) business logic coverage (statement/condition/branch/judgment/…);

For example: Before calling this interface, you need to call the login interface. If you can request data without logging in, it does not comply with the business logic.

Exceptions: Parameter exceptions and data exceptions
1) Parameter exceptions: keyword parameters, parameters are empty, more or less parameters, wrong parameters;
2) Data exceptions: keyword data, data are empty, lengths are inconsistent, wrong data;

For example: Regardless of data anomaly or parameter anomaly, the test points are similar. A parameter has key and value. Key represents the parameter and value represents the data.

First: Check whether the parameters and data can support keywords, such as reserved keywords in Java, etc.;

Second: the parameters and data are both empty, see if the judgment has been made; third, whether there are more or less parameters, for example, for an interface with two parameters, you need to design a use case with three parameters and a use case with only one parameter. .

The data length is inconsistent, for example, whether the design of a very long string is supported, because the length of each field is set during the database table creation process. Enter incorrect parameters and data, such as intentionally entering wrong words, etc.

Security test case design:

1) Cookie: Only with cookies can data be obtained. If information is returned without cookies, it means there is a problem;

2) Header: The normal interface carries header information. Delete the header to see if the data can be returned;
3. Unique identification code: The app mobile phone identification code, which is generally unique;
3) SQL injection and XSS attacks in the text input box.

Interview question: Is it necessary to compare the database during interface test execution?

The return key fields and field values ​​of the interface need to be verified, otherwise the interface test will be meaningless. There are generally two methods:

1) Database preset data, interface verification returns;
2) Interface call, compare database query results.

Interview question: What are the quality assessment criteria for interface testing?

Generally speaking, it is evaluated from the following eight aspects:

Whether the coverage of business functions is complete;
whether the coverage of business rules is complete;
whether the parameter verification meets the requirements (boundary, business rules);
whether the coverage of interface exception scenarios is complete; whether
the interface coverage meets the requirements;
whether the code coverage meets the requirements;
whether the performance indicators meet the requirements ;
Whether the safety indicators meet the requirements;

Interview question: How to clean up the garbage data generated by the interface?

For data creation and data cleaning, you need to use Python to connect to the database and perform pre-operations of test cases for adding, deleting, modifying and checking operations.

1) setUp does data preparation post-operation;
2) tearDown does data cleaning;

Interview question: Other interfaces need to obtain interface information first. How to make the login interface only called once in other interfaces?

The solution is as follows:

Use singleton mode;
use custom caching mechanism;
use setup mechanism in test framework;
fixture mechanism in pytest;

Interview question: From what aspects should interface test assertions be designed?

Interface test assertions can be designed from the following five aspects:

1) Response code: Check whether the response code meets expectations and use it to determine whether the test case is executed successfully (for http interface)

2) Keywords: Verify whether the keywords meet expectations and are used to determine whether the test case is executed successfully;

3) Regular matching: When an interface returns a lot of content and there are certain patterns, regular expressions can be used to verify the information returned by the interface to determine whether the test case is executed successfully;

4) Database matching check: For example, when verifying the data returned by querying an interface, you can query the results by writing a sql statement, and then check the results returned by the database after the sql statement is executed with the results returned by the interface to determine the test case. Whether the execution is successful;

5) Auxiliary verification through relevant interfaces: For example, when testing a deletion interface, after deleting a record, if you want to verify that the record is really deleted, you can call the query interface. If the deleted record is not queried, it means it has been deleted. This record is successful.

Interview question: How to test interfaces that rely on third-party data?

You can use some Mock tools (such as JSON Server, Easy Mock) to simulate third-party data return and minimize dependence on third-party data interfaces.

Mock service refers to replacing some complex (or not easy to construct) objects with a virtual object during the testing process.

For example, if there are two interfaces A and B, A needs to call interface B to complete the business requirements. At this time, the B interface has the following three situations:

1) The B interface has not been developed yet: you need to wait for the interface data to develop. At this time, the complete interface Mock service can greatly shorten the development and joint debugging waiting time.

2) Some scenarios of B are difficult to simulate: such as timeouts, unknown errors or unstable third-party interfaces.

3) Isolate the B interface (third-party interface) during performance testing: You will encounter problems when performing stress testing.

The following is the most comprehensive software testing engineer learning knowledge architecture system diagram in 2023 that I compiled.

1. Python programming from entry to proficiency

Please add image description

2. Practical implementation of interface automation projects

Please add image description

3. Web automation project actual combat

Please add image description

4. Practical implementation of App automation project

Please add image description

5. Resumes of first-tier manufacturers

Please add image description

6. Test and develop DevOps system

Please add image description

7. Commonly used automated testing tools

Please add image description

8. JMeter performance test

Please add image description

9. Summary (little surprise at the end)

No matter how hard it is, keep moving forward; no matter how deep the difficulty is, keep moving forward. When the flame of struggle ignites, dreams will illuminate the road ahead. If you keep working hard and struggling, you will surely create your own glory!

Have faith, chase your dreams, and water the flowers of success with your sweat. Every struggle is the seed of harvest, and unremitting efforts will surely open the door to your glory! Believe in yourself, you can do it!

Persevere in difficulties and face challenges bravely; rise after failure and continue to pursue excellence. The journey of struggle is full of hardships, but only by continuous efforts can we reap the glory and success in life! Believe in your own strength and never give up!

Guess you like

Origin blog.csdn.net/shuang_waiwai/article/details/133382905