CN115269415A - Interface test system and method based on simulation scene use case - Google Patents

Interface test system and method based on simulation scene use case Download PDF

Info

Publication number
CN115269415A
CN115269415A CN202210909591.9A CN202210909591A CN115269415A CN 115269415 A CN115269415 A CN 115269415A CN 202210909591 A CN202210909591 A CN 202210909591A CN 115269415 A CN115269415 A CN 115269415A
Authority
CN
China
Prior art keywords
test
interface
test case
parameters
case
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.)
Pending
Application number
CN202210909591.9A
Other languages
Chinese (zh)
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.)
Tianyi Digital Life Technology Co Ltd
Original Assignee
Tianyi Digital Life Technology 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 Tianyi Digital Life Technology Co Ltd filed Critical Tianyi Digital Life Technology Co Ltd
Priority to CN202210909591.9A priority Critical patent/CN115269415A/en
Publication of CN115269415A publication Critical patent/CN115269415A/en
Pending legal-status Critical Current

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/3684Test management for test design, e.g. generating new test cases
    • 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
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/0223User address space allocation, e.g. contiguous or non contiguous base addressing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures
    • G06F16/2228Indexing structures

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Software Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The application discloses an interface test system and method based on simulation scene use cases.A data acquisition module acquires request parameters and response parameters corresponding to a test interface through a real machine simulation scene to generate a test case of a simulation scene; the test case assembly module analyzes parameters in the test case, and if the test interface in the simulation scene is identified to have a front node or a rear node, the test case of the front node or the rear node of the test interface and the test case of the test interface are stored in a test case group mode to be used as the test case group of the simulation scene; the interface link processing module finds the test case group corresponding to the target test interface through the addressing of the interface gateway service, tests the target test interface according to the test case group and outputs a test result, so that the technical problems that the test efficiency is low in the prior art, the generated test cases are different from data in a real scene, and the interface test cannot objectively reflect real problems are solved.

Description

Interface test system and method based on simulation scene use case
Technical Field
The present application relates to the field of interface testing technologies, and in particular, to a system and a method for testing an interface based on a simulation scenario.
Background
The interface test mainly refers to the verification of the correctness, fault tolerance, integrity and rationality of the interface function by combining a program script or a software tool with a related methodology. The test cases in the interface test are important factors influencing whether the whole execution process can reach the target expectation, and the objectivity, integrity and usability of the test cases directly influence the effect of the interface test. Therefore, it is required that the test cases cover as comprehensive as possible, are as close to the real scene as possible, take boundary conditions into consideration as much as possible, reflect the problem of the interface as much as possible, and the like. The generation, verification and maintenance of the test cases are an important ring for implementing the execution interface test.
At present, the existing testing tool can only provide a simple interface testing method, a testing case is written manually in a targeted manner, a testing script is input manually, the testing efficiency is low, and the generated testing case is different from data in a real scene, so that the interface testing cannot objectively reflect the real problem.
Disclosure of Invention
The application provides an interface test system and method based on a simulation scene case, which are used for improving the technical problems that in the prior art, a test case is generated manually in a targeted manner, a test script is manually input, the test efficiency is low, and the generated test case is different from data in a real scene, so that the interface test cannot objectively reflect real problems.
In view of this, a first aspect of the present application provides an interface testing system based on a simulation scenario case, including:
the data acquisition module is used for acquiring request parameters and response parameters corresponding to the test interface through a real machine simulation scene and generating a test case of the simulation scene according to the request parameters and the response parameters;
the test case assembly module is used for analyzing parameters in the test cases, and if the test interface in the simulation scene is identified to have a front node or a rear node, the test cases of the front node or the rear node of the test interface and the test cases of the test interface are stored in a test case group mode and are used as the test case group of the simulation scene, wherein the interfaces in the test case group are stored in a double-linked list structure;
and the interface link processing module is used for selecting a target test interface, finding a test case group corresponding to the target test interface through addressing of the interface gateway service, testing the target test interface according to the test case group and outputting a test result.
Optionally, the data acquisition module specifically includes:
the system comprises a setting unit and a proxy service unit, wherein the setting unit is used for setting hosts or proxy directions in a true machine to be tested so that the true machine to be tested forwards a received access request to the proxy service;
the proxy service is used for screening the access request and forwarding the access request belonging to the test interface to the interface processing service;
the interface processing service is used for recording request parameters of an access request corresponding to the test interface, forwarding the access request to a service platform for processing so as to obtain response parameters corresponding to the access request, and sending the request parameters and the response parameters to the data acquisition service;
and the data acquisition service is used for generating a test case according to the request parameters and the response parameters and storing the test case to a database.
Optionally, the test case assembling system specifically includes:
the interface parameter analysis unit is used for identifying whether the parameters in the test case have universality or not based on the interface document and storing the parameters with the universality;
and the simulation case analysis unit is used for identifying whether the test interface in the simulation scene has a front node or a rear node, if so, storing the test case of the front node or the rear node of the test interface and the test case of the test interface in a test case group mode as the test case group of the simulation scene, wherein the interfaces in the test case group are stored in a double-linked list structure.
Optionally, the test case assembly system further includes:
the batch data generation unit is used for generating test cases or test case groups in batches according to the test cases or the test case groups;
and the executable verification unit is used for verifying whether the test cases or the test case groups generated in batches are available or not, and if so, storing the test cases or the test case groups into the database.
Optionally, the interface link processing module is specifically configured to:
selecting a target test interface, addressing the target test interface through an interface service gateway, and acquiring a test case group corresponding to the target test interface;
if the target test interface has a front node or a rear node, assembling a test case group corresponding to the target test interface according to the front node or the rear node of the target test interface, and adding the assembled test case group to a task queue;
and executing the test task and outputting a test result.
A second aspect of the present application provides an interface testing method based on a simulation scenario case, which is applied to any one of the interface testing systems based on a simulation scenario case in the first aspect, and the method includes:
acquiring a request parameter and a response parameter corresponding to a test interface through a real machine simulation scene, and generating a test case of the simulation scene according to the request parameter and the response parameter;
analyzing parameters in the test cases, if the test interface in the simulation scene is identified to have a front node or a rear node, storing the test cases of the front node or the rear node of the test interface and the test cases of the test interface in a test case group mode as the test case group of the simulation scene, wherein the interfaces in the test case group are stored in a double-linked list structure;
selecting a target test interface, finding a test case group corresponding to the target test interface through addressing of an interface gateway service, testing the target test interface according to the test case group, and outputting a test result.
Optionally, the obtaining a request parameter and a response parameter corresponding to a test interface through a real machine simulation scenario, and generating a test case of the simulation scenario according to the request parameter and the response parameter includes:
the method comprises the steps that hosts or proxy pointers are set in a true machine to be tested, so that the true machine to be tested forwards a received access request to proxy service;
screening the access request through the proxy service, and forwarding the access request belonging to the test interface to an interface processing service;
recording request parameters of an access request corresponding to the test interface through the interface processing service, forwarding the access request to a service platform for processing so as to obtain response parameters corresponding to the access request, and sending the request parameters and the response parameters to a data acquisition service;
and generating a test case according to the request parameters and the response parameters through the data acquisition service, and storing the test case to a database.
Optionally, the analyzing the parameters in the test case includes:
and identifying whether the parameters in the test case have universality or not based on the interface document, and storing the parameters with the universality.
Optionally, the method further includes:
generating test cases or test case groups in batches according to the test cases or the test case groups;
and checking whether the test cases or the test case groups generated in batches are available, and if so, storing the test cases or the test case groups into a database.
Optionally, the finding, through the interface gateway service addressing, a test case group corresponding to the target test interface, testing the target test interface according to the test case group, and outputting a test result includes:
addressing the target test interface through an interface service gateway to obtain a test case group corresponding to the target test interface;
if the target test interface has a front node or a rear node, assembling a test case group corresponding to the target test interface according to the front node or the rear node of the target test interface, and adding the assembled test case group to a task queue;
and executing the test task and outputting a test result.
According to the technical scheme, the method has the following advantages:
the application provides an interface test system based on a simulation scene case, a data acquisition module obtains a request parameter and a response parameter corresponding to a test interface through a real machine simulation scene to generate the test case of the simulation scene, the obtained test case is closer to a real scene, and the authenticity and the usability of the test case are higher; the test case assembly module identifies whether a front node or a rear node exists in a test interface in a simulation scene, when the front node or the rear node exists in the test interface, the test case of the front node or the rear node of the test interface and the test case of the test interface are stored in a test case group mode and serve as the test case group of the simulation scene, the interfaces in the test case group are stored in a double-linked list structure, excessive manual processing is not needed, and the recording efficiency of the test cases is improved; the interface link processing module finds the test case group corresponding to the target test interface through the interface gateway service addressing, tests the target test interface according to the test case group and outputs a test result, and the technical problems that in the prior art, the test cases are generated manually and specifically, the test scripts are input manually, the test efficiency is low, and the generated test cases are different from data in a real scene, so that the interface test cannot objectively reflect real problems are solved.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art that other drawings can be obtained according to the drawings without inventive exercise.
Fig. 1 is a schematic structural diagram of an interface test system based on a simulation scenario case according to an embodiment of the present application;
FIG. 2 is a schematic flow chart of a test case data collection process according to an embodiment of the present disclosure;
FIG. 3 is a schematic diagram of a doubly linked list structure provided in an embodiment of the present application;
fig. 4 is a schematic diagram of an interface link processing module according to an embodiment of the present application during interface test;
fig. 5 is a schematic flowchart of an interface testing method based on a simulation scenario case according to an embodiment of the present application.
Detailed Description
In order to make the technical solutions of the present application better understood, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments in the present application without making any creative effort belong to the protection scope of the present application.
At present, most of the tools and means for providing interface testing in the market are based on an http protocol, a simulation client request is provided, packaging parameters are transmitted to a required testing interface, whether an expectation is achieved or not is judged according to a preset response result, if the expectation is achieved, the interface is normal, otherwise, the interface is abnormal, and finally, an interface testing report is output according to a specific expected effect. These tools generally only provide a test of a single and simple interface, but "interface application in a system is complex, interfaces are in tandem relation, and interface and system function interaction is preconditioned", which are also common in actual interface tests and are the main reasons that the interface test work is prevented from being smoothly advanced. The existing test scheme is relatively rough to implement, the compiling of the test script or program depends on manual work, the execution of the script program can be influenced by the adjustment of the whole scene link, the maintenance and management cost is very high, the large-scale test task execution is not facilitated, and the limitation is large.
To solve the above problem, referring to fig. 1, an embodiment of the present application provides an interface test system based on a simulation scenario case, including:
the data acquisition module is used for acquiring request parameters and response parameters corresponding to the test interface through a real machine simulation scene and generating a test case of the simulation scene according to the request parameters and the response parameters;
the test case assembly module is used for analyzing parameters in the test cases, and if the test interface in the simulation scene is identified to have a front node or a rear node, the test cases of the front node or the rear node of the test interface and the test cases of the test interface are stored in a test case group mode to be used as the test case group of the simulation scene, wherein the interfaces in the test case group are stored in a double-linked list structure;
and the interface link processing module is used for selecting a target test interface, finding a test case group corresponding to the target test interface through addressing of the interface gateway service, testing the target test interface according to the test case group and outputting a test result.
The data acquisition module in the embodiment of the application adopts a mode of simulating a simulation scene by a real machine and requesting a rear-end interface, records request parameters corresponding to the interface through proxy request processing, and stores test cases assembled into the simulation scene to a case warehouse. The test case is generated by simulating real scene operation, generally belongs to a forward test case, and has reference value in a test case assembly module subsequently. The method has reference values, such as ' a preposed scene needs login, an interface request body or a request head needs login parameters ', an encryption public key which needs to be acquired on the premise of a known encryption algorithm ', ' simulated equipment parameters ', ' interface general parameters ', and the like.
Further, the data acquisition module specifically includes:
the setting unit is used for setting hosts or proxy directions in the true machine to be tested so that the true machine to be tested forwards the received access request to the proxy service;
the proxy service is used for screening the access requests and forwarding the access requests belonging to the test interface to the interface processing service;
the interface processing service is used for recording request parameters of the access request corresponding to the test interface and forwarding the access request to the service platform for processing so as to obtain response parameters corresponding to the access request; sending the request parameters and the response parameters to a data acquisition service;
and the data acquisition service is used for generating a test case according to the request parameters and the response parameters and storing the test case to a database.
Referring to the test case data acquisition process provided in fig. 2, in the embodiment of the present application, an automated test tool is used to write a simulation operation script, or a user actually accesses the simulation operation script to trigger a real machine browser or a client application, and a hosts or an agent direction is set in a real machine to be tested, so as to forward an access request to an AnyProxy service, and the proxy service filters the access request, and forwards the access request to an interface processing service if the access request belongs to a test interface, or else, filters the access request without performing task processing; the interface processing service records request parameters (including request head parameters and request body data) of the test interface, and forwards the access request to the service platform for processing to obtain corresponding response parameters; the interface processing service transmits the request parameters triggered in the simulation scene and the returned response parameters to the data acquisition service, and the data acquisition service performs format conversion (such as json format, xml format and protobuf format) on the request parameters and the response parameters, and then the request parameters and the response parameters are stored in a database as test cases of the simulation scene.
Further, the test case assembling system specifically includes:
the interface parameter analysis unit is used for identifying whether the parameters in the test case have universality or not based on the interface document and storing the parameters with universality;
the simulation case analysis unit is used for identifying whether the test interface in the simulation scene has the front node or the rear node, if the test interface in the simulation scene has the front node or the rear node, the test cases of the front node or the rear node of the test interface and the test cases of the test interface are stored in a test case group mode to serve as the test case group of the simulation scene, and the interfaces in the test case group are stored in a double-chain structure.
The interface parameter analysis unit in the embodiment of the application is used for comparing the interface document with the test case of the simulation scene, and identifying whether the parameters in the test case have universality, such as sessionid needed for login, a key needed for encryption and decryption, device parameters in a specific scene and the like, if the parameters in the test case have the universality, the parameters in the test case are used as the general parameters of the test case to be stored, when data are generated in subsequent batches, the general parameters can be extracted to be used as the parameters of a newly generated test case, and if the parameters do not have the universality, when the test case or the test case group is generated in subsequent batches, dynamic parameters are generated in batches according to the type of the parameters. For example, in a certain simulation scenario, whether a mail can be normally sent is tested, a certain user logs in a mailbox through a mobile phone number and then sends the mail, in the simulation scenario, the mobile phone number of the user can be stored as a general parameter, a subject and a text when the mail is sent are non-general parameters, and then when test cases are generated in batches, the test cases can be dynamically generated according to the types of the subject and the text.
The simulation case analysis unit is used for identifying whether a front node or a rear node exists in a simulation scene, if so, defining a front interface test case or a rear interface test case, and storing the front interface test case or the rear interface test case in a linked list data structure. If the test interface has a front node or a rear node, the test case of the front node or the rear node and the interface test case need to be stored as a case group as the test case group of the simulation scene. If the test interface has a front node and a back node, a doubly linked list structure may be used for storage, and the defined doubly linked list structure is shown in fig. 3.
Further, the test case assembly system further includes:
the batch data generation unit is used for generating test cases or test case groups in batches according to the test cases or the test case groups;
and the executable verification unit is used for verifying whether the test cases or the test case groups generated in batches are available or not, and if so, storing the test cases or the test case groups into the database.
The database needs to meet the requirements of multiple scenes, such as common mobile phone numbers, dates, provincial and urban areas, account IDs and the like; a variety of data types, such as integer, string, date type, timestamp, etc., are also to be satisfied; dynamic expansion is required, and the data types, which are used in a scene case or supported by the scene case, can be dynamically added and imported in batches; must be emulation data and support multiplexing. The authenticity and availability of the simulation data can be verified by machine and human, and the multiplexing is a continuous accumulation process. The batch data generation unit multiplexes data according to the defined various types of data warehouses and generates test cases or test case groups in batches; the executable verification unit verifies whether the test cases or the test case groups generated in batches are available, and if yes, the test cases or the test case groups are stored in the database.
The test case generated in the embodiment of the application is generated by simulating a real environment through a real machine, the data authenticity of the test case is high, the data is reusable and assembled, the interface test under a complex scene can be realized, and the application value of the real scene is achieved.
Further, the interface link processing module is specifically configured to:
selecting a target test interface, addressing the target test interface through an interface service gateway, and acquiring a test case group corresponding to the target test interface;
if the target test interface has a front node or a rear node, assembling a test case group corresponding to the target test interface according to the front node or the rear node of the target test interface, and adding the assembled test case group to a task queue;
and executing the test task and outputting a test result.
The interface link processing module is mainly responsible for the full-flow running of the test case of the test interface. The test interface is stored in a data structure of a double linked list, if the test interface is provided with a preposed node or a postpositional node, the preposed input or the postpositional output of the test interface is determined, and the conditions are connected in series; addressing the interface test cases through the interface service gateway to find all test case groups corresponding to the interface test cases; the test case groups are connected in series with the preposed nodes and run through, a certain node test case in each test case group must have an expected effect (namely 'assertion setting'), if the test case accords with the expectation, the assertion passes, and if the test case accords with the expectation, the assertion does not pass; and if the assertion of a certain node in the test case group does not pass but is interrupted, storing the processing result of the node, and if all the nodes pass, indicating that the node reaches the test expectation, completing the test and recording the test result.
Referring to fig. 4, the processing procedure of the interface link processing module may refer to a storage structure of an interface use case group queue defined in the interface link processing module, and in order to improve the addressing access performance of the interface use case group queue, in the embodiment of the present application, the storage structure is preferably stored in a document type cache database MongoDb, and the defined data structure is as follows:
{
"id":"dbd82jfeng0182837jnfefe9xznfb8765",
"apiId": test interface id ",
"testCase" test case, which saves request parameters and expected response results in json format,
"preamid" "pre-processor id",
"preTestCase" pre-test case, saving request parameters and expected response results in json format,
"postApiId" "post-processor id",
'postTestCase', storing request parameters and expected response results in json format,
"......":"......."
}
the storage structure of the interface doubly linked list is stored in a relational database mysql, and the defined data structure is as follows:
apiId, the test interface id,
preapid-a pre-interface id,
postapi id, post-interface id,
preApiHandler-a pre-processor,
postapi handler, a post-processor,
preHandlerType-pre-processor type, "method name", "interface url",
postHandlerType, post-processor type, "method name", "interface url",
the interface link processing module selects a target test interface, and then accesses addressing through an interface grid to find a test case group corresponding to the target test interface; assembling a test case group according to a front node or a rear node of a target test interface; and coding the test tasks, arranging the assembled executable test case groups to a task queue, executing the test tasks, and outputting the test results which can be output in a report form.
In the embodiment of the application, the data acquisition module acquires the request parameters and the response parameters corresponding to the test interface through the real machine simulation scene to generate the test case of the simulation scene, the obtained test case is closer to the real scene, and the authenticity and the usability of the test case are higher; the test case assembly module identifies whether a front node or a rear node exists in a test interface in a simulation scene, when the front node or the rear node exists in the test interface, the test case of the front node or the rear node of the test interface and the test case of the test interface are stored in a test case group mode and serve as the test case group of the simulation scene, the interfaces in the test case group are stored in a double-linked list structure, excessive manual processing is not needed, and the recording efficiency of the test cases is improved; the interface link processing module finds the test case group corresponding to the target test interface through the interface gateway service addressing, tests the target test interface according to the test case group and outputs a test result, and the technical problems that in the prior art, the test cases are generated manually in a targeted manner, test scripts are manually input, the test efficiency is low, and the generated test cases are different from data in a real scene, so that the interface test cannot objectively reflect real problems are solved.
The above is an embodiment of an interface testing system based on a simulation scenario case provided by the present application, and the following is an embodiment of an interface testing method based on a simulation scenario case provided by the present application.
Referring to fig. 5, an interface testing method based on a simulation scenario case provided in an embodiment of the present application is applied to an interface testing system based on a simulation scenario case in the foregoing embodiment, and the method includes:
step 501, acquiring a request parameter and a response parameter corresponding to a test interface through a real machine simulation scene, and generating a test case of the simulation scene according to the request parameter and the response parameter.
The embodiment of the application adopts a mode of simulating a simulation scene by a real machine and requesting a rear-end interface, records request parameters corresponding to the interface through proxy request processing, and stores a test case assembled into the simulation scene to a case warehouse. The test case is generated by simulating real scene operation, generally belongs to a forward test case, and has reference value in a test case assembly module subsequently. The method has reference values, such as ' a preposed scene needs login, an interface request body or a request head needs login parameters ', an encryption public key which needs to be acquired on the premise of a known encryption algorithm ', ' simulated equipment parameters ', ' interface general parameters ', and the like.
Adopting an automatic testing tool to compile a simulation operation script, or triggering a real machine browser or client application through real access of a user, and setting hosts or proxy directions in a real machine to be tested so that the real machine to be tested forwards a received access request to proxy service; screening the access request through the proxy service, and forwarding the access request belonging to the test interface to the interface processing service; the method comprises the steps that request parameters of an access request corresponding to a test interface are recorded through an interface processing service, the access request is forwarded to a service platform to be processed, response parameters corresponding to the access request are obtained, and the request parameters and the response parameters are sent to a data acquisition service; and generating a test case according to the request parameters and the response parameters through the data acquisition service, and storing the test case to a database.
502, analyzing parameters in the test cases, and if the test interface in the simulation scene is identified to have a front node or a rear node, storing the test cases of the front node or the rear node of the test interface and the test cases of the test interface in a test case group mode to serve as the test case group of the simulation scene, wherein the interfaces in the test case group are stored in a double-chain structure.
Comparing the interface document with the test case of the simulation scene, identifying whether the parameters in the test case have universality, such as sessionid required for login, a key required for encryption and decryption, equipment parameters in a specific scene and the like, if so, saving the parameters of the test case as the universal parameters of the test case, extracting the universal parameters as the parameters of the newly generated test case when data is generated in subsequent batches, and if not, generating dynamic parameters in batches according to the types of the parameters when the test case or the test case group is generated in subsequent batches. For example, in a certain simulation scenario, whether a mail can be sent normally is tested, a certain user logs in a mailbox through a mobile phone number and then sends the mail, in the simulation scenario, the mobile phone number of the user can be stored as a general parameter, a subject and a text when the mail is sent are non-general parameters, and then when test cases are generated in batches, the test cases can be generated dynamically according to the types of the subject and the text.
And identifying whether a front node or a rear node exists in the simulation scene, if so, defining a front interface test case or a rear interface test case, and storing the front interface test case or the rear interface test case in a linked list data structure. If the test interface has a front node or a rear node, the test case of the front node or the rear node and the interface test case need to be stored as a case group as the test case group of the simulation scene. If the test interface has a front node and a back node, the test interface can adopt a bidirectional linked list structure for storage.
The database needs to meet the requirements of multiple scenes, such as common mobile phone numbers, dates, provincial and urban areas, account IDs and the like; a variety of data types, such as integer, string, date type, timestamp, etc., are also to be satisfied; dynamic expansion is required, and the data types, which are used in a scene case or supported by the scene case, can be dynamically added and imported in batches; must be emulation data and support multiplexing. The authenticity and availability of the simulation data can be verified by machine and human, and the multiplexing is a continuous accumulation process. Multiplexing data according to the defined various types of data warehouses, and generating test cases or test case groups in batches; and checking whether the test cases or the test case groups generated in batches are available, and if so, storing the test cases or the test case groups into a database.
Step 503, selecting a target test interface, finding a test case group corresponding to the target test interface through the interface gateway service addressing, testing the target test interface according to the test case group, and outputting a test result.
Addressing a target test interface through an interface service gateway to obtain a test case group corresponding to the target test interface; if the target test interface has a front node or a rear node, assembling the test case group corresponding to the target test interface according to the front node or the rear node of the target test interface, and adding the assembled test case group to a task queue; and executing the test task and outputting a test result.
In the embodiment of the application, the request parameters and the response parameters corresponding to the test interface are obtained through the simulation scene of the real machine to generate the test case of the simulation scene, the obtained test case is closer to the real scene, and the authenticity and the usability of the test case are higher; when the fact that the front node or the rear node exists in the test interface in the simulation scene is identified, the test cases of the front node or the rear node of the test interface and the test cases of the test interface are stored in a test case group mode to serve as the test case group of the simulation scene, the interfaces in the test case group are stored in a double-linked list structure, excessive manual processing is not needed, and the recording efficiency of the test cases is improved; the test case group corresponding to the target test interface is found through the interface gateway service addressing, the target test interface is tested according to the test case group, and the test result is output, so that the technical problems that in the prior art, the test case is generated manually in a targeted manner, the test script is manually input, the test efficiency is low, and the generated test case is different from data in a real scene, so that the real problem cannot be objectively reflected in the interface test are solved.
It can be clearly understood by those skilled in the art that, for convenience and simplicity of description, the specific working process of the method described above may refer to the corresponding process in the foregoing system embodiment, and details are not described herein again.
The terms "first," "second," "third," "fourth," and the like in the description of the application and the above-described figures, if any, 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 of the application described herein are, for example, capable of operation in sequences other than those illustrated or otherwise 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, system, article, or apparatus 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 apparatus.
It should be understood that in the present application, "at least one" means one or more, "a plurality" means two or more. "and/or" is used to describe the association relationship of the associated object, indicating that there may be three relationships, for example, "a and/or B" may indicate: only A, only B and both A and B are present, wherein A and B may be singular or plural. The character "/" generally indicates that the former and latter associated objects are in an "or" relationship. "at least one of the following" or similar expressions refer to any combination of these items, including any combination of the singular or plural items. For example, at least one (one) of a, b, or c, may represent: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", wherein a, b and c may be single or plural.
In the several embodiments provided in the present application, it should be understood that the disclosed 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 type of logical functional division, and other divisions may be realized in practice, for example, multiple 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 be in an electrical, mechanical or other form.
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 purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present application 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 solution of the present application may be substantially implemented or contributed to by the prior art, or all or part of the technical solution may be embodied in a software product, which is stored in a storage medium and includes instructions for executing all or part of the steps of the method described in the embodiments of the present application through a computer device (which may be a personal computer, a server, or a network device). 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.
The above embodiments are only used for illustrating the technical solutions of the present application, and not for limiting the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions in the embodiments of the present application.

Claims (10)

1. An interface test system based on simulation scenario use cases is characterized by comprising:
the data acquisition module is used for acquiring request parameters and response parameters corresponding to the test interface through a real machine simulation scene and generating a test case of the simulation scene according to the request parameters and the response parameters;
the test case assembly module is used for analyzing parameters in the test cases, and if the test interface in the simulation scene is identified to have a front node or a rear node, the test cases of the front node or the rear node of the test interface and the test cases of the test interface are stored in a test case group mode and are used as the test case group of the simulation scene, wherein the interfaces in the test case group are stored in a double-linked list structure;
and the interface link processing module is used for selecting a target test interface, finding a test case group corresponding to the target test interface through addressing of the interface gateway service, testing the target test interface according to the test case group and outputting a test result.
2. The interface test system based on simulation scenario use cases according to claim 1, wherein the data acquisition module specifically comprises:
the device comprises a setting unit, a proxy service unit and a sending unit, wherein the setting unit is used for setting hosts or proxy direction in a to-be-tested real machine so that the to-be-tested real machine can forward a received access request to the proxy service;
the proxy service is used for screening the access request and forwarding the access request belonging to the test interface to the interface processing service;
the interface processing service is used for recording request parameters of an access request corresponding to the test interface, forwarding the access request to a service platform for processing so as to obtain response parameters corresponding to the access request, and sending the request parameters and the response parameters to the data acquisition service;
and the data acquisition service is used for generating a test case according to the request parameters and the response parameters and storing the test case to a database.
3. The interface test system based on simulation scenario use case according to claim 1, wherein the test case assembly system specifically includes:
the interface parameter analysis unit is used for identifying whether the parameters in the test case have universality or not based on the interface document and storing the parameters with the universality;
and the simulation case analysis unit is used for identifying whether the test interface in the simulation scene has a front node or a rear node, if so, storing the test case of the front node or the rear node of the test interface and the test case of the test interface in a test case group mode as the test case group of the simulation scene, wherein the interfaces in the test case group are stored in a double-linked list structure.
4. The interface test system based on simulation scenario use case according to claim 3, wherein the test case assembly system further comprises:
the batch data generation unit is used for generating test cases or test case groups in batches according to the test cases or the test case groups;
and the executable verification unit is used for verifying whether the test cases or the test case groups generated in batches are available or not, and if so, storing the test cases or the test case groups into the database.
5. The interface test system according to claim 1, wherein the interface link processing module is specifically configured to:
selecting a target test interface, addressing the target test interface through an interface service gateway, and acquiring a test case group corresponding to the target test interface;
if the target test interface has a front node or a rear node, assembling a test case group corresponding to the target test interface according to the front node or the rear node of the target test interface, and adding the assembled test case group to a task queue;
and executing the test task and outputting a test result.
6. An interface test method based on simulation scenario use case is applied to the interface test system based on simulation scenario use case of any one of the preceding claims 1 to 5, and the method comprises the following steps:
acquiring a request parameter and a response parameter corresponding to a test interface through a real machine simulation scene, and generating a test case of the simulation scene according to the request parameter and the response parameter;
analyzing parameters in the test cases, if the test interface in the simulation scene is identified to have a front node or a rear node, storing the test cases of the front node or the rear node of the test interface and the test cases of the test interface in a test case group mode as the test case group of the simulation scene, wherein the interfaces in the test case group are stored in a double-linked list structure;
selecting a target test interface, finding a test case group corresponding to the target test interface through addressing of an interface gateway service, testing the target test interface according to the test case group, and outputting a test result.
7. The interface testing method based on the simulation scenario case as claimed in claim 6, wherein the obtaining of the request parameter and the response parameter corresponding to the test interface through the simulation scenario of the real machine, and the generating of the test case of the simulation scenario according to the request parameter and the response parameter comprises:
the method comprises the steps that hosts or proxy pointers are set in a true machine to be tested, so that the true machine to be tested forwards a received access request to proxy service;
screening the access request through the proxy service, and forwarding the access request belonging to the test interface to an interface processing service;
recording request parameters of an access request corresponding to the test interface through the interface processing service, forwarding the access request to a service platform for processing so as to obtain response parameters corresponding to the access request, and sending the request parameters and the response parameters to a data acquisition service;
and generating a test case according to the request parameters and the response parameters through the data acquisition service, and storing the test case to a database.
8. The interface testing method according to claim 6, wherein the analyzing parameters in the test case comprises:
and identifying whether the parameters in the test case have universality or not based on the interface document, and storing the parameters with the universality.
9. The interface testing method based on the simulation scenario use case according to claim 6, further comprising:
generating test cases or test case groups in batches according to the test cases or the test case groups;
and checking whether the test cases or the test case groups generated in batches are available, and if so, storing the test cases or the test case groups into a database.
10. The interface testing method based on the simulation scenario case as claimed in claim 6, wherein the finding of the test case group corresponding to the target test interface through the addressing of the interface gateway service, the testing of the target test interface according to the test case group, and the outputting of the test result comprises:
addressing the target test interface through an interface service gateway to obtain a test case group corresponding to the target test interface;
if the target test interface has a front node or a rear node, assembling a test case group corresponding to the target test interface according to the front node or the rear node of the target test interface, and adding the assembled test case group to a task queue;
and executing the test task and outputting a test result.
CN202210909591.9A 2022-07-29 2022-07-29 Interface test system and method based on simulation scene use case Pending CN115269415A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210909591.9A CN115269415A (en) 2022-07-29 2022-07-29 Interface test system and method based on simulation scene use case

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210909591.9A CN115269415A (en) 2022-07-29 2022-07-29 Interface test system and method based on simulation scene use case

Publications (1)

Publication Number Publication Date
CN115269415A true CN115269415A (en) 2022-11-01

Family

ID=83746288

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210909591.9A Pending CN115269415A (en) 2022-07-29 2022-07-29 Interface test system and method based on simulation scene use case

Country Status (1)

Country Link
CN (1) CN115269415A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116627849A (en) * 2023-07-24 2023-08-22 中邮消费金融有限公司 System test method, device, equipment and storage medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116627849A (en) * 2023-07-24 2023-08-22 中邮消费金融有限公司 System test method, device, equipment and storage medium
CN116627849B (en) * 2023-07-24 2024-01-26 中邮消费金融有限公司 System test method, device, equipment and storage medium

Similar Documents

Publication Publication Date Title
Cinque et al. Microservices monitoring with event logs and black box execution tracing
CN111522922B (en) Log information query method and device, storage medium and computer equipment
US10204035B1 (en) Systems, methods and devices for AI-driven automatic test generation
US8079017B2 (en) Automated QS interface testing framework
US8667147B2 (en) Monitoring related content requests
US9461871B2 (en) Client suitability test apparatus and method for a substation automating system
CN107294808A (en) The methods, devices and systems of interface testing
CN108459850B (en) Method, device and system for generating test script
EP1415307A2 (en) System and method for automated analysis of load testing results
US20100180023A1 (en) Automatic protocol detection
CN106874187A (en) code coverage collection method and device
CN110557299A (en) network transmission function batch test method, system, terminal and storage medium
US11874728B2 (en) Software application diagnostic aid
CN115269415A (en) Interface test system and method based on simulation scene use case
CN109409948B (en) Transaction abnormity detection method, device, equipment and computer readable storage medium
CN113961465A (en) Method, device and program product for processing reproduction of program crash scene
CN114895879B (en) Management system design scheme determining method, device, equipment and storage medium
CN105405220A (en) Method and device for automated test
CN109831335A (en) A kind of data monitoring method, monitor terminal, storage medium and data monitoring system
CN113127345B (en) Application testing method and device, electronic equipment and storage medium
CN110795338B (en) Front-end and back-end interaction-based automatic testing method and device and electronic equipment
KR20180035515A (en) Method for verifying a performance of clients and servers for smart ternimal
CN112199229A (en) Data processing method, device, equipment and storage medium
CN113297078B (en) MOCK system and data testing method based on same
CN112115032B (en) Log generation method and device

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