API test - interface test basis (1)

Because they want to learn to test aspects of the API, but the market can not search-related book learning system, online content and fragmented, a bit API for people to develop basic search. In order to test aspects of novices learn the API, now finishing the valuable experience of others and their own learning experience, try to include the basics API API test before you need to know in an article.

Interface test basis

1. What is the interface?

2. Interface Type

3. The nature of the interface

4. What is the interface to test?

5. Why do interface testing?

6. How do interface testing?

7. What interface test test points are?

8. The interface test what knowledge should be mastered?
----------------

1. What is the interface?

API: Application Programming Interface, an application programming interface that is

 

An API typically include:

 

         Method: Method Request

 

         URL: unique resource locator

 

         Params: Parameter

 

         Authorization: authentication

 

         Headers: header

 

         Body: message body

 

 

 

2. Interface Type

http api Interface

 

Http protocol to go through a path to distinguish between method calls, the request packets are key-value in the form of return message usually json string, there are other methods to get and post, which is the most commonly requested two ways.

 

API interface is generally divided into two types: internal programming interfaces and external systems interfaces

 

json is a common data type, all languages ​​are aware of it. (Nature json is a string, he has nothing to do with other languages, but can be converted through a slightly processed into data types other languages, such as can be converted into a dictionary in Python, key-value form, can be converted into JavaScript Native objects, class objects and the like can be converted into the java.

 

webservice Interface

 

Http transmission protocol to go through the soap, the request packet and return messages are xml format, we use call, in order to test the tool by the time of the test.

 

Database access interface

 

Database access interface is the way to go jdbc connection data, the database CRUD operations, require the use of tools for testing.

 

 

 

3. The nature of the interface

Interface can be simply understood as a different URL, URL works something sent to the server via get or post request, and then returns to give some corresponding value, is essentially a data transmission and reception.

 

 

 

4. What is the interface to test?

An interface test between the primary point of interaction for the system and the system between the external and internal subsystems. Stress test is to check the exchange data, and control transfer process management, and logical mutual dependencies between systems and the like. Short answer is to say through the URL to the server or other modules, we want to transmit data transmission, and then look at their expected return is not what we want.

 

 

 

5. Why do interface testing?

1. find the underlying bug, it is the lower cost of repair.

 

2. The front and rear end architecture many systems are separate

 

2.1 front-end casual change the interface test well, do not change the back-end, front and rear end are two sets of people development.

 

2.2 security inspection system, stability, mass participation untrusted front end, such as shopping Jingdong tip passes -1 membered possible price, but can pass through the interface element -1.

 

2.3 has been completely dependent on the distal end to be limiting system can not meet the security requirements (too easy to bypass the front), the rear end of the same need to be controlled, it is necessary to verify the level of the interface in this case.

 

2.4 front end of the transmission, whether to encrypt the log information transmission and print authentication is required, particularly in relation to the user's private information, such as identity cards, bank cards and the like.

 

3. The complexity of the system is now rising sharply increase the cost of traditional testing methods and a substantial decline in test efficiency, test the interface is relatively easy to automate continuous integration, and UI Automation also relatively stable, manual regression testing can reduce labor costs and time, shorten the test period, to support the back-end version of quick hair needs. Continuous integration interfaces can be the root of why the low-cost high-yield.

 

6. How do interface testing?

- the front and rear end call our project is mainly based on the http protocol interfaces, it is mainly through the tool or code to simulate http request to send and receive test interface. There are many tools such as: postman, jmeter, soupUI, java + httpclient, robotframework + httplibrary and so on.

 

- an interface can also be used to achieve automation, is implemented in code and UI Automation framework similar, by sending a request to the assertion determination.

 

7. What interface test test points are?

       Objective: to test the accuracy and stability of the interface;

 

  Principle: Analog client sends the server request message, the server receives the request packet to be processed on the client server returns a corresponding response packet, the client processes the received response;

 

  Key: switching, transmission, and control inspection data management processes, further comprising a number of processing;

 

  Core: Continuous integration is the core interface testing;

 

  Advantages: bring to the high complexity of the more complex and efficient platform for defects monitoring and quality control capabilities, the platform, the more massive the system, the greater the effect of interface testing (to improve test efficiency, enhance the user experience, reduce development costs);

 

  Key case design: Normally two outermost main test interfaces: Interface data into the system (external system call parameter using the present system) out of the system and the data interface (data authentication processing system is normal);

 

  Use case design also needed to pay attention to the external interface to external users use these interfaces what features users really need any external function

 

The main contents of the back-end interface testing:

 

 

 

 

 

app front-end test main elements:

 

 

 

 

 

FIG seen from the above comparison that two identical portions of the two testing activities functional test, boundary analysis and performance testing, due in part to the different needs of each other properties of interest, or a special test points, which is not discussed . Next we analyze for the same content more than three parts:

 

  1, the basic functional test:

 

  Because it is tested against the basic business functions, so this is the highest part of a two test coincidence degree, the development is also commonly referred to as the main content of this section.

 

  2, boundary analysis test:

 

  Consider the boundary conditions on the basis of the input and output of basic functional test on this part will be a repeat of the part (such as border business rules). However, inputs and outputs are often provided in the front end of the stick to let the user select a value (as a drop box), in this case the boundaries of the test is very limited, but there is no interface test this constraint, relatively speaking Interface can cover a wider range of the same, the probability of the interface problems are also higher.

 

  3, performance testing:

 

  This is relatively easy to distinguish, although performance testing needs to be done, but the focus really different. App end performance of major concern associated with mobile phone features, such as mobile phones cpu, memory, traffic, fps and so on. The interface performance focuses on the use of the interface response time, concurrent, server resources. Both strategies and methods when testing has a significant difference, so this part requires separately tested individually, in theory, this is a different part. 

 

  Comprehensive Discussion:

 

  1, app interface testing and testing activities, some duplicate content, mainly in the business function testing. In addition, for each test characteristics are not the same, the need for targeted testing, respectively, in order to ensure the quality of the entire product.

 

  2, interface testing can focus on server logic verification, testing and UI logic can focus on the page display and interface front-end server with integrated authentication

 

  3, interface testing Continuous Integration:

 

  For interface testing, continuous integration automation is the core, by means of an automated support we can achieve a low-cost high-yield. Currently we have realized the automation interfaces, mainly used in the regression phase, the follow-up also need to strengthen the degree of automation, including, but not limited to, the following:

 

   a) Process areas: strengthening the coverage of abnormal scene of the interface in the regression phase, and gradually to the system testing, smoke testing phase extension, and ultimately achieve full process automation.

 

   b) The results show: the results show a richer, trend analysis, statistics and quality analysis

 

   c) to locate the problem: error information, log more accurate, reproducible and easy to locate the problem.

 

   d) the results of the check: to strengthen the capacity of automated check, such as checking the database information.

 

   e) code coverage: constantly trying dropping from the current black box to white box, to improve code coverage.

 

   f) performance requirements: improve system performance testing, monitoring by means of an automated interface performance indicators are normal.

 

  4, interface testing quality assessment criteria:

 

   a) business function is complete coverage

 

   b) business rules covering is complete

 

   c) parameters to verify whether the requirements (border, business rules)

 

   d) an interface abnormal scene coverage is complete

 

   e) the interface has reached the coverage requirements

 

   f) whether the code coverage requirements

 

   g) performance meets the requirements

 

   h) meets the requirements of safety indicators

 

8. The interface test what knowledge should be mastered?

  ① understand the interaction between the business logic of the system and the various components inside;

 

  ② understand interface I / O (input / output: Input Output);

 

  ③ understand the basic content of the agreement, comprising: a communication theory, three-way handshake, common protocol type, packet structure, data transmission, common status code, URL like configuration;

 

  ④ common interface testing tools, such as: jmeter, loadrunner, postman, soapUI the like;

 

  ⑤ basic database operation command (check data storage, extracting test data, etc.);

 

  ⑥ common character types, such as: char, varchar, text, int, float, datatime, string and so on;  

 

  How to learn these skills?

 

  ① interaction between systems business logic: many channels and by way of requirements documentation, flow charts, mind maps, communication and so on;

 

  ② agreement: Recommended "graphic http" This book, the contents of vivid, relatively considered entry-level books, there are other "graphic tcp, IP" and so on;

 

  ③ interface test tools: Baidu these tools, then you will find that a lot of teaching blog, solution of problems, and some tool-based books, of course, it is important to choose the right book;

 

  ④ database operations command: Learning website (W3C, rookie tutorial), teaching blog, as well as a number of database-related books, entry-level recommendation: "mysql must know will be", "oracle PL / SQL must know will" and other

 

  ⑤ character types: Baidu still, there is a saying to say: in the matter undecided asked Baidu, undecided Foreign Affairs asked Google. . .

 

   How to obtain information about the interface?

 

  General business, will be written by the developer interface documentation or the corresponding technical staff in charge, which will specify the address associated with the interface, parameter types, methods, inputs, outputs and other information, and if not, find a way to get. . .

 

  Eight Elements interface documentation:

 

  Cover: Cover is best to cover the provisions of the Company, have logo, content title, version number, company name, document creation date;

 

  Revision history: a table in the form of some better, including: Version, Revised Edition, revision date, revision, checker time reviewer and so on;

 

  Interface Information: Interface invocation, common GET / POST mode, the interface address;

 

  Description: clear and concise description of interface functions, such as: interface to obtain information which is not included;

 

  Interface Parameter Description: Each parameter must be the same as the actual call, including the case; concise explanation of the meaning of the parameters, formats, is a string or int or long format;

 

  Description section, indicating that parameter values ​​are provided where required, and explain in detail how to generate parameters, such as time stamp, which is the time period, the parameters are required, some of the parameters that must be, and some are optional parameters;

 

  Return Value:

 

  ① best to have a template return value, and explain the meaning of each return parameter;

 

  ② call interface provides a real, real return value;

 

  Call restrictions, security:

 

  Encryption, or their own company a special encryption process, as long as both using the same encryption algorithm can call interface, ensure the safety of interface calls, such as common md5;

 

  Document Management: document when maintenance is subject to change Be sure to include the date of modification, change people, change the version number changes to have large;

————————————————

Disclaimer: This article is CSDN blogger "heyingxin006 'original article, follow the CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement.

Original link: https: //blog.csdn.net/heyingxin006/article/details/89957872

 


Disclaimer: This article is CSDN blogger "heyingxin006 'original article, follow the CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement.
Original link: https: //blog.csdn.net/heyingxin006/article/details/89957872

Guess you like

Origin www.cnblogs.com/tangsong41/p/12520571.html