[go: up one dir, main page]
More Web Proxy on the site http://driver.im/

CN115391219A - Test case generation method and device, electronic equipment and storage medium - Google Patents

Test case generation method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN115391219A
CN115391219A CN202211086271.4A CN202211086271A CN115391219A CN 115391219 A CN115391219 A CN 115391219A CN 202211086271 A CN202211086271 A CN 202211086271A CN 115391219 A CN115391219 A CN 115391219A
Authority
CN
China
Prior art keywords
target
interface
test
link
test 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
CN202211086271.4A
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.)
Ping An Bank Co Ltd
Original Assignee
Ping An Bank 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 Ping An Bank Co Ltd filed Critical Ping An Bank Co Ltd
Priority to CN202211086271.4A priority Critical patent/CN115391219A/en
Publication of CN115391219A publication Critical patent/CN115391219A/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

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 method comprises the steps of firstly receiving a test case generation request, wherein the test case generation request carries a target link identification and test requirement information, then obtaining interface information and interface parameter transmission information of each target interface of a target link from a full link log according to the target link identification and the test requirement information, then calling each target interface according to the interface information and the interface parameter transmission information to generate an initial test case, generating target test data corresponding to the initial test case according to the interface parameter transmission information and the test requirement information, and finally filling the target test data into the initial test case to obtain the target test case. According to the method and the device, the target test case containing the target test data can be automatically generated based on the full-link log only by sending the test case generation request, so that the labor cost and the time cost of writing are reduced, and the test efficiency is greatly improved.

Description

Test case generation method and device, electronic equipment and storage medium
Technical Field
The present application relates to the field of computer technologies, and in particular, to a test case generation method and apparatus, an electronic device, and a storage medium.
Background
The automation is an important field of testing direction, and not only can the program problem be effectively identified, but also the testing work efficiency can be greatly improved. The automatic test has consistency and repeatability, can support rapid development and iteration of services, and is the key point of current automatic research on how to make automation and how to quickly respond to code change to realize T +0 automation.
In the traditional automatic test, a tester needs to manually compile an automatic test case and test data in the test case, the labor cost is high, the time consumption is long, and when related services are upgraded, the automatic test case needs to be modified after being analyzed from the head to the tail, so the efficiency is low, and the requirement of test work is difficult to meet.
Therefore, the current automated testing process has the technical problem of low testing efficiency, and needs to be improved.
Disclosure of Invention
The embodiment of the application provides a test case generation method and device, electronic equipment and a storage medium, which are used for relieving the technical problem of low test efficiency in the current automatic test process.
In order to solve the above technical problem, an embodiment of the present application provides the following technical solutions:
the application provides a test case generation method, which comprises the following steps:
receiving a test case generation request, wherein the test case generation request carries a target link identifier and test requirement information;
acquiring interface information and interface transmission parameter information of each target interface of the target link from the full link log according to the target link identification and the test requirement information;
calling each target interface to generate an initial test case according to the interface information and the interface parameter information;
generating target test data corresponding to the initial test case according to the interface parameter information and the test requirement information;
and filling the target test data into the initial test case to obtain a target test case.
Meanwhile, an embodiment of the present application further provides a test case generation apparatus, including:
the system comprises a receiving module, a sending module and a receiving module, wherein the receiving module is used for receiving a test case generation request which carries a target link identification and test requirement information;
the acquisition module is used for acquiring interface information and interface transmission parameter information of each target interface of the target link from the full link log according to the target link identification and the test requirement information;
the calling module is used for calling each target interface to generate an initial test case according to the interface information and the interface parameter information;
the generating module is used for generating target test data corresponding to the initial test case according to the interface parameter information and the test requirement information;
and the obtaining module is used for filling the target test data into the initial test case to obtain a target test case.
The application also provides an electronic device comprising a memory and a processor; the memory stores an application program, and the processor is configured to run the application program in the memory to execute the steps in the test case generation method.
An embodiment of the present application provides a computer-readable storage medium, where multiple instructions are stored in the computer-readable storage medium, and the instructions are suitable for being loaded by a processor to execute steps in the test case generation method.
Has the advantages that: the method comprises the steps of firstly receiving a test case generation request, wherein the test case generation request carries a target link identifier and test requirement information, then obtaining interface information and interface transmission parameter information of each target interface of a target link from a full link log according to the target link identifier and the test requirement information, then calling each target interface according to the interface information and the interface transmission parameter information to generate an initial test case, generating target test data corresponding to the initial test case according to the interface transmission parameter information and the test requirement information, and finally filling the target test data into the initial test case to obtain the target test case. According to the method and the device, the target test case containing the target test data can be automatically generated based on the full-link log only by sending the test case generation request, so that the labor cost and the time cost of writing are reduced, and the test efficiency is greatly improved.
Drawings
The technical solutions and other advantages of the present application will become apparent from the following detailed description of specific embodiments of the present application when taken in conjunction with the accompanying drawings.
Fig. 1 is a schematic application scenario diagram of a test case generation method provided in an embodiment of the present application.
Fig. 2 is a flowchart illustrating a test case generation method according to an embodiment of the present disclosure.
Fig. 3 is an architecture diagram of a test case generation method provided in the embodiment of the present application.
Fig. 4 is a schematic structural diagram of a test case generating device according to an embodiment of the present application.
Fig. 5 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
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. It is to be understood that the embodiments described are only a few embodiments of the present application and not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
The embodiment of the application provides a test case generation method, a test case generation device, electronic equipment and a computer-readable storage medium, wherein the test case generation device can be integrated in the electronic equipment, and the electronic equipment can be a server or a terminal and other equipment.
Referring to fig. 1, fig. 1 is a schematic view of a scenario of an application of a test case generation method provided in an embodiment of the present application, where the scenario may include terminals and servers, and the terminals, the servers, and the terminals and the servers are connected and communicated through an internet formed by various gateways, and the application scenario includes a user terminal 11 and a server 12; the user terminal 11 may be a device with a man-machine interaction function; the server 12 includes a local server and/or a remote server, etc.
The user terminal 11 and the server 12 are located in a wireless network or a wired network to realize data interaction between the two, wherein:
the tester performs configuration operation on the interface of the user terminal 11 to generate a test case generation request, where the test case generation request carries the target link identifier and the test requirement information. The server 12 receives the test case generation request, searches a full link log of the service system according to the target link identification and the test requirement information carried by the test case generation request, acquires interface information and interface parameter transmission information of each target interface of the target link from the full link log, calls each target interface to generate an initial test case according to the interface information and the interface parameter transmission information, generates target test data corresponding to the initial test case according to the interface parameter transmission information and the test requirement information, and finally fills the target test data into the initial test case to obtain the target test case and returns the target test case to the user terminal 11. After obtaining the target test case from the user terminal 11, the tester may use the target test case for the automated testing.
It should be noted that the system scenario schematic diagram shown in fig. 1 is only an example, and the server and the scenario described in the embodiment of the present application are used to illustrate the technical solution of the embodiment of the present application more clearly, and do not form a limitation on the technical solution provided in the embodiment of the present application, and as a person of ordinary skill in the art knows, with the evolution of the system and the occurrence of a new service scenario, the technical solution provided in the embodiment of the present application is also applicable to similar technical problems. The following are detailed below. It should be noted that the following description of the embodiments is not intended to limit the preferred order of the embodiments.
Referring to fig. 2, fig. 2 is a schematic flowchart of a test case generation method provided in an embodiment of the present application, where the method specifically includes:
s1: and receiving a test case generation request, wherein the test case generation request carries the target link identification and the test requirement information.
The test case is a document which is composed of preconditions, test input, execution conditions, expected results and the like, is used for completing data of a certain specific requirement or target test, and embodies a test scheme, a method, a technology and a strategy. A test case may generally include a number of elements, which may include, for example, a case number, an item to which it belongs, preset conditions, test inputs, expected outputs, execution conditions, summaries, levels, and the like. Specifically, the test case number is a character string formed by combining characters and numbers, and the case number has uniqueness and is easy to identify; the belonging item is used for indicating which item or module, unit and the like the test case belongs to; the preset conditions refer to the preconditions required by executing the current test case, and if the preconditions are not met, the following test steps cannot be carried out or expected results cannot be achieved; the test input refers to data needing to be input in the test case execution process; the expected output refers to an expected output result of the test case, and comprises return value content, an interface response result and the like; the execution conditions comprise operation steps of which interfaces, the sequence of each interface and the service corresponding to each interface are needed to be passed by executing the current test case, and the description of each step needs to be explicitly given; the summary refers to describing the test points of the test case by using a summarized language; the level refers to the test importance level of the current test case, such as high level, medium level, low level, etc.
In the embodiment of the application, when a test case needs to be generated, a test case generation request is received first, where the request may be initiated after a tester executes a relevant configuration operation on a test case generation interface of a client and is received by a server. In the process of completing a service, from a request to the last service completion response, all the passed services in the middle and the calling relationship among the services form a link. The links corresponding to different services are not exactly the same, for example, for a more complex service, more services are involved, and for a simple service, fewer services are involved.
In the embodiment of the application, the test case generation request carries the target link identifier and the test requirement information, the test case is generated based on the test requirement, the test requirement information is used for indicating what service is used for testing when the test case needs to be generated, and the target link identifier is used for indicating which link needs to be called when the service is completed.
In the process of completing a certain service, when a service request is processed by all services in sequence, an identifier, namely trace _ id, is generated by the first invoked service, and then the identifier is transmitted to the downstream services in sequence until the final service response. The identifier may be used to indicate all services that the current service needs to invoke, and each service forms a target link, so that the identifier may serve as a target link identifier. It should be noted that a complex service may include multiple links, some of which may form a small service separately, and for a service request of a certain complex service of the service system, after a service response generated by a certain small service is completed, the following small services may be completed continuously, and the trace _ id may be transmitted continuously, so that the small services may correspond to a same target link identifier, and the test requirement information is used to determine whether the complex large service needs to be completed or one or some of the small services.
S2: and acquiring interface information and interface transmission parameter information of each target interface of the target link from the full link log according to the target link identification and the test requirement information.
For a service system, it includes multiple services, each service provides its own logic function, and can be called each other, according to the different of the service type, quantity, call relation participating in a certain service, the service system can form multiple different links, in order to finish different services. In the processing process of each service, each link generates a log, all logs of the service system form a full link log, and the full link log records the details of the process when all received requests in the service system are processed by each service.
Each service has its own interface, and the interface information and the interface parameter information of each interface are recorded in the full link log, where the interface information may include an identifier of each interface, a protocol of the interface, a service or application corresponding to the interface, time for calling the interface, and the like, and the interface parameter information includes a parameter type, a format, a value, and the like transmitted and received by the interface. After the target link identification and the test requirement information are obtained, the target link can be determined according to the target link identification, the target interfaces are determined from all the interfaces of the target link according to the test requirement information, and then the interface information and the interface reference information of the target interfaces are obtained from the full link log.
In an embodiment, S2 specifically includes: determining a target link from the full link log according to the target link identification, and determining all interfaces in the target link and the calling sequence of each interface; determining a starting interface and an ending interface of a target link according to the test requirement information, and determining a target interface in the target link according to the starting interface, the ending interface and the calling sequence; and acquiring interface information and interface parameter information of each target interface from the full link log. Firstly, according to the target link identification, the target link is determined from the full link log, then the services corresponding to the target link are determined, and the interfaces of all the services and the calling sequence among the interfaces are obtained. Then, determining what the service corresponding to the test case is specifically, what the initial link and the ending link of the service are respectively, further determining the initial service and the ending service from the target link, and determining the corresponding initial interface and ending interface. Then, according to the obtained calling sequence between the interfaces, determining other interfaces between the starting interface and the ending interface, determining the starting interface, the ending interface and the middle interfaces as target interfaces, and finally obtaining interface information and interface transmission parameter information of all the target interfaces.
In one embodiment, the target link includes at least one sublink, the sublink includes at least two interfaces, the step of determining a start interface and an end interface of the target link according to the test requirement information, and determining a target interface in the target link according to the start interface, the end interface and the calling sequence includes: determining a target sublink in the target link according to the test requirement information, and determining a starting interface and an ending interface of the target sublink; and determining a target interface in the target sublink according to the starting interface, the ending interface and the calling sequence.
In the above embodiments, a complex large service in the system corresponds to a long link, and the large service may be a combination of several small services, where each small service corresponds to a small segment in the link, that is, a sub-link. For example, for a loan transaction, the loan transaction may be divided into a plurality of sub-transactions such as a loan request, a loan approval, a loan payment, and the like, where the entire loan transaction corresponds to a complete loan link, the loan link further includes a plurality of sub-links such as a loan request sub-link, a loan approval sub-link, and a loan payment sub-link, and the completion of each sub-transaction also needs to pass through a plurality of steps, and thus each sub-link includes at least two interfaces. In this embodiment, a sub-service is determined according to the test requirement information, and then a target sub-link in the target link is determined, where the target sub-link has a start interface and an end interface, and then all target interfaces in the target sub-link are determined according to a call sequence between the interfaces. For example, when the test requirement information indicates that the whole loan service needs to be completed, all the sublinks in the whole loan link are target sublinks, and all the interfaces are target interfaces; and when the test requirement information indicates that only the service of loan approval needs to be completed, the sub-link of loan approval is only needed to be used as a target sub-link, and all interfaces contained in the sub-link are used as target interfaces. Through the process, the test case generation requirements under different scenes are met.
In one embodiment, the test requirement information includes a first link length, and the step of determining the target sub-link in the target link according to the test requirement information includes: acquiring a second link length of each sub-link; matching the first link length with each second link length to obtain a first matching result; and determining a target sublink in the target link according to the first matching result.
In some cases, when a certain target link is selected and a test case is to be constructed for a service corresponding to one or some of the sublinks, but it is not clear to a tester that the sub-services in the current link are divided or the division of the sub-services is known, but a test case corresponding to a plurality of sublinks is to be generated at one time through a simpler operation, at this time, the test requirement information may include the first link length, that is, it indicates that all sublinks having the same length are to be acquired from the target link. Then, the server acquires a second link length of each sub-link from the full link log, matches each second link length with the first link length, takes the corresponding sub-link as a target sub-link if the second link length equal to the first link length exists, returns a non-existent response if the second link length does not exist, and takes the corresponding sub-links as the target sub-links if a plurality of second link lengths equal to the first link length exist. For example, if the first link length in the test requirement information is 10 and the second link lengths of the sub-links are 8, 10, 6, and 10, respectively, two sub-links having the second link length of 10 are used as the target sub-links. Through the operation, the test cases corresponding to all the sub-links which are in accordance with the target link can be generated only by executing the configuration operation on the length of the first link on the corresponding test case generation interface, so that the batch generation is realized, and the efficiency is improved.
In one embodiment, the test requirement information includes a first service function, and the step of determining a target sublink in the target link according to the test requirement information includes: acquiring a second service function of each sub-link; matching the first service function with each second service function to obtain a second matching result; and determining a target sublink in the target link according to the second matching result.
Under some conditions, a tester knows which sub-services exist in the services corresponding to a target link, the tester directly makes test requirement information include a first service function, the first service function is used for indicating which sub-service needs to be requested, a server can obtain a second service function of each sub-link from a full link log, the second service function is matched with the first service function, if the second service function which is the same as the first service function exists, the sub-link corresponding to the second service function is used as the target sub-link, and if the second service function does not exist, a nonexistent response is returned. When the test cases corresponding to the multiple sub-services need to be generated, the test requirement information can include multiple independent first service functions or a set of multiple first service functions, for example, when the test requirement information includes independent loan approval sub-services and loan payment release sub-services, target sub-links corresponding to the two sub-services can be respectively obtained, and test cases corresponding to the two sub-services are respectively generated in the subsequent process.
S3: and calling each target interface to generate an initial test case according to the interface information and the interface parameter information.
The interface information comprises identification of each interface, protocol of the interface, service or application corresponding to the interface, time for calling the interface and the like, the interface parameter transmission information comprises parameter types, formats, numerical values and the like transmitted and received by the interface, and after the interface information and the interface parameter transmission information of each target interface are obtained, each target interface is called to generate an initial test case. Specifically, the target interfaces are called according to the interface information, so that execution logics of the services corresponding to the target interfaces are obtained, and the execution conditions of the test cases can be generated according to the sequence of the target interfaces and the execution logics of the services. According to the interface parameter information, the test input, the expected output and the like of the test case can be determined. And the environment of each target interface during each calling, such as a network environment, a system environment and the like, is obtained from the full link log, so that the preset conditions of the test case can be determined. Finally, the initial test case can be formed by combining the preset conditions, the test input, the expected output, the execution conditions and the like and adding the elements such as the case number, the belonged item, the summary, the level and the like.
S4: and generating target test data corresponding to the initial test case according to the interface parameter information and the test requirement information.
The test requirement information indicates what service is to be tested when the test case is to be generated, and also indicates what kind of scenario is to be tested, specifically, the test scenario may include a normal scenario and an abnormal scenario, and each scenario may include various situations such as a single test and batch test, for example, a scenario in which a users simultaneously request in an xx time period, a scenario in which b users sequentially request in an xx time period, and the like. In different scenarios, the required test data, which includes test inputs and expected outputs, is different, and for a single requested test scenario, it requires a smaller amount of test data, whereas for a batch requested test scenario it requires a larger amount of test data. In the initial test case obtained in the above step, the data volume of the interface parameter transmission information is limited, so it is necessary to determine how much test data is needed according to the test requirement information, determine what each test data is respectively according to the interface parameter transmission information, and then generate test input and expected output data which are matched with the test requirement quantity and are similar to the interface parameter transmission information as the target test data corresponding to the initial test case.
In an embodiment, S4 specifically includes: determining a test scene required by an initial test case according to the test requirement information; acquiring first interface parameter transmission information under each test scene in a historical time period from a full link log; and generating target test data corresponding to the initial test case according to the first interface parameter information.
In this embodiment, the test scenarios required for the initial test case are determined according to the test requirement information, the test scenarios include 3 scenarios 1 that are respectively requested and successful by multiple users at the same time, each user sequentially requests and successful scenarios 2, and the multiple users request only partially successful scenarios 3 at the same time. After the test scene is determined, the first interface parameter information of all target interfaces under the 3 types of test scenes is obtained from the full link log, data in a certain historical time period can be obtained as the required data volume relates to a plurality of users, and the duration and time of the historical time period can be selected according to the test requirements. For scenario 1, the first interface parameter transmission information includes request data and successful response data when m users request simultaneously, for scenario 2, the first interface parameter transmission information includes request data and successful response data when n users request sequentially, and for scenario 3, the first interface parameter transmission information includes request data when s users request simultaneously, and a part of successful response data and a part of failed response data.
After the first interface parameter transmission information is obtained, processing request data in the first interface parameter transmission information into test input required by an initial test case, and processing response data into expected output required by the initial test case to obtain target test data corresponding to the initial test case. That is, after the test requirement information is obtained, all the required target test data can be obtained from the full link log, and the test data is derived from the real data of the client in the mode, so that the test accuracy is higher.
In one embodiment, S4 specifically includes: determining a test scene required by an initial test case according to the test requirement information; and acquiring second interface parameter transmission information under each test scene in a historical time period from the full link log, and generating target test data corresponding to the initial test case according to the second interface parameter transmission information and a preset model.
In this embodiment, a test scenario required by an initial test case is determined according to test requirement information, where the test scenario includes 3 types, and includes scenario 1 in which a plurality of users simultaneously submit requests and succeed, scenario 2 in which each user successively submits requests and succeeds, scenario 3 in which a plurality of users simultaneously submit requests and succeed only partially, and 10 tests are required in each type of scenario. After the test scene is determined, the second interface parameter information of all target interfaces under the 3 types of test scenes is obtained from the full link log, data in a certain historical time period can be obtained as the required data volume relates to a plurality of users, and the duration and time of the historical time period can be selected according to the test requirements. For scenario 1, the second interface parameter transmission information includes request data and successful response data when m users request simultaneously, for scenario 2, the second interface parameter transmission information includes request data and successful response data when n users request sequentially, and for scenario 3, the second interface parameter transmission information includes request data when s users request simultaneously, and a part of successful response data and a part of failed response data.
After the second interface parameter information is obtained, because the data volume of the test data required by some scenarios is large, the data volume of the real user recorded in the full link log may not be enough to support the test requirement, for example, data for 100 users to initiate access simultaneously is desired to be tested, but only data for 30 users to initiate access simultaneously is recorded in the full link log, and the required data cannot be directly obtained from the full link log. At this time, the actual test input and the expected output may be analyzed according to the second interface parameter information, and then a preset model is called to create data of the remaining 70 users, or create data of new 100 users, and these data are used as target test data. That is, the method and the device can be combined with a preset modeling model, and when a test case is required to be generated, the preset modeling model is called to analyze the interface parameter information to create required test data, so that the requirement of mass tests can be met efficiently.
S5: and filling the target test data into the initial test case to obtain the target test case.
And after the target test data is obtained, filling the target test data into the initial test case according to a specific format to obtain the target test case required by the final test.
According to the embodiments, the test case generation method of the application includes the steps of firstly receiving a test case generation request, wherein the test case generation request carries a target link identifier and test requirement information, then obtaining interface information and interface parameter transmission information of each target interface of a target link from a full link log according to the target link identifier and the test requirement information, then calling each target interface according to the interface information and the interface parameter transmission information to generate an initial test case, generating target test data corresponding to the initial test case according to the interface parameter transmission information and the test requirement information, and finally filling the target test data into the initial test case to obtain the target test case. According to the method and the device, the target test case containing the target test data can be automatically generated based on the full-link log only by sending the test case generation request, so that the labor cost and the time cost of writing are reduced, and the test efficiency is greatly improved.
The above method is further described below with reference to fig. 3. In fig. 3, it is assumed that the service system includes a service 1, a service 2, a service 3, and a service 4, an interface 1 of the service 1 calls an interface 2 of the service 2, an interface 3 of the service 2 calls an interface 4 of the service 3, an interface 5 of the service 2 calls an interface 6 of the service 4, and an interface 7 of the service 4 calls an interface 8 of the service 3. According to the calling relation, the service 1, the service 2 and the service 3 can form a link 1, the service 2, the service 4 and the service 3 can form a link 2, when the services perform mutual modulation, various data generated are all recorded in a log, and the log of the whole system forms a full-link log.
When a test case needs to be generated, a tester configures test requirement information on an interface and selects a required link, for example, the link 1, a generated test case generation request carries a target link identifier and test requirement information, a server acquires interface information and interface transmission parameter information of each target interface of the link 1 from a full link log according to the target link identifier and the test requirement information, the target interface comprises an interface 1, an interface 2, an interface 3 and an interface 4, then calls each target interface to generate an initial test case, generates target test data corresponding to the initial test case, and finally fills the target test data into the initial test case to obtain the target test case.
In the whole process, a tester only needs to execute some configuration operations on the front-end interface and initiate a request, the server can automatically execute the subsequent steps to obtain the relevant information of the target interface of the target link and call one interface key to generate a test case, the operation is simple, and the requirements on the skills of the tester are reduced. And when the service changes, the test case does not need to be modified, and the latest test case can be obtained only by re-executing the steps, so that the construction cost and the maintenance cost of the test case are greatly reduced.
Based on the method described in the foregoing embodiment, the embodiment will be further described from the perspective of a test case generating device, referring to fig. 4, where the test case generating device may include:
a receiving module 110, configured to receive a test case generation request, where the test case generation request carries a target link identifier and test requirement information;
an obtaining module 120, configured to obtain interface information and interface parameter information of each target interface of the target link from the full link log according to the target link identifier and the test requirement information;
the calling module 130 is configured to call each target interface to generate an initial test case according to the interface information and the interface parameter information;
a generating module 140, configured to generate target test data corresponding to the initial test case according to the interface parameter information and the test requirement information;
an obtaining module 150, configured to fill the target test data into the initial test case to obtain a target test case.
In one embodiment, the obtaining module 120 includes:
a first determining module, configured to determine a target link from the full link log according to the target link identifier, and determine all interfaces in the target link and a call sequence of each interface;
a second determining module, configured to determine a starting interface and an ending interface of the target link according to the test requirement information, and determine a target interface in the target link according to the starting interface, the ending interface, and the calling sequence;
the first acquisition module is used for acquiring the interface information and the interface parameter information of each target interface from the full link log.
In one embodiment, the target link includes at least one sublink, the sublink includes at least two interfaces, and the second determining module includes:
the first determining submodule is used for determining a target sublink in the target link according to the test requirement information and determining a starting interface and an ending interface of the target sublink;
and the second determining submodule is used for determining a target interface in the target sublink according to the starting interface, the ending interface and the calling sequence.
In one embodiment, the test requirement information includes a first link length, and the first determining sub-module includes:
a first obtaining unit, configured to obtain a second link length of each sub-link;
the first matching unit is used for matching the first link length with each second link length to obtain a first matching result;
a first determining unit, configured to determine a target sub-link in the target link according to the first matching result.
In one embodiment, the test requirement information includes a first service function, and the first determining sub-module includes:
a second obtaining unit, configured to obtain a second service function of each sub-link;
the second matching unit is used for matching the first service function with each second service function to obtain a second matching result;
and the third determining unit is used for determining a target sublink in the target link according to the second matching result.
In one embodiment, the generation module 140 includes:
the third determining submodule is used for determining a test scene required by the initial test case according to the test requirement information;
the second acquisition sub-module is used for acquiring the first interface parameter information under each test scene in the historical time period from the full link log;
and the first generation submodule is used for generating target test data corresponding to the initial test case according to the first interface parameter information.
In one embodiment, the generation module 140 includes:
the fourth determining submodule is used for determining a test scene required by the initial test case according to the test requirement information;
the third obtaining submodule is used for obtaining second interface parameter information under each test scene in a historical time period from the full link log;
and the second generation submodule is used for generating target test data corresponding to the initial test case according to the second interface parameter information and a preset modeling model.
Different from the prior art, the test case generation device provided by the application receives a test case generation request, the test case generation request carries a target link identifier and test requirement information, then acquires interface information and interface transmission parameter information of each target interface of a target link from a full link log according to the target link identifier and the test requirement information, calls each target interface to generate an initial test case according to the interface information and the interface transmission parameter information, generates target test data corresponding to the initial test case according to the interface transmission parameter information and the test requirement information, and finally fills the target test data into the initial test case to obtain the target test case. According to the method and the device, the target test case containing the target test data can be automatically generated based on the full-link log only by sending the test case generation request, so that the labor cost and the time cost of writing are reduced, and the test efficiency is greatly improved.
Accordingly, an electronic device may include, as shown in fig. 5, a Radio Frequency (RF) circuit 501, a memory 502 including one or more computer-readable storage media, an input unit 503, a display unit 504, a sensor 505, an audio circuit 506, a WiFi module 507, a processor 508 including one or more processing cores, and a power supply 509. Those skilled in the art will appreciate that the electronic device configuration shown in fig. 5 does not constitute a limitation of the electronic device and may include more or fewer components than those shown, or some components may be combined, or a different arrangement of components. Wherein:
the rf circuit 501 may be used for receiving and transmitting signals during information transmission and reception or during a call, and particularly, for receiving downlink information of a base station and then sending the received downlink information to one or more processors 508 for processing; in addition, data relating to uplink is transmitted to the base station. The memory 502 may be used to store software programs and modules, and the processor 508 executes various functional applications and test case generation by running the software programs and modules stored in the memory 502. The input unit 503 may be used to receive input numeric or character information and generate keyboard, mouse, joystick, optical or trackball signal inputs related to client settings and function control.
The display unit 504 may be used to display information input by or provided to the client and various graphical client interfaces of the server, which may be made up of graphics, text, icons, video, and any combination thereof.
The electronic device can also include at least one sensor 505, such as a light sensor, motion sensor, and other sensors. The audio circuitry 506 includes speakers that provide an audio interface between the customer and the electronic device.
WiFi belongs to short-distance wireless transmission technology, and the electronic equipment can help a client to send and receive e-mails, browse webpages, follow-up streaming media and the like through the WiFi module 507, and provides wireless broadband internet follow-up for the client. Although fig. 5 shows the WiFi module 507, it is understood that it does not belong to the essential constitution of the electronic device, and may be omitted entirely as needed within a range not changing the essence of the application.
The processor 508 is a control center of the electronic device, connects various parts of the entire mobile phone by using various interfaces and lines, and performs various functions of the electronic device and processes data by operating or executing software programs and/or modules stored in the memory 502 and calling data stored in the memory 502, thereby integrally monitoring the mobile phone.
The electronic device also includes a power supply 509 (e.g., a battery) for powering the various components, which may preferably be logically coupled to the processor 508 via a power management system to manage charging, discharging, and power consumption management functions via the power management system.
Although not shown, the electronic device may further include a camera, a bluetooth module, and the like, which are not described in detail herein. Specifically, in this embodiment, the processor 508 in the server loads the executable file corresponding to the process of one or more application programs into the memory 502 according to the following instructions, and the processor 508 runs the application program stored in the memory 502, so as to implement the following functions:
receiving a test case generation request, wherein the test case generation request carries a target link identifier and test requirement information;
acquiring interface information and interface transmission parameter information of each target interface of the target link from the full link log according to the target link identification and the test requirement information;
calling each target interface to generate an initial test case according to the interface information and the interface parameter information;
generating target test data corresponding to the initial test case according to the interface transmission parameter information and the test requirement information;
and filling the target test data into the initial test case to obtain a target test case.
In the above embodiments, the descriptions of the respective embodiments have respective emphasis, and parts that are not described in detail in a certain embodiment may refer to the above detailed description, and are not described herein again.
It will be understood by those skilled in the art that all or part of the steps of the methods of the above embodiments may be performed by instructions or by associated hardware controlled by the instructions, which may be stored in a computer readable storage medium and loaded and executed by a processor.
To this end, an embodiment of the present application provides a computer-readable storage medium, in which a plurality of instructions are stored, and the instructions can be loaded by a processor to implement the following functions:
receiving a test case generation request, wherein the test case generation request carries a target link identification and test requirement information;
acquiring interface information and interface transmission parameter information of each target interface of the target link from the full link log according to the target link identification and the test requirement information;
calling each target interface to generate an initial test case according to the interface information and the interface parameter information;
generating target test data corresponding to the initial test case according to the interface transmission parameter information and the test requirement information;
and filling the target test data into the initial test case to obtain a target test case.
The test case generation method, the test case generation device, the electronic device and the computer-readable storage medium provided by the embodiments of the present application are introduced in detail, and a specific example is applied to illustrate the principle and the implementation of the present application, and the description of the embodiments is only used to help understanding the technical scheme and the core idea of the present application; those of ordinary skill in the art will understand that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; such modifications or substitutions do not depart from the spirit and scope of the present disclosure as defined by the appended claims.

Claims (10)

1. A test case generation method is characterized by comprising the following steps:
receiving a test case generation request, wherein the test case generation request carries a target link identifier and test requirement information;
according to the target link identification and the test requirement information, acquiring interface information and interface transmission parameter information of each target interface of the target link from a full link log;
calling each target interface to generate an initial test case according to the interface information and the interface parameter information;
generating target test data corresponding to the initial test case according to the interface parameter information and the test requirement information;
and filling the target test data into the initial test case to obtain a target test case.
2. The method for generating test cases according to claim 1, wherein the step of obtaining interface information and interface parameter information of each target interface of the target link from the full link log according to the target link identifier includes:
determining a target link from the full link log according to the target link identification, and determining all interfaces in the target link and the calling sequence of each interface;
determining a starting interface and an ending interface of the target link according to the test requirement information, and determining a target interface in the target link according to the starting interface, the ending interface and the calling sequence;
and acquiring interface information and interface transmission parameter information of each target interface from the full link log.
3. The method according to claim 2, wherein the target link includes at least one sub-link, the sub-link includes at least two interfaces, the method determines a start interface and an end interface of the target link according to the test requirement information, and the method determines a target interface in the target link according to the start interface, the end interface and the calling order, and includes:
determining a target sublink in the target link according to the test requirement information, and determining a starting interface and an ending interface of the target sublink;
and determining a target interface in the target sublink according to the starting interface, the ending interface and the calling sequence.
4. The method for generating test cases according to claim 3, wherein the test requirement information includes a first link length, and the step of determining the target sublink in the target link according to the test requirement information includes:
acquiring a second link length of each sub-link;
matching the first link length with each second link length to obtain a first matching result;
and determining a target sublink in the target link according to the first matching result.
5. The method according to claim 3, wherein the test requirement information includes a first service function, and the step of determining a target sublink in the target link according to the test requirement information includes:
acquiring a second service function of each sub-link;
matching the first service function with each second service function to obtain a second matching result;
and determining a target sublink in the target link according to the second matching result.
6. The method for generating the test case according to claim 1, wherein the step of generating the target test data corresponding to the initial test case according to the interface parameter information and the test requirement information includes:
determining a test scene required by the initial test case according to the test requirement information;
acquiring first interface transmission parameter information under each test scene in a historical time period from a full link log;
and generating target test data corresponding to the initial test case according to the first interface parameter information.
7. The method for generating the test case according to claim 1, wherein the step of generating the target test data corresponding to the initial test case according to the interface parameter information and the test requirement information includes:
determining a test scene required by the initial test case according to the test requirement information;
acquiring second interface transmission parameter information under each test scene in a historical time period from the full link log;
and generating target test data corresponding to the initial test case according to the second interface parameter information and a preset model.
8. A test case generation apparatus, comprising:
the system comprises a receiving module, a sending module and a processing module, wherein the receiving module is used for receiving a test case generation request which carries a target link identification and test requirement information;
the acquisition module is used for acquiring interface information and interface transmission parameter information of each target interface of the target link from the full link log according to the target link identification and the test requirement information;
the calling module is used for calling each target interface to generate an initial test case according to the interface information and the interface transmission parameter information;
the generating module is used for generating target test data corresponding to the initial test case according to the interface transmission parameter information and the test requirement information;
and the obtaining module is used for filling the target test data into the initial test case to obtain a target test case.
9. An electronic device comprising a memory and a processor; the memory stores an application program, and the processor is configured to run the application program in the memory to perform the steps of the test case generation method according to any one of claims 1 to 7.
10. A computer-readable storage medium, having a computer program stored thereon, the computer program being executable by a processor to implement the steps in the test case generation method of any one of claims 1 to 7.
CN202211086271.4A 2022-09-06 2022-09-06 Test case generation method and device, electronic equipment and storage medium Pending CN115391219A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211086271.4A CN115391219A (en) 2022-09-06 2022-09-06 Test case generation method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211086271.4A CN115391219A (en) 2022-09-06 2022-09-06 Test case generation method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN115391219A true CN115391219A (en) 2022-11-25

Family

ID=84125118

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211086271.4A Pending CN115391219A (en) 2022-09-06 2022-09-06 Test case generation method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN115391219A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116795723A (en) * 2023-08-21 2023-09-22 建信金融科技有限责任公司 Chain unit test processing method and device and computer equipment
CN117033249A (en) * 2023-10-08 2023-11-10 卓望数码技术(深圳)有限公司 Test case generation method and device, computer equipment and storage medium

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116795723A (en) * 2023-08-21 2023-09-22 建信金融科技有限责任公司 Chain unit test processing method and device and computer equipment
CN116795723B (en) * 2023-08-21 2023-11-21 建信金融科技有限责任公司 Chain unit test processing method and device and computer equipment
CN117033249A (en) * 2023-10-08 2023-11-10 卓望数码技术(深圳)有限公司 Test case generation method and device, computer equipment and storage medium

Similar Documents

Publication Publication Date Title
CN111401722B (en) Intelligent decision method and intelligent decision system
CN115391219A (en) Test case generation method and device, electronic equipment and storage medium
CN108228444B (en) Test method and device
CN110046091B (en) Automatic test method and device
CN113485880A (en) Test method and device
CN110659870A (en) Business audit test method, device, equipment and storage medium
CN113806037A (en) Service calling method and device, storage medium and electronic equipment
CN116974874A (en) Database testing method and device, electronic equipment and readable storage medium
CN112799782A (en) Model generation system, method, electronic device, and storage medium
CN110888800A (en) Service interaction function test method, device, storage medium and test system
CN113064816B (en) Testing device and testing method for programmable logic device software
CN115883310A (en) Service deployment method, service deployment system, electronic device, and storage medium
CN116150029A (en) Automatic overdue batch testing method and device for loan system
CN115080412A (en) Software update quality evaluation method, device, equipment and computer storage medium
CN113609017A (en) Interface test case generation method and device
CN113515447A (en) System automation test method and device
CN112948195A (en) Interface testing method and device, electronic equipment and storage medium
CN111159988A (en) Model processing method and device, computer equipment and storage medium
CN116795611A (en) Test method, test device, electronic equipment and storage medium
CN116166545A (en) Test environment creation method, test environment creation device, medium and electronic device
CN116820973A (en) Automatic test method and system based on pseudo code
CN115967638A (en) Equipment simulation system, method, equipment and storage medium
CN117370209A (en) Application program performance test method, device, medium and electronic equipment
CN118820079A (en) Software testing method, system, electronic equipment and storage medium
CN117670236A (en) Mobile-terminal-based to-be-handled flow approval method, device, equipment and 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