Porter lets you understand web interface testing in minutes

01. What is an interface

Baidu said: Interface generally refers to an abstraction that an entity provides itself to the outside world (it can be another entity), which is used to separate the external communication method from the internal operation, so that it can be modified internally without affecting the interaction with other external entities The way

The above sentence is a bit abstract, and there are a lot of information on the Internet. It comes from a popular explanation from a big guy:

  • The interface of the design concept
    is a series of conventions, which can be both behavioral conventions and appearance conventions (for example, national standard plugs and American standard plugs have the same behavioral conventions but different appearance conventions).
  • The interface at the programming language level is generated to achieve the design requirements, and the interface can be any combination of
    methods, properties, events, and indexers.

From a program perspective, the interface habit is not called API (application programming interface), which can be roughly divided into two types: program interface and protocol interface.

  • Program interface
    (also can be regarded as a program module interface, specific to the program generally provides input and output classes, methods or functions, generally need to use the same language as the development program interface)
  • Protocol interface
    (generally refers to the interface provided by the system through different protocols. This type of interface encapsulates the underlying code and provides external calls through the protocol, which is not limited by the language)
Development so far includes:
①, operating system interface
②, web interface
③, application program interface
④, database interface
...

They may not be much different in essence, let’s divide them into categories, we will focus on the web interface here

02. What is interface testing

Interface testing is a test for testing the interface between system components; interface testing is mainly used to detect the interaction points between external systems and systems and between internal subsystems; the focus of testing is to check data exchange, transmission and control management process, and the mutual logical dependencies between systems, etc.

Interface testing is also a complete testing system, which is also divided into interface function testing, interface performance testing, interface stability testing, and interface security testing. Analogous to functional testing, there is a popular explanation: interface testing is to judge whether the interface meets or meets the corresponding functional and security requirements by testing the corresponding output parameter information of input and participation in different situations

Referring to the above article, common web interfaces:

  • webService interface:
    It is packaged with soap protocol and then transported by http. The request message and return message are both in xml format. We only use passing tools to call and test when testing. The tools that can be used are SoapUI, jmeter, loadrunner, etc.
  • Http api interface:
    directly use the http protocol to transport, and distinguish the method of calling through the path. The request message is in the form of key-value, and the returned message is generally a json string. There are methods such as get and post, which are also the most commonly used Two request methods. Tools that can be used include postman, RESTClient, jmeter, loadrunner, etc.

In web applications, the customer service needs to communicate with the server, that is, the front-end and the back-end communicate through the interface; according to whether it is an external interface, web interface testing can be divided into two categories: server interface testing and external interface testing.

03. The importance of interface testing

The earlier a defect is found in the software development life cycle, the lower the cost of correcting the defect will be. Therefore, testing should be involved earlier, and interface testing is a way to intervene early.

Why do you need to do interface testing after functional testing? The above two articles make it very clear:

  • Without relying on the front-end page, you can find many bugs that cannot be found by operating on the page
  • Check the system's exception handling capabilities
  • Check the security and stability of the system
  • The front end can be changed at will, the interface is tested, and the back end does not need to be changed
  • Generally, automation can be integrated, which can improve test efficiency and be used for smoke testing and regression testing

Of course, due to the particularity of interface testing, it is necessary to rely on some testing tools or codes to simulate the sending and receiving of http requests, which has higher requirements for testers.

04. How to do interface testing

Interface testing also belongs to functional testing, and each company's process or focus may be different.

The first lightweight test solution

1. Analyze the test requirements and get the interface documentation provided by the development;

2. Organize the interface test cases from the interface description document , which should include detailed input and output parameter data, as well as clear format and checkpoints;

3. Review the interface test cases together with the development;

4. Combining with the development library, prepare the input and output parameter data in the interface test case, and organize them into test cases;

5. Execute test cases and feedback interface test results.

The second similar functional testing process

(Interface Document—>Interface Test Plan—>Interface Test Case—>Interface Test Execution—>Interface Test Report):

1. Interface document

Similar to the requirements document, the project team leader formulates the relevant interface specifications, and the developers change and maintain them together, which should include interface descriptions, methods, uri (request address, url is a subset of uri), request parameters, and return parameters.

2. Interface test plan

Similar to the test plan, the 5w principles include test purpose, test plan, test scope, test resource arrangement, schedule arrangement, risk control, etc.

3. Interface test cases

Test case design, according to the interface document, mainly analyzes the request parameters, including passability test cases, multi-business scenario test cases, etc.

4. Interface test execution

To execute an interface test case is to request the interface, verify the return parameters, and may also need to prepare test data.

5. Interface test report

Timely feedback test results, such as blocked tests, failed tests, etc.

05. Interface automated testing

After doing the interface test, you can integrate interface automation by the way, so is the project suitable for automation?

  • The demand is stable and will not change frequently
  • Multi-platform operation, combined traversal type, a large number of repetitive tasks
  • The software maintenance cycle is long and has vitality
  • The development of the system under test is more standardized and testable (if there is no interface document, you know...)
  • adequate human resources

Applicable scenarios for interface automation testing:

  • Development self-test, smoke test:
    After the development of a new automated interface test case is completed, it will be sent directly to the corresponding development of the interface, and arranged to be executed in the development local environment. Once the development confirms that the interface development is completed, the interface test case will be executed. Basically The test results can be obtained in real time, which is convenient for development to make quick judgments.
  • Regression testing:
    After the development of the local test is passed, or after the manual test of the entire requirement is passed, the automated interface test cases are sorted, and the cases that need to be included in the regression test are selected to improve the test efficiency. !

The following is the supporting information. For friends who do [software testing], it should be the most comprehensive and complete preparation warehouse. This warehouse also accompanied me through the most difficult journey. I hope it can help you too!

Software testing interview applet

The software test question bank maxed out by millions of people! ! ! Who is who knows! ! ! The most comprehensive quiz mini program on the whole network, you can use your mobile phone to do the quizzes, on the subway or on the bus, roll it up!

The following interview question sections are covered:

1. Basic theory of software testing, 2. web, app, interface function testing, 3. network, 4. database, 5. linux

6. web, app, interface automation, 7. performance testing, 8. programming basics, 9. hr interview questions, 10. open test questions, 11. security testing, 12. computer basics

method of obtaining:

Guess you like

Origin blog.csdn.net/jiangjunsss/article/details/131700785