CN113312260A - Interface testing method, device, equipment and storage medium - Google Patents

Interface testing method, device, equipment and storage medium Download PDF

Info

Publication number
CN113312260A
CN113312260A CN202110588287.4A CN202110588287A CN113312260A CN 113312260 A CN113312260 A CN 113312260A CN 202110588287 A CN202110588287 A CN 202110588287A CN 113312260 A CN113312260 A CN 113312260A
Authority
CN
China
Prior art keywords
interface
request message
tested
test
information
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202110588287.4A
Other languages
Chinese (zh)
Other versions
CN113312260B (en
Inventor
刘耀文
蔡启泉
曾欣
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
CCB Finetech Co Ltd
Original Assignee
CCB Finetech Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by CCB Finetech Co Ltd filed Critical CCB Finetech Co Ltd
Priority to CN202110588287.4A priority Critical patent/CN113312260B/en
Publication of CN113312260A publication Critical patent/CN113312260A/en
Application granted granted Critical
Publication of CN113312260B publication Critical patent/CN113312260B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3692Test management for test results analysis

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The text belongs to the field of automatic program design, and particularly relates to an interface testing method, device, equipment and storage medium, wherein the method comprises the following steps: acquiring an interface test instruction, wherein the interface test instruction comprises at least one interface to be tested and a test parameter corresponding to each interface to be tested; determining a request message template corresponding to each interface to be tested according to the interfaces to be tested; generating a request message case corresponding to each interface to be tested according to the request message template and the test parameters; and sequentially executing the request message cases to finish the test of each interface to be tested, so that the test efficiency of the interface test can be improved.

Description

Interface testing method, device, equipment and storage medium
Technical Field
The present disclosure relates to the field of automatic programming, and more particularly, to a method, an apparatus, a device, and a storage medium for testing an interface.
Background
In the prior art, the interface test is actually a simulation caller, and the correctness and fault tolerance of the tested interface are detected through interface communication. And simulating front-end logic on the client and calling an interface provided by the server. The interface test generally comprises a manual test and a tool automatic test, the manual interface test generally uses a simulation tool to send a tested message manually according to the interface protocol and the message format requirement of the tested system, and the manual test of the interface can be completed by carrying out manual or system automatic judgment on the received response message. However, when the test is performed next time, due to the requirement of data constraint, the normal test may be performed only by updating part of the data used in the previous message, so the manual test efficiency is very low.
The interface automatic testing tool has the advantages of visualizing an interface case compiling interface, supporting multiple protocols and the like, however, when a large number of transaction codes and interface cases are faced, the interface cases are created, a lot of repeated operations exist, preorder business systems are required to be sequentially executed when the interface cases are created, and corresponding interface cases are generated on the basis of realizing specific business functions, so that when batched interface tests are required to be completed, the corresponding business systems are required to be manually and sequentially operated, and the interface cases are sequentially generated when the business functions are realized, so that the process efficiency is low, and the requirements of the batched interface tests are difficult to meet. Therefore, how to improve the testing efficiency of the interface test becomes a technical problem which needs to be solved urgently at present.
Disclosure of Invention
In view of the foregoing problems in the prior art, an object of the present invention is to provide an interface testing method, apparatus, device and storage medium, which can improve the testing efficiency of the interface testing.
In order to solve the technical problems, the specific technical scheme is as follows:
in one aspect, provided herein is a method of interface testing, the method comprising:
acquiring an interface test instruction, wherein the interface test instruction comprises at least one interface to be tested and a test parameter corresponding to each interface to be tested;
determining a request message template corresponding to each interface to be tested according to the interfaces to be tested;
generating a request message case corresponding to each interface to be tested according to the request message template and the test parameters;
and sequentially executing the request message cases to finish the test of each interface to be tested.
Further, the determining a request message template corresponding to each interface to be tested according to the interfaces to be tested includes:
determining a transaction code corresponding to each interface to be tested according to the interfaces to be tested, wherein the transaction code is a service type executed by the interface to be tested;
and determining a request message template corresponding to the transaction code from a preset template library.
Further, the request message template is obtained through the following steps:
aiming at any service type, acquiring a transaction code corresponding to the service type;
retrieving a historical request message matched with the transaction code from a historical log library, wherein the historical log library is used for storing the request message after the operation of the service type is finished;
analyzing the history request message to obtain different field information in the history request message;
and generating a request message template corresponding to the transaction code according to different field information in the history request message.
Further, the generating a request message template corresponding to the transaction code according to different field information in the history request message includes:
determining the positions and attributes of different fields according to different field information in the history request message;
generating label information of the field according to the attribute of the field;
and generating a request message template corresponding to the transaction code according to the position of the field and the label information of the field.
Further, the process of establishing the preset template library comprises the following steps:
acquiring request message templates corresponding to all service types, and presetting a template library in a form;
and storing the preset template library to a first preset position.
Further, the retrieving the history request message matched with the transaction code from the history log library further includes:
and when no history request message matched with the transaction code exists in the history log library, generating a preset format request message, storing the preset format request message to a second preset position, extracting the preset format request message from the second preset position, and further completing the test of the interface to be tested corresponding to the transaction code.
Further, the generating a request message case corresponding to each interface to be tested according to the request message template and the test parameters includes:
determining the position and label information of each field in the request message template according to the request message template;
determining data corresponding to the label information of each field according to the label information of each field and the test parameters;
and generating a request message case corresponding to the interface to be tested according to the position of each field and the data corresponding to the label information of each field.
Further, the sequentially executing the request message cases to complete the test of each interface to be tested includes:
acquiring information of a system to be tested and execution parameter information, wherein the information of the system to be tested at least comprises a region to which the system belongs, a physical subsystem and a service system;
and sequentially executing the request message cases according to the system information to be tested so as to complete the test of each interface to be tested.
Further, the method further comprises:
receiving a test interface information acquisition instruction, wherein the test interface information at least comprises interface change person information, interface change details and interface compliance information;
and acquiring the information of the interface to be tested according to the test interface information acquisition instruction.
Further, the method further comprises:
setting the test parameters as specified abnormal parameters, and acquiring test results tested by the specified abnormal parameters;
judging whether the test result is service error reporting information or not;
if the test result is service error reporting information, obtaining a test result message;
and determining the vulnerability information of the interface to be tested according to the test result message so that a developer can process the interface to be tested according to the vulnerability information.
Further, the determining vulnerability information of the interface to be tested according to the test result message includes:
analyzing the test result message to obtain different field information of the test result message;
determining abnormal information in the different field information;
and determining the vulnerability information of the interface to be tested according to the abnormal information.
Further, the sequentially executing the request message cases to complete the test of each interface to be tested includes:
calling a preset program script, and generating an interface test script for the request message case;
and sequentially executing the interface test scripts to complete the test of each interface to be tested.
In another aspect, this document also provides an interface testing apparatus, the apparatus comprising:
the interface test instruction acquisition module is used for acquiring an interface test instruction, and the interface test instruction comprises at least one interface to be tested and a test parameter corresponding to each interface to be tested;
a request message template determining module, configured to determine, according to the interfaces to be tested, a request message template corresponding to each interface to be tested;
the request message case generation module is used for generating a request message case corresponding to each interface to be tested according to the request message template and the test parameters;
and the test module is used for sequentially executing the request message cases so as to complete the test of each interface to be tested.
In another aspect, a computer device is also provided herein, comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, the processor implementing the method as described above when executing the computer program.
Finally, a computer-readable storage medium is also provided herein, which stores a computer program that, when executed by a processor, implements the method as described above.
By adopting the technical scheme, the interface test method, the device, the equipment and the storage medium have the advantages that the interface test instruction is obtained, and the interface test instruction comprises at least one interface to be tested and test parameters corresponding to each interface to be tested; determining a request message template corresponding to each interface to be tested according to the interfaces to be tested; generating a request message case corresponding to each interface to be tested according to the request message template and the test parameters; the request message cases are executed in sequence to complete the test of each interface to be tested, batch generation of the test interface request messages can be realized, repeated steps are reduced, and the test process is more efficient and comprehensive.
In order to make the aforementioned and other objects, features and advantages of the present invention comprehensible, preferred embodiments accompanied with figures are described in detail below.
Drawings
In order to more clearly illustrate the embodiments or technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art that other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a schematic diagram illustrating steps of an interface testing method provided in an embodiment of the present disclosure;
fig. 2 is a schematic diagram illustrating a request message template obtaining step in the embodiment of the present disclosure;
fig. 3 is a schematic diagram illustrating a further acquiring step of a request message template in the embodiment of the present disclosure;
FIG. 4 is a diagram illustrating a request message case step in an embodiment of the present disclosure;
FIG. 5 is a schematic diagram illustrating an exception scenario testing procedure in an embodiment herein;
FIG. 6 is a schematic diagram illustrating the steps of an interface test apparatus provided in an embodiment herein;
fig. 7 shows a schematic diagram of computer device steps provided by embodiments herein.
Description of the symbols of the drawings:
100. an interface test instruction acquisition module;
200. a request message template determining module;
300. a request message case generation module;
400. a test module;
702. a computer device;
704. a processor;
706. a memory;
708. a drive mechanism;
710. an input/output module;
712. an input device;
714. an output device;
716. a presentation device;
718. a graphical user interface;
720. a network interface;
722. a communication link;
724. a communication bus.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments herein without making any creative effort, shall fall within the scope of protection.
It should be noted that the terms "first," "second," and the like in the description and claims herein and in the above-described drawings are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments herein described are capable of operation in sequences other than those illustrated or described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, apparatus, article, or device that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or device.
In the prior art, a preorder service system is required to be executed during interface testing, so that a corresponding interface case is generated on the basis of realizing a specific service function, and then the interface is tested.
In order to solve the above problem, embodiments herein provide an interface testing method, which can improve the efficiency of interface testing. Fig. 1 is a schematic diagram of steps of an interface testing method provided in an embodiment herein, and the present specification provides the method operation steps as described in the embodiment or the flowchart, but may include more or less operation steps based on conventional or non-inventive labor. The order of steps recited in the embodiments is merely one manner of performing the steps in a multitude of orders and does not represent the only order of execution. When an actual system or apparatus product executes, it can execute sequentially or in parallel according to the method shown in the embodiment or the figures. Specifically, as shown in fig. 1, the method may include:
s101: acquiring an interface test instruction, wherein the interface test instruction comprises at least one interface to be tested and a test parameter corresponding to each interface to be tested;
s102: determining a request message template corresponding to each interface to be tested according to the interfaces to be tested;
s103: generating a request message case corresponding to each interface to be tested according to the request message template and the test parameters;
s104: and sequentially executing the request message cases to finish the test of each interface to be tested.
According to the method, the request message templates of different testing interfaces are set in advance, so that when the to-be-tested interface is determined, only the testing parameters corresponding to the to-be-tested interface are input, the request message case can be generated according to the request message templates, batch generation of the request message templates corresponding to a plurality of to-be-tested interfaces is realized, compared with the prior art, the steps of repeated operation are reduced, a plurality of testing cases can be generated rapidly in batches according to different testing parameters for the same to-be-tested interface, the generation efficiency of the request message case is improved, and further the efficiency in the testing process is improved.
In actual work, the interface test is to simulate a calling party, such as a Client terminal, and detect the correctness and fault tolerance of the tested interface through interface communication. The simulation caller, not developing a browser or application, but simulating the front-end logic on the client to call the interface provided by the Server, so that the execution subject of the text can be an automated interface test tool, the interface test tool obtains an interface test instruction through the input of a tester or a user, the interface test instruction can be a batched test instruction, for example, the interface test instruction comprises a plurality of interfaces to be tested and a test parameter corresponding to each interface to be tested, the test parameter can be a test scene parameter corresponding to the interface to be tested, so that a specific test case can be generated according to the test parameter and a request message template, and finally the request message case is executed in sequence according to the execution instruction of the user to complete the test of each interface to be tested, so that the text improves the interface test tool, the efficiency of the interface test tool for generating the test cases can be improved, the batch generation of the test cases is further realized, and the test efficiency of the test interface is improved.
It should be noted that, because the execution functions of different interfaces to be tested may be different, the request message template of each interface to be tested may be different, and in order to improve the obtaining efficiency and accuracy of the request message template, a mapping relationship between the interfaces to be tested and the request message template may be established, so that after the interfaces to be tested are determined, the corresponding request message template may be determined according to the mapping relationship.
In some other embodiments, since the request packet is generated according to the execution of a specific service type, the service type and the test interface are actually in a corresponding relationship, and thus determining the request packet template corresponding to each interface to be tested according to the interfaces to be tested includes:
determining a transaction code corresponding to each interface to be tested according to the interfaces to be tested, wherein the transaction code is a service type executed by the interface to be tested;
and determining a request message template corresponding to the transaction code from a preset template library.
In the embodiment of the specification, the calling of the test interface is realized by simulating the execution of a front-end service system, so that the test of the test interface is realized.
In actual work, different service types can correspond to different test interfaces, and the simulated service type can be represented by a transaction code, so that the service type represented by the corresponding transaction code can be determined according to a specific test interface by establishing the corresponding relation between the transaction code and the test interface, and the calling of the test interface is realized. In this way, the extraction of the request message template can be realized through the transaction code, wherein the request message template can be stored in a preset template library, and the corresponding request message template can be extracted according to different transaction codes, and specifically, the request message template can also be determined by establishing the mapping relation between the transaction code and the request message template.
In some other embodiments, a corresponding transaction code may be inserted into a head of each request message template, so that when a request message template is determined, the search may be performed in a form of a keyword, which may improve the search efficiency and the efficiency of obtaining request message templates in batch.
In this embodiment of the present specification, as shown in fig. 2, the request message template is obtained through the following steps:
s201: aiming at any service type, acquiring a transaction code corresponding to the service type;
s202: retrieving a historical request message matched with the transaction code from a historical log library, wherein the historical log library is used for storing the request message after the operation of the service type is finished;
s203: analyzing the history request message to obtain different field information in the history request message;
s204: and generating a request message template corresponding to the transaction code according to different field information in the history request message.
The transaction code can be understood as a unique identification code of the service type, so that a specific service type can be determined through the transaction code, and interface information required to be called when the service type operates is determined, therefore, in actual work, a corresponding request message template can be determined through historical operation information of the service type, specifically, a historical request message matched with the transaction code is retrieved from a historical log library, wherein the historical log library can store the request message after the operation of the service type is completed, so that the request message can be used as a master message of the service type, the master message is analyzed, different field information of the master message is determined, and a corresponding request message template is generated according to the field information.
The interfaces called during the operation of different service types may be different, so that the historical request message of each operating service type needs to be acquired, and therefore, the historical request messages of all service types in a single platform architecture can be acquired, the interfaces in the platform architecture are ensured to be in a range capable of being tested, and the practicability and reliability of the interface testing tool are improved.
The specific operation is to segment the mother packet according to a preset segmentation rule to obtain different field information of the mother packet, and then construct a request packet template based on the information of the different fields, where the preset segmentation rule may be set according to an actual situation, such as segmentation according to a keyword manner, or segmentation according to a character form in combination with a keyword, and a specific segmentation manner is not limited in this specification.
In a further embodiment, as shown in fig. 3, the generating a request message template corresponding to the transaction code according to different field information in the history request message includes:
s2041: determining the positions and attributes of different fields according to different field information in the history request message;
s2042: generating label information of the field according to the attribute of the field;
s2043: and generating a request message template corresponding to the transaction code according to the position of the field and the label information of the field.
It can be understood that when the mother message is divided to obtain different field information, the position and attribute of each field can be determined, so that templated reconstruction can be performed on each mother message, the attributes of the different fields are generated into corresponding label information, such as label information of gender, mobile phone number, amount of money, and the like, and the positions of the different labels are further determined according to the positions of the different fields, so as to obtain a request message template corresponding to the transaction code.
In actual work, different service types have different realization functions, so that the formats of the request messages are different, different label information is generated in the process of labeling the field, and different request message templates are obtained. By performing the templating operation on the request messages of different service types, the method can realize the rapid and accurate batch generation of the request message cases through the template, and improve the efficiency of interface testing.
In some other embodiments, in order to avoid that the obtained historical request message is an abnormal message, thereby affecting the reliability of the subsequently generated template, a plurality of historical request messages can be obtained according to the service type, so that each historical request message is subjected to the processes of segmentation, labeling and template generation, and then the differences among a plurality of templates generated for the same service type are compared, the same template is determined and is used as the final request message template, so that the reliability of the template generation of the request message can be improved, and the reliability and the stability of the subsequent interface test are ensured.
On the basis of generating the request message template corresponding to each service type, the establishment of the preset template library may include the following steps:
acquiring request message templates corresponding to all service types, and presetting a template library in a form;
and storing the preset template library to a first preset position.
It can be understood that, placing all request message templates into the same folder facilitates rapid extraction of the message request templates, where the first preset position may be a preset position in the platform system, and establishes a communication link with the interface test tool, so as to facilitate the interface test tool to extract the request message templates therefrom, and in some other embodiments, the position lower than the preset position may be a local fixed position in the interface test tool, so that steps of information transfer when extracting the templates may be reduced, and extraction efficiency and accuracy may be improved.
In this embodiment of the present specification, when the service type is a new production service type, the corresponding history request packet may not be retrieved from the history log library, and in order to implement the test on the interface corresponding to the service type, the retrieving, from the history log library, the history request packet matched with the transaction code further includes:
and when no history request message matched with the transaction code exists in the history log library, generating a preset format request message, storing the preset format request message to a second preset position, extracting the preset format request message from the second preset position, and further completing the test of the interface to be tested corresponding to the transaction code.
The preset format request message can be understood as a general message format which can be identified by the interface, for example, an xml format message, so that the test of the test interface can be realized through the preset format request message. The second preset position is a preset position, and the preset format request message is put into the second preset position, so that the preset format request message is extracted according to a preset file path.
In this embodiment of the present specification, after determining the request message case corresponding to each interface to be tested, the request message case corresponding to the interface to be tested may be generated, and specifically, as shown in fig. 4, the generating the request message case corresponding to each interface to be tested according to the request message template and the test parameters includes:
s301: determining the position and label information of each field in the request message template according to the request message template;
s302: determining data corresponding to the label information of each field according to the label information of each field and the test parameters;
s303: and generating a request message case corresponding to the interface to be tested according to the position of each field and the data corresponding to the label information of each field.
The method can be understood that specific data values corresponding to the labels can be determined according to label information and the test parameters for each request message template, then corresponding request message cases can be generated by combining the positions of the fields, batch generation of the request message cases can be realized by the method, only multiple groups of test parameters need to be determined, namely, multiple test scenes are established according to needs, multiple corresponding test parameters are generated according to the multiple test scenes, and then multiple request message cases are generated by combining the templates, so that multiple test cases for testing the interfaces are obtained, the efficiency and the speed of the test interfaces are improved, and the accuracy and the reliability of the test can be ensured.
In this embodiment of the present specification, after the generated request message cases are obtained, a test on an interface may be implemented, and optionally, the test on the interface may be performed by performing code conversion on each request message case according to a preset program script to form an interface test script, and then calling the interface test script according to a test execution instruction of a user to complete a test on the interface to be tested, where the preset program script may be a preset Python script.
In actual operation, the interface test tool can realize automatic transcoding of a plurality of request message cases, so that automatic batch generation of the request message cases can be realized through the interface test tool, further automatic batch transcoding of the request message cases is realized, operation steps are reduced, automation effect is improved, manual operation times are reduced, and reliability and efficiency of testing are improved.
In some other embodiments, the same platform architecture may be executed in different regions and under different systems, so to improve the accuracy of the interface test, the sequentially executing the request message cases to complete the test on each interface to be tested includes:
acquiring information of a system to be tested and execution parameter information, wherein the information of the system to be tested at least comprises a region to which the system belongs, a physical subsystem and a service system;
and sequentially executing the request message cases according to the system information to be tested so as to complete the test of each interface to be tested.
During specific operation, corresponding to-be-tested system information and execution parameter information can be selected in a drop-down frame mode, testing capacity of multiple systems can be achieved, the execution parameter information can be interface request addresses, personalized setting contents such as names of people can be created, and therefore adaptation capacity of the multiple systems is improved.
After the information of the system to be tested and the execution parameter information are configured, the request message cases can be executed in sequence, so that the test of each interface to be tested is completed.
In a further embodiment, after the test of the interface to be tested is completed, the test result can be received, fed back and stored. Optionally, the test result may be fed back after the test of each interface to be tested is completed, and the test result is written into the result file, further, the test result may be directly fed back to the tester, for example, fed back through the visual interface.
In an embodiment of the present specification, the method further comprises:
receiving a test interface information acquisition instruction, wherein the test interface information at least comprises interface change person information, interface change details and interface compliance information;
and acquiring the information of the interface to be tested according to the test interface information acquisition instruction.
The steps realize the automatic acquisition of the interface information from the platform framework (such as an IT information management platform), wherein the interface information comprises interface change person information, interface change details, interface compliance conditions and the like. The account password and the access address of the IT information management platform are set in advance, and after the background program receives an instruction of acquiring interface information, the background program accesses the IT information management platform, simulates manual inquiry action and returns the interface information to be inquired. Therefore, the problem that when a large number of interfaces are required to be tested, testers need to manually query one by one to acquire the relevant information of the interfaces such as the interface changers and the like is solved. The step is beneficial for the tester to obtain the interface change condition and the changers, the tester is convenient to be in butt joint with the developer, and the interface with the change is tested in a targeted manner. In actual operation, the interface change details or the interface compliance condition can be generated by clicking the interface change person acquiring button or the interface compliance condition acquiring button to select the interface list text of the acquired information and starting execution.
In order to perform a rapid analysis of the vulnerability and compatibility of the interface, in an embodiment of the present specification, as shown in fig. 5, the method further includes:
s401: setting the test parameters as specified abnormal parameters, and acquiring test results tested by the specified abnormal parameters;
s402: judging whether the test result is service error reporting information or not;
s403: if the test result is service error reporting information, obtaining a test result message;
s404: and determining the vulnerability information of the interface to be tested according to the test result message so that a developer can process the interface to be tested according to the vulnerability information.
It can be understood that, by automatically constructing and executing various abnormal scenes, the vulnerability in the code program is checked according to the execution feedback result, and the quality and stability of the interface code are effectively improved, such as the transaction serial number is empty and exceeds the standard length; and constructing abnormal scenes such as non-standard types of fields in the request message, and testing the compatibility of the test interface.
The test result can be displayed through the visual interface, so that a tester can know the test information of the corresponding interface in time, for example, the test success can display a test success word, the test failure can display a test failure word, further, the test failure can be a system response problem and can also be a problem of the interface, when the system response problem occurs, the system error can be displayed, and when the interface has a problem, the service error can be displayed. The visual display result can be convenient for testers to know the test process and the test problems in real time.
Furthermore, when the service error report information appears, the information can be positioned on a specific result message so as to improve the interface.
Further, the determining vulnerability information of the interface to be tested according to the test result message includes:
analyzing the test result message to obtain different field information of the test result message;
determining abnormal information in the different field information;
and determining the vulnerability information of the interface to be tested according to the abnormal information.
It can be understood that, in this step, the processing of the test result message is consistent with the processing of the historical request message, and the message is divided, so that fields with different dimensions and different attributes, such as response codes (success or failure), transaction serial numbers, request message serial numbers, and the like, are determined, abnormal information is determined through analysis of specific data of different fields, such as problems that the response codes are failure and the transaction serial numbers are empty, and an accurate code leak of the interface is located through a corresponding problem, so that the improvement of the interface is realized, and the stability and compatibility of the interface are further improved.
Therefore, the interface testing method provided by the embodiment of the specification has the following beneficial effects: 1) the method can automatically acquire the added interface cases in batch, solves the problem that the traditional test cases can only be manually and singly created, automatically generates a plurality of interface test cases through batch import, 2) can automatically acquire interface information, solves the problem that testers cannot timely know interface change information, and 3) can automatically construct and execute various abnormal scenes, checks bugs in a code program according to execution feedback results, and effectively improves the quality of codes.
Based on the same inventive concept, an embodiment of the present specification further provides an interface testing apparatus, as shown in fig. 6, the apparatus includes:
an interface test instruction obtaining module 100, configured to obtain an interface test instruction, where the interface test instruction includes at least one interface to be tested and a test parameter corresponding to each interface to be tested;
a request message template determining module 200, configured to determine, according to the interfaces to be tested, a request message template corresponding to each interface to be tested;
a request message case generating module 300, configured to generate a request message case corresponding to each interface to be tested according to the request message template and the test parameters;
the testing module 400 is configured to execute the request message cases in sequence to complete testing of each interface to be tested.
The advantages obtained by the device are consistent with those obtained by the method, and the embodiments of the present description are not repeated.
As shown in fig. 7, for a computer device provided for embodiments herein, the computer device 702 may include one or more processors 704, such as one or more Central Processing Units (CPUs), each of which may implement one or more hardware threads. The computer device 702 may also include any memory 706 for storing any kind of information, such as code, settings, data, etc. For example, and without limitation, the memory 706 can include any one or more of the following in combination: any type of RAM, any type of ROM, flash memory devices, hard disks, optical disks, etc. More generally, any memory may use any technology to store information. Further, any memory may provide volatile or non-volatile retention of information. Further, any memory may represent fixed or removable components of computer device 702. In one case, when the processor 704 executes associated instructions that are stored in any memory or combination of memories, the computer device 702 can perform any of the operations of the associated instructions. The computer device 702 also includes one or more drive mechanisms 708, such as a hard disk drive mechanism, an optical disk drive mechanism, or the like, for interacting with any memory.
Computer device 702 can also include an input/output module 710(I/O) for receiving various inputs (via input device 712) and for providing various outputs (via output device 714)). One particular output mechanism may include a presentation device 716 and an associated Graphical User Interface (GUI) 718. In other embodiments, input/output module 710(I/O), input device 712, and output device 714 may also not be included, as only one computer device in a network. Computer device 702 can also include one or more network interfaces 720 for exchanging data with other devices via one or more communication links 722. One or more communication buses 724 couple the above-described components together.
Communication link 722 may be implemented in any manner, such as over a local area network, a wide area network (e.g., the Internet), a point-to-point connection, etc., or any combination thereof. Communication link 722 may include any combination of hardwired links, wireless links, routers, gateway functions, name servers, etc., governed by any protocol or combination of protocols.
Corresponding to the methods in fig. 1-5, the embodiments herein also provide a computer-readable storage medium having stored thereon a computer program, which, when executed by a processor, performs the steps of the above-described method.
Embodiments herein also provide computer readable instructions, wherein when executed by a processor, a program thereof causes the processor to perform the method as shown in fig. 1-5.
It should be understood that, in various embodiments herein, the sequence numbers of the above-mentioned processes do not mean the execution sequence, and the execution sequence of each process should be determined by its function and inherent logic, and should not constitute any limitation to the implementation process of the embodiments herein.
It should also be understood that, in the embodiments herein, the term "and/or" is only one kind of association relation describing an associated object, meaning that three kinds of relations may exist. For example, a and/or B, may represent: a exists alone, A and B exist simultaneously, and B exists alone. In addition, the character "/" herein generally indicates that the former and latter related objects are in an "or" relationship.
Those of ordinary skill in the art will appreciate that the elements and algorithm steps of the examples described in connection with the embodiments disclosed herein may be embodied in electronic hardware, computer software, or combinations of both, and that the components and steps of the examples have been described in a functional general in the foregoing description for the purpose of illustrating clearly the interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present disclosure.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described systems, apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the several embodiments provided herein, it should be understood that the disclosed system, apparatus, and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the units is only one logical division, and other divisions may be realized in practice, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may also be an electric, mechanical or other form of connection.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purposes of the embodiments herein.
In addition, functional units in the embodiments herein may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solutions of the present invention may be implemented in a form of a software product, which is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the methods described in the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
The principles and embodiments of this document are explained herein using specific examples, which are presented only to aid in understanding the methods and their core concepts; meanwhile, for the general technical personnel in the field, according to the idea of this document, there may be changes in the concrete implementation and the application scope, in summary, this description should not be understood as the limitation of this document.

Claims (15)

1. An interface testing method, the method comprising:
acquiring an interface test instruction, wherein the interface test instruction comprises at least one interface to be tested and a test parameter corresponding to each interface to be tested;
determining a request message template corresponding to each interface to be tested according to the interfaces to be tested;
generating a request message case corresponding to each interface to be tested according to the request message template and the test parameters;
and sequentially executing the request message cases to finish the test of each interface to be tested.
2. The method of claim 1, wherein determining a request message template corresponding to each interface to be tested according to the interfaces to be tested comprises:
determining a transaction code corresponding to each interface to be tested according to the interfaces to be tested, wherein the transaction code is a service type executed by the interface to be tested;
and determining a request message template corresponding to the transaction code from a preset template library.
3. The method of claim 2, wherein the request message template is obtained by:
aiming at any service type, acquiring a transaction code corresponding to the service type;
retrieving a historical request message matched with the transaction code from a historical log library, wherein the historical log library is used for storing the request message after the operation of the service type is finished;
analyzing the history request message to obtain different field information in the history request message;
and generating a request message template corresponding to the transaction code according to different field information in the history request message.
4. The method according to claim 3, wherein the generating a request message template corresponding to the transaction code according to different field information in the history request message comprises:
determining the positions and attributes of different fields according to different field information in the history request message;
generating label information of the field according to the attribute of the field;
and generating a request message template corresponding to the transaction code according to the position of the field and the label information of the field.
5. The method of claim 4, wherein the creating of the preset template library comprises:
acquiring request message templates corresponding to all service types, and presetting a template library in a form;
and storing the preset template library to a first preset position.
6. The method of claim 3, wherein retrieving the history request message matching the transaction code from the history log repository further comprises:
and when no history request message matched with the transaction code exists in the history log library, generating a preset format request message, storing the preset format request message to a second preset position, extracting the preset format request message from the second preset position, and further completing the test of the interface to be tested corresponding to the transaction code.
7. The method of claim 1, wherein the generating a request message case corresponding to each interface to be tested according to the request message template and the test parameters comprises:
determining the position and label information of each field in the request message template according to the request message template;
determining data corresponding to the label information of each field according to the label information of each field and the test parameters;
and generating a request message case corresponding to the interface to be tested according to the position of each field and the data corresponding to the label information of each field.
8. The method of claim 1, wherein the executing the request message cases in sequence to complete testing of each interface to be tested comprises:
acquiring information of a system to be tested and execution parameter information, wherein the information of the system to be tested at least comprises a region to which the system belongs, a physical subsystem and a service system;
and sequentially executing the request message cases according to the system information to be tested so as to complete the test of each interface to be tested.
9. The method of claim 1, further comprising:
receiving a test interface information acquisition instruction, wherein the test interface information at least comprises interface change person information, interface change details and interface compliance information;
and acquiring the information of the interface to be tested according to the test interface information acquisition instruction.
10. The method of claim 1, further comprising:
setting the test parameters as specified abnormal parameters, and acquiring test results tested by the specified abnormal parameters;
judging whether the test result is service error reporting information or not;
if the test result is service error reporting information, obtaining a test result message;
and determining the vulnerability information of the interface to be tested according to the test result message so that a developer can process the interface to be tested according to the vulnerability information.
11. The method according to claim 10, wherein the determining vulnerability information of the interface to be tested according to the test result message comprises:
analyzing the test result message to obtain different field information of the test result message;
determining abnormal information in the different field information;
and determining the vulnerability information of the interface to be tested according to the abnormal information.
12. The method of claim 1, wherein the executing the request message cases in sequence to complete testing of each interface to be tested comprises:
calling a preset program script, and generating an interface test script for the request message case;
and sequentially executing the interface test scripts to complete the test of each interface to be tested.
13. An interface testing apparatus, the apparatus comprising:
the interface test instruction acquisition module is used for acquiring an interface test instruction, and the interface test instruction comprises at least one interface to be tested and a test parameter corresponding to each interface to be tested;
a request message template determining module, configured to determine, according to the interfaces to be tested, a request message template corresponding to each interface to be tested;
the request message case generation module is used for generating a request message case corresponding to each interface to be tested according to the request message template and the test parameters;
and the test module is used for sequentially executing the request message cases so as to complete the test of each interface to be tested.
14. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor implements the method according to any of claims 1 to 12 when executing the computer program.
15. A computer-readable storage medium, characterized in that the computer-readable storage medium stores a computer program which, when executed by a processor, implements the method of any one of claims 1 to 12.
CN202110588287.4A 2021-05-28 2021-05-28 Interface test method, device, equipment and storage medium Active CN113312260B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110588287.4A CN113312260B (en) 2021-05-28 2021-05-28 Interface test method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110588287.4A CN113312260B (en) 2021-05-28 2021-05-28 Interface test method, device, equipment and storage medium

Publications (2)

Publication Number Publication Date
CN113312260A true CN113312260A (en) 2021-08-27
CN113312260B CN113312260B (en) 2022-12-02

Family

ID=77375732

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110588287.4A Active CN113312260B (en) 2021-05-28 2021-05-28 Interface test method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN113312260B (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113806222A (en) * 2021-08-30 2021-12-17 浙江吉利控股集团有限公司 Interface test script generation method, device, equipment and storage medium
CN113986753A (en) * 2021-11-10 2022-01-28 中国银行股份有限公司 Interface test method, device, equipment and storage medium
CN114138670A (en) * 2021-12-10 2022-03-04 四川启睿克科技有限公司 Method based on interface automation test and function, performance and safety test fusion

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20020097291A (en) * 2001-06-20 2002-12-31 (주)엔토시스 Method for analyzing log of wireless internet
CN101431809A (en) * 2008-10-28 2009-05-13 中国科学院研究生院 OBEX protocol bug excavation method and system
US20150278393A1 (en) * 2014-03-25 2015-10-01 Wipro Limited System and method for business intelligence data testing
CN105279090A (en) * 2015-11-17 2016-01-27 中国建设银行股份有限公司 Test script generating method and test script generating device applied in financial field
US10073763B1 (en) * 2017-12-27 2018-09-11 Accenture Global Solutions Limited Touchless testing platform
CN110362497A (en) * 2019-07-23 2019-10-22 上海金融期货信息技术有限公司 Cover the automation api interface test method and system of full unusual character
CN110399293A (en) * 2019-06-21 2019-11-01 平安科技(深圳)有限公司 System detection method, device, computer equipment and storage medium
CN111858376A (en) * 2020-07-29 2020-10-30 平安养老保险股份有限公司 Request message generation method and interface test method
CN112052171A (en) * 2020-09-03 2020-12-08 上海复深蓝软件股份有限公司 Test message processing method and device, computer equipment and storage medium
US20210089291A1 (en) * 2019-09-19 2021-03-25 International Business Machines Corporation Migrating a service to a version of an application programming interface

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20020097291A (en) * 2001-06-20 2002-12-31 (주)엔토시스 Method for analyzing log of wireless internet
CN101431809A (en) * 2008-10-28 2009-05-13 中国科学院研究生院 OBEX protocol bug excavation method and system
US20150278393A1 (en) * 2014-03-25 2015-10-01 Wipro Limited System and method for business intelligence data testing
CN105279090A (en) * 2015-11-17 2016-01-27 中国建设银行股份有限公司 Test script generating method and test script generating device applied in financial field
US10073763B1 (en) * 2017-12-27 2018-09-11 Accenture Global Solutions Limited Touchless testing platform
CN110399293A (en) * 2019-06-21 2019-11-01 平安科技(深圳)有限公司 System detection method, device, computer equipment and storage medium
CN110362497A (en) * 2019-07-23 2019-10-22 上海金融期货信息技术有限公司 Cover the automation api interface test method and system of full unusual character
US20210089291A1 (en) * 2019-09-19 2021-03-25 International Business Machines Corporation Migrating a service to a version of an application programming interface
CN111858376A (en) * 2020-07-29 2020-10-30 平安养老保险股份有限公司 Request message generation method and interface test method
CN112052171A (en) * 2020-09-03 2020-12-08 上海复深蓝软件股份有限公司 Test message processing method and device, computer equipment and storage medium

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
冯瑶等: "基于交易日志的自动化测试技术在功能测试中的应用", 《中国金融电脑》 *
冯瑶等: "基于交易日志的自动化测试技术在功能测试中的应用", 《中国金融电脑》, no. 11, 7 November 2018 (2018-11-07) *

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113806222A (en) * 2021-08-30 2021-12-17 浙江吉利控股集团有限公司 Interface test script generation method, device, equipment and storage medium
CN113806222B (en) * 2021-08-30 2024-05-17 浙江吉利控股集团有限公司 Interface test script generation method, device, equipment and storage medium
CN113986753A (en) * 2021-11-10 2022-01-28 中国银行股份有限公司 Interface test method, device, equipment and storage medium
CN114138670A (en) * 2021-12-10 2022-03-04 四川启睿克科技有限公司 Method based on interface automation test and function, performance and safety test fusion
CN114138670B (en) * 2021-12-10 2024-05-14 四川启睿克科技有限公司 Method based on integration of interface automation test and function, performance and safety test

Also Published As

Publication number Publication date
CN113312260B (en) 2022-12-02

Similar Documents

Publication Publication Date Title
CN113312260B (en) Interface test method, device, equipment and storage medium
CN106844217B (en) Method and device for embedding point of applied control and readable storage medium
CN110928772B (en) Test method and device
EP2778929B1 (en) Test script generation system
CN107102947B (en) ATM transaction flow testing device and method
US10437717B2 (en) Defect reporting in application testing
CN109710528B (en) Test script generation method, device, equipment and medium
CN102571403A (en) Realization method and device for general data quality control adapter
US7353230B2 (en) Dynamic distributed customer issue analysis
CN112540924A (en) Interface automation test method, device, equipment and storage medium
CN112181854A (en) Method, device, equipment and storage medium for generating flow automation script
CN112650670A (en) Application testing method, device, system, electronic equipment and storage medium
CN107357721B (en) Method and device for testing system
CN109976725B (en) Flow program development method and device based on lightweight flow engine
JP2017016507A (en) Test management system and program
CN113342692A (en) Test case automatic generation method and device, electronic equipment and storage medium
CN113157554A (en) Software automation question making test method and related equipment
US11544179B2 (en) Source traceability-based impact analysis
CN113986749A (en) Display method and display device of front-end test information and electronic equipment
CN113434405A (en) Method and device for determining test file, storage medium and electronic device
TWM591202U (en) Equipment repair requesting management system
CN112579455B (en) Automatic interface testing method and device, electronic equipment and storage medium
US20080066005A1 (en) Systems and Methods of Interfacing with Enterprise Resource Planning Systems
Uddagiri et al. Improving the quality of requirements in middleware requirements specifications
CN117093497B (en) Test report processing method and device, electronic equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant