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

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

Info

Publication number
CN110750442B
CN110750442B CN201910842034.8A CN201910842034A CN110750442B CN 110750442 B CN110750442 B CN 110750442B CN 201910842034 A CN201910842034 A CN 201910842034A CN 110750442 B CN110750442 B CN 110750442B
Authority
CN
China
Prior art keywords
test
target interface
test data
parameter
data
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.)
Active
Application number
CN201910842034.8A
Other languages
Chinese (zh)
Other versions
CN110750442A (en
Inventor
邹娟
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Ping An Medical Health Technology Service Co Ltd
Original Assignee
Shenzhen Ping An Medical Health Technology Service 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 Shenzhen Ping An Medical Health Technology Service Co Ltd filed Critical Shenzhen Ping An Medical Health Technology Service Co Ltd
Priority to CN201910842034.8A priority Critical patent/CN110750442B/en
Publication of CN110750442A publication Critical patent/CN110750442A/en
Application granted granted Critical
Publication of CN110750442B publication Critical patent/CN110750442B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/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 invention discloses a method, a device, equipment and a storage medium for generating a test case. When a test request message for a target interface is received, a target interface template corresponding to the target interface is acquired from a pre-stored storage area; analyzing the test request message, and acquiring the input parameter data of the target interface from the analysis result, wherein the input parameter data comprises a plurality of parameter fields; respectively acquiring the field configuration type of each parameter field in the input parameter data, and generating a test data set corresponding to the field configuration type; and finally, packaging each test data set according to the target interface template, taking the packaging result as a test case of the target interface, and further automatically generating a test case covering different parameter fields for the target interface.

Description

Test case generation method, device, equipment and storage medium
Technical Field
The present invention relates to the field of software testing, and in particular, to a method, an apparatus, a device, and a storage medium for generating a test case.
Background
Software testing is the process of using manual operations or automated execution of software to verify that it meets specified requirements or to figure out differences between expected and actual results.
At present, when a tester manually tests a certain interface, the tester needs to use a plurality of different interface test cases one by one to test the interface until the interface is successfully tested.
For test cases with different dimensions such as types, necessary padding, lengths, interval values and the like of each field of an interface, when testers design the interface fields one by one manually or by using an auxiliary tool, the operability of the testers is poor due to the fact that the number of the interface fields is large, and the time consumption of the test data design of each field and the combined design of each field is long;
testers can only manually cover part of a scene in consideration of time, and many situations exist in which unnecessary fields are not filled and part of dimensions are not tested. When the interface is changed, the manually designed cases need to be checked and modified one by one, and the maintenance cost is too high.
The above is only for the purpose of assisting understanding of the technical solution of the present invention, and does not represent an admission that the above is the prior art.
Disclosure of Invention
The invention mainly aims to provide a test case generation method, a test case generation device, a test case generation terminal and a storage medium, and aims to solve the problems that in the prior art, a tester needs to call a plurality of different test cases one by one in the software testing process, so that the testing efficiency is low and the testing process is not smooth.
In order to achieve the above object, the present invention provides a method for generating a test case, including the following steps:
when a test request message for a target interface is received, acquiring a target interface template corresponding to the target interface from a prestored storage area;
analyzing the test request message, and acquiring the input parameter data of the target interface from an analysis result, wherein the input parameter data comprises a plurality of parameter fields;
respectively acquiring the field configuration type of each parameter field in the parameter data, and generating a test data set corresponding to the field configuration type;
and packaging each test data set according to the target interface template, and taking a packaging result as a test case of the target interface.
Preferably, the parameter field is key-value pair data;
the step of analyzing the test request message and acquiring the access parameter data of the target interface from the analysis result comprises the following steps:
analyzing the test request;
and when the test request is analyzed to be in the JSON format, carrying out serialization processing on the test request to obtain the input parameter data of the target interface, wherein the input parameter data comprises a plurality of key value pair data.
Preferably, the step of respectively obtaining the field configuration types of the parameter fields in the parameter entry data and generating the test data set corresponding to the field configuration types includes:
traversing each key value pair data in the reference data to obtain a target key value of the traversed target key value pair data;
acquiring a corresponding target field configuration type from the preset storage area according to the target key value, wherein the preset storage area stores a first corresponding relation between each field configuration type and the key value;
acquiring a target test data generation rule corresponding to the target field configuration type from the preset storage area, wherein a second corresponding relation between each field configuration type and the test data generation rule is stored in the preset storage area;
and when the target key value pair data meet the target test data generation rule, generating a test data set corresponding to the target field configuration type, wherein the test data set comprises a plurality of forward test data and a plurality of reverse test data.
Preferably, the step of encapsulating each test data set according to the target interface template and using an encapsulation result as a test case of the target interface includes:
respectively assembling the test data in the test data set of each parameter field according to the target interface template, and taking the assembled result as unit test data of the parameter field;
and packaging the unit test data of each parameter field, and taking the packaged result as the test case of the target interface.
Preferably, the step of assembling the test data in the test data sets of the parameter fields according to the target interface template and using the assembled result as the unit test data of the parameter fields includes:
traversing the test data set of each parameter field, and taking the traversed test data set of the current parameter field as a first test data set;
respectively selecting one forward test data from the test data set of each parameter field, and taking the selected forward test data as the forward test data to be configured of the current parameter field;
assembling the first test data set and each forward test data to be configured according to the target interface template to obtain unit test data of the current parameter field;
the step of encapsulating the unit test data of each parameter field and taking an encapsulation result as the test case of the target interface comprises the following steps:
and after traversing the test data set of each parameter field, packaging the unit test data of each parameter field, and taking the packaging result as the test case of the target interface.
Preferably, the field configuration type includes at least one of a data type, a length type, a null value type, a fixed format type, an interval value type, and a special character type.
Preferably, before the step of acquiring, when receiving a test request message for a target interface, a target interface template corresponding to the target interface from a pre-stored storage area, the method further includes:
responding to an interface template configuration instruction of a target interface, and generating a target interface template corresponding to the target interface;
and storing the target interface template into a pre-stored storage area.
In addition, in order to achieve the above object, the present invention further provides a device for generating a test case, the device including:
the device comprises a receiving module, a judging module and a judging module, wherein the receiving module is used for acquiring a target interface template corresponding to a target interface from a prestored storage area when receiving a test request message of the target interface;
the message analysis module is used for analyzing the test request message and acquiring the input parameter data of the target interface from an analysis result, wherein the input parameter data comprises a plurality of parameter fields;
the field configuration module is used for respectively acquiring the field configuration types of all parameter fields in the parameter data and generating a test data set corresponding to the field configuration types;
and the case generation module is used for packaging each test data set according to the target interface template, and taking a packaging result as a test case of the target interface.
In addition, in order to achieve the above object, the present invention further provides a device for generating a test case, where the device includes: the test case generation method comprises a memory, a processor and a test case generation program which is stored on the memory and can run on the processor, wherein the test case generation program is configured to realize the steps of the test case generation method.
In order to achieve the above object, the present invention further provides a storage medium, in which a test case generation program is stored, and the test case generation program implements the steps of the test case generation method described above when executed by a processor.
When a test request message for a target interface is received, a target interface template corresponding to the target interface is acquired from a pre-stored storage area; analyzing the test request message, and acquiring input parameter data of a target interface from an analysis result, wherein the input parameter data comprises a plurality of parameter fields; respectively acquiring the field configuration type of each parameter field in the input parameter data, and generating a test data set corresponding to the field configuration type; and finally, packaging each test data set according to the target interface template, taking the packaging result as a test case of the target interface, and further automatically generating a test case covering different parameter fields for the target interface.
Drawings
Fig. 1 is a schematic structural diagram of a device for generating a test case in a hardware operating environment according to an embodiment of the present invention;
FIG. 2 is a flowchart illustrating a first embodiment of a test case generation method according to the present invention;
FIG. 3 is a flowchart illustrating a second embodiment of a test case generation method according to the present invention;
FIG. 4 is a diagram illustrating test data corresponding to each parameter field according to an embodiment of the present invention
FIG. 5 is a block diagram of a test case generation apparatus according to the present invention.
The implementation, functional features and advantages of the objects of the present invention will be further explained with reference to the accompanying drawings.
Detailed Description
It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
Referring to fig. 1, fig. 1 is a schematic structural diagram of a device for generating a test case in a hardware operating environment according to an embodiment of the present invention.
As shown in fig. 1, the apparatus may include: a processor 1001, such as a CPU, a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005. The communication bus 1002 is used to implement connection communication among these components. The user interface 1003 may include a Display screen (Display), an input unit such as a Keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface, a wireless interface. The network interface 1004 may optionally include a standard wired interface, a wireless interface (e.g., WI-FI interface). The memory 1005 may be a high-speed RAM memory or a non-volatile memory (e.g., a magnetic disk memory). The memory 1005 may alternatively be a storage device separate from the processor 1001 described previously.
Those skilled in the art will appreciate that the configuration shown in fig. 1 does not constitute a limitation of the apparatus, and may include more or fewer components than those shown, or some components may be combined, or a different arrangement of components.
As shown in fig. 1, the memory 1005 may include an operating system, a network communication module, a user interface module, and a test case generation program.
In the device shown in fig. 1, the network interface 1004 is mainly used for data communication; the user interface 1003 is mainly used for connecting devices interacting with testers or developers;
the device may be characterized as a test platform, the processor 1001 and the memory 1005 in the device may be provided in the device, and the device calls the generation program of the test case stored in the memory 1005 through the processor 1001 and executes the steps of the method for generating the test case.
Referring to fig. 2, fig. 2 is a schematic flowchart of a first embodiment of a test case generation method according to the present invention, where the test case generation method includes the following steps:
step S10: and when a test request message for a target interface is received, acquiring a target interface template corresponding to the target interface from a prestored storage area.
It should be noted that the main execution body of this embodiment is the processor of the device for generating test cases, where the device may be a computer host, and a test program simulation client, that is, a test platform, is loaded on the device.
It can be understood that, a general test platform sends a request message to a server loaded with an application to be tested, that is, sends a test request message to a target interface of the application to be tested, the server receives the request message and then responds, that is, forwards the test request message of the target interface to the test platform, when receiving the test request message of the target interface, the test platform obtains a target interface template corresponding to the target interface from a pre-stored storage area, the target interface template is a program template for testing a certain interface of the application to be tested on the server, the target interface template may be a program template pre-compiled by a developer, and the program template is stored in the pre-stored storage area.
Step S20: analyzing the test request message, and acquiring the input parameter data of the target interface from an analysis result, wherein the input parameter data comprises a plurality of parameter fields, and the parameter fields are key value pair data.
In a specific implementation, the test platform parses the test request, and when the format of the test request is analyzed to be the JSON format, performs serialization processing on the test request to obtain the parameter entry data of the target interface, where the parameter entry data includes multiple key value pair data.
It can be understood that, in this embodiment, a corresponding parsing algorithm is triggered according to the parsed information format of the test request, and when the format of the test request is analyzed to be the JSON format, the embodiment preferably employs a recursive tree-like data structure deep traversal algorithm, and performs serialization processing on the test request by using horizontal traversal as an auxiliary parsing template, and uses key value pair data parsed by a hash algorithm as a parameter field of the parameter entry data of the target interface.
Step S30: and respectively acquiring the field configuration type of each parameter field in the parameter data, and generating a test data set corresponding to the field configuration type.
In specific implementation, traversing each key value pair data in the reference data to obtain a target key value key of the traversed target key value pair data;
acquiring a corresponding target field configuration type from the preset storage region according to the target key value key, wherein the preset storage region stores a first corresponding relation between each field configuration type and the key value;
it should be noted that the field configuration type of this implementation includes at least one of a data type, a length type, a null value type, a fixed format type, an interval value type, and a special character type.
Acquiring a target test data generation rule corresponding to the target field configuration type from the preset storage area, wherein a second corresponding relation between each field configuration type and the test data generation rule is stored in the preset storage area;
it should be noted that the test data generation rule corresponding to the field configuration type includes: generating rules and length rules of target test data corresponding to the field configuration types, rules whether the target test data needs to be filled, fixed format rules, interval value rules and special character rules;
wherein the data type rule is characterized in that: generating test data meeting and not meeting the type requirements according to the input data types, and supporting character strings, integer types, floating point types, arrays and the like;
the length rule is characterized by: generating test data meeting and not meeting the length requirement according to the input length;
the fill-necessary rule is characterized as: generating a piece of test data and a null value which meet the type requirement according to the input data type;
the fixed format rule is characterized as: generating test data which meets or does not meet the format requirement according to the input format, and supporting the mobile phone number, the identity card number, the email address and the like;
the interval value rule is characterized in that: generating test data which meet and do not meet the interval according to the input interval requirement, and supporting integer type and floating point type;
the special character rule is characterized in that: based on the type of input data, various types of test data including various special characters such as space, capital, and capital characters are generated.
Further, after the parameter field and the test data generation rule corresponding to the parameter field are determined, the embodiment generates test data covering test scenes such as robustness, accuracy, fault tolerance, abnormal branching, path coverage and the like of the interface based on a sequence of test algorithms (an equivalence class division method, a boundary value analysis method, a decision table driving method, a permutation and combination method and the like);
specifically, when the target key-value pair data key-value meets the target test data generation rule, a test data set corresponding to the target field configuration type is generated, where the test data set includes multiple forward test data and multiple reverse test data; each test data generation in this embodiment is output in the form of an array (including a plurality of test data satisfying/failing the respective rules).
It should be noted that the six data generation rules in this embodiment support selection and configuration input by a tester, and the rule is triggered if the configuration is yes, and the rule is not triggered if the configuration is not yes.
Step S40: and packaging each test data set according to the target interface template, and taking a packaging result as a test case of the target interface.
In specific implementation, the test data in the test data set of each parameter field is assembled according to the target interface template, and the assembly result is used as unit test data of the parameter field;
and packaging the unit test data of each parameter field, and taking the packaged result as the test case of the target interface.
Specifically, the test data of each parameter field is assembled into unit test data in a format of a request message according to the target interface template, information such as a request header and a test environment of the target interface is obtained at the same time, and finally, a complete test case is generated based on the unit test data of different parameter fields and the information such as the request header and the test environment of the target interface.
In the embodiment, when a test request message for a target interface is received, a target interface template corresponding to the target interface is acquired from a pre-stored storage area; analyzing the test request message, and acquiring the input parameter data of the target interface from the analysis result, wherein the input parameter data comprises a plurality of parameter fields; respectively acquiring field configuration types of all parameter fields in the input parameter data, and generating a test data set corresponding to the field configuration types; and finally, packaging each test data set according to the target interface template, taking a packaging result as a test case of the target interface, and further automatically generating a test case covering different parameter fields for the target interface.
Referring to fig. 3, fig. 3 is a flowchart illustrating a second embodiment of the test case generation method according to the present invention, and the second embodiment of the test case generation method according to the present invention is proposed based on the first embodiment of the test case generation method.
The target interface template of this embodiment may be characterized as the following flow: referring to fig. 4, fig. 4 shows test data corresponding to each parameter field, where the identifier of each parameter field may be characterized by letters such as key values a, b, c, d, e, f, g, and each test data is represented in the form of key-value pairs on the basis that each test data is output in the form of an array: for example, the first forward test data of field a is represented by (a: At1), the second reverse test data of field a is represented by (a: Af2), the second forward test data of field B is represented by (a: Bt2), and so on.
Traversing each value in the array, forming a data dictionary { field rule ID: list of field values }: each field value and field are assembled into a key-value key value pair, other fields (except the current parameter field) take the first positive value in the output array to be assembled into the key-value key value pair, and all the field key value pairs are assembled into the original format message according to the serialized continuous data structure.
Specifically, the step S40 of assembling the test data in the test data sets of each parameter field according to the target interface template, and using the assembly result as the unit test data of the parameter field includes:
step S401: traversing the test data sets of all the parameter fields, and taking the traversed test data set of the current parameter field as a first test data set;
it can be understood that, as shown in fig. 4, one parameter field includes a plurality of forward test data and a plurality of reverse test data, the present embodiment first performs traversal access on the test data set of each parameter field, and takes the traversed test data set of the current parameter field as the first test data set, for example, the current parameter field is field a, and then the first test data set corresponding to field a is { At1, At2, …, AtN; af1, Af2, …, AfN };
step S402: and respectively selecting one forward test data from the test data sets of the parameter fields, and taking the selected forward test data as the forward test data to be configured of the current parameter field.
Specifically, after the first test data set corresponding to the field a is determined, one piece of forward test data is respectively selected from the test data sets corresponding to the remaining fields (as shown in fig. 4, field b, field c, field d, field e, field f, and field g …), preferably, the embodiment selects a first column of forward test data (Bt1, Ct1, Dt1, Et1, Ft1, and Gt1 …) corresponding to each field, and takes the selected forward test data (Bt1, Ct1, Dt1, Et1, Ft1, and Gt1 …) of different fields as the to-be-configured forward test data of the field a;
step S403: assembling the first test data set and each forward test data to be configured according to the target interface template to obtain unit test data of the current parameter field;
it is understood that, when testing the parameter field a, all the test data { At1, At2, …, AtN; af1, Af2, … and AfN and the first row value (Bt1, Ct1, Dt1, Et1, Ft1 and Gt1 …) of other fields are combined into unit test data in a format of a request message.
Correspondingly, the step of encapsulating the unit test data of each parameter field in step S40 and taking the encapsulated result as the test case of the target interface specifically includes:
step S404: and after traversing the test data set of each parameter field, packaging the unit test data of each parameter field, and taking the packaging result as the test case of the target interface.
It can be understood that the test platform processes the test data set of all parameter fields (field a, field b, field c, field d, field e, field f, field g …) according to steps S401 to S403, that is, all test data of the parameter field a and the unit test data in the first row value combination format of other fields are taken as the unit test data of the request message when testing the parameter field a, and all test data of the parameter field b and the unit test data … in the first row value combination format of other fields are taken as the unit test data of the request message when testing the parameter field g. And packaging unit test data of each parameter field (field a, field b, field c, field d, field e, field f and field g …) by analogy, and taking a packaging result as a test case of the target interface.
The embodiment scheme enables a tester to generate a test case covering and representing field information of each dimension for the target interface only by simply configuring the message template and the field information.
Further, in an embodiment, before the step S10, the method further includes:
the method comprises the following steps: responding to an interface template configuration instruction of a target interface, and generating a target interface template corresponding to the target interface; and storing the target interface template into a pre-stored storage area.
It can be understood that, the embodiment can support the tester to perform custom modification and configuration on the interface template of the target interface, thereby enabling the test mode to be more flexible.
In addition, referring to fig. 5, fig. 5 is a block diagram of a test case generation apparatus according to the present invention, where the apparatus includes:
a receiving module 10, configured to, when receiving a test request packet for a target interface, obtain a target interface template corresponding to the target interface from a pre-stored storage area;
a message parsing module 20, configured to parse the test request message, and obtain, from a parsing result, entry parameter data of the target interface, where the entry parameter data includes a plurality of parameter fields;
a field configuration module 30, configured to obtain field configuration types of each parameter field in the parameter data, and generate a test data set corresponding to the field configuration types;
and the use case generating module 40 is configured to package each test data set according to the target interface template, and use a package result as a test case of the target interface.
It can be understood that the test case generation apparatus of the present invention may be a computer program, and the computer program is loaded in the test case generation device, that is, the computer program may be a test platform software loaded on a computer host;
the specific implementation manner of the device for generating the test case of the present invention may refer to the above embodiment of the method for generating the test case, and is not described herein again.
In addition, an embodiment of the present invention further provides a storage medium, where the storage medium is a computer-readable storage medium, and a test case generation program is stored on the storage medium, where the test case generation program, when executed by a processor, implements the steps of the test case generation program method described above.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or system. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in the process, method, article, or system in which the element is included.
The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.
Through the description of the foregoing embodiments, it is clear to those skilled in the art that the method of the foregoing embodiments may be implemented by software plus a necessary general hardware platform, and certainly may also be implemented by hardware, but in many cases, the former is a better implementation. Based on such understanding, the technical solutions of the present invention may be embodied in the form of a software product, which is stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling a terminal device (such as a mobile phone, a computer, a terminal, an air conditioner, or a network device) to execute the method according to the embodiments of the present invention.
The above description is only a preferred embodiment of the present invention, and not intended to limit the scope of the present invention, and all modifications of equivalent structures and equivalent processes, which are made by using the contents of the present specification and the accompanying drawings, or directly or indirectly applied to other related technical fields, are included in the scope of the present invention.

Claims (9)

1. A method for generating a test case is characterized by comprising the following steps:
when a test request message for a target interface is received, acquiring a target interface template corresponding to the target interface from a preset storage area;
analyzing the test request message, and acquiring input parameter data of the target interface from an analysis result, wherein the input parameter data comprises a plurality of parameter fields;
respectively acquiring field configuration types of all parameter fields in the parameter data, and generating a test data set corresponding to the field configuration types;
packaging each test data set according to the target interface template, and taking a packaging result as a test case of the target interface;
after the step of analyzing the test request packet, the method further includes:
when the test request is analyzed to be in the JSON format, the test request is serialized by taking transverse traversal as an auxiliary analysis template, key value pair data analyzed by a hash algorithm are used as parameter fields of input parameter data of the target interface, and the input parameter data comprise a plurality of key value pair data.
2. The method of claim 1, wherein the step of respectively obtaining the field configuration type of each parameter field in the parameter data and generating the test data set corresponding to the field configuration type comprises:
traversing each key value pair data in the reference data to obtain a target key value of the traversed target key value pair data;
acquiring a corresponding target field configuration type from the preset storage area according to the target key value, wherein the preset storage area stores a first corresponding relation between each field configuration type and the key value;
acquiring a target test data generation rule corresponding to the target field configuration type from the preset storage area, wherein a second corresponding relation between each field configuration type and the test data generation rule is stored in the preset storage area;
and when the target key value pair data meet the target test data generation rule, generating a test data set corresponding to the target field configuration type, wherein the test data set comprises a plurality of forward test data and a plurality of reverse test data.
3. The method of claim 2, wherein the step of encapsulating each test data set according to the target interface template and using an encapsulation result as a test case of the target interface comprises:
respectively assembling the test data in the test data set of each parameter field according to the target interface template, and taking the assembly result as unit test data of the parameter field;
and packaging the unit test data of each parameter field, and taking the packaged result as the test case of the target interface.
4. The method of claim 3, wherein the step of assembling the test data in the test data sets of each parameter field according to the target interface template, and using the assembled result as the unit test data of the parameter field comprises:
traversing the test data set of each parameter field, and taking the traversed test data set of the current parameter field as a first test data set;
respectively selecting one forward test data from the test data sets of the parameter fields, and taking the selected forward test data as the forward test data to be configured of the current parameter field;
assembling the first test data set and each forward test data to be configured according to the target interface template to obtain unit test data of the current parameter field;
the step of packaging the unit test data of each parameter field and taking the packaging result as the test case of the target interface comprises the following steps:
and after traversing the test data set of each parameter field, packaging the unit test data of each parameter field, and taking the packaging result as the test case of the target interface.
5. The method of any of claims 1-4, wherein the field configuration type comprises at least one of a data type, a length type, a null type, a fixed format type, an interval value type, and a special character type.
6. The method according to any one of claims 1 to 4, wherein before the step of obtaining the target interface template corresponding to the target interface from a pre-stored storage area when receiving the test request message for the target interface, the method further comprises:
responding to an interface template configuration instruction of a target interface, and generating a target interface template corresponding to the target interface;
and storing the target interface template into a pre-stored storage area.
7. An apparatus for generating a test case, the apparatus comprising:
the device comprises a receiving module, a judging module and a judging module, wherein the receiving module is used for acquiring a target interface template corresponding to a target interface from a prestored storage area when receiving a test request message of the target interface;
the message analysis module is used for analyzing the test request message and acquiring the input parameter data of the target interface from an analysis result, wherein the input parameter data comprises a plurality of parameter fields;
the field configuration module is used for respectively acquiring the field configuration types of all parameter fields in the parameter data and generating a test data set corresponding to the field configuration types;
the case generating module is used for packaging each test data set according to the target interface template, and taking a packaging result as a test case of the target interface;
the message analysis module is further configured to, when the test request is analyzed to be in the JSON format, perform serialization processing on the test request by using transverse traversal as an auxiliary analysis template, and use key value pair data analyzed by a hash algorithm as parameter fields of entry parameter data of the target interface, where the entry parameter data includes multiple key value pair data.
8. An apparatus for generating a test case, the apparatus comprising: the test case generation method comprises a memory, a processor and a test case generation program which is stored on the memory and can run on the processor, wherein the test case generation program is configured to realize the steps of the test case generation method according to any one of claims 1 to 6.
9. A storage medium having stored thereon a test case generation program that, when executed by a processor, implements the steps of the test case generation method according to any one of claims 1 to 6.
CN201910842034.8A 2019-09-06 2019-09-06 Test case generation method, device, equipment and storage medium Active CN110750442B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910842034.8A CN110750442B (en) 2019-09-06 2019-09-06 Test case generation method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910842034.8A CN110750442B (en) 2019-09-06 2019-09-06 Test case generation method, device, equipment and storage medium

Publications (2)

Publication Number Publication Date
CN110750442A CN110750442A (en) 2020-02-04
CN110750442B true CN110750442B (en) 2022-08-19

Family

ID=69276183

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910842034.8A Active CN110750442B (en) 2019-09-06 2019-09-06 Test case generation method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN110750442B (en)

Families Citing this family (37)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111026670B (en) * 2019-12-11 2023-08-18 广州品唯软件有限公司 Test case generation method, test case generation device and storage medium
CN111427784B (en) * 2020-03-24 2023-05-12 建信金融科技有限责任公司 Data acquisition method, device, equipment and storage medium
CN113495831B (en) * 2020-04-03 2024-05-31 卫宁健康科技集团股份有限公司 Method, system, equipment and medium for generating test case based on keywords
CN113515436A (en) * 2020-04-09 2021-10-19 马上消费金融股份有限公司 Interface testing method and device
CN111506509A (en) * 2020-04-20 2020-08-07 上海元城汽车技术有限公司 Automatic testing method, device, equipment and storage medium for automobile software unit
CN111752826A (en) * 2020-06-03 2020-10-09 五八有限公司 Interface testing method and device, electronic equipment and storage medium
CN111901310A (en) * 2020-07-06 2020-11-06 北京达佳互联信息技术有限公司 Website security testing method and device, electronic equipment and storage medium
CN111813680B (en) * 2020-07-13 2023-05-26 建信金融科技有限责任公司 Method and device for generating test script, computer equipment and storage medium
CN111858376A (en) * 2020-07-29 2020-10-30 平安养老保险股份有限公司 Request message generation method and interface test method
CN111782549B (en) * 2020-07-31 2024-06-21 北京字节跳动网络技术有限公司 Test method and device and electronic equipment
CN112000579B (en) * 2020-08-26 2024-03-19 上海移远通信技术股份有限公司 Software interface testing method, system, equipment and medium
CN112131123B (en) * 2020-09-27 2024-04-02 深圳赛安特技术服务有限公司 Method and device for generating test case, terminal equipment and storage medium
CN112100078B (en) * 2020-09-27 2024-05-03 中国建设银行股份有限公司 Method, device and equipment for generating interface test case
CN112131127B (en) * 2020-09-28 2024-04-16 北京同邦卓益科技有限公司 Interface testing method, device and system and electronic equipment
CN112181835B (en) * 2020-09-29 2024-04-26 中国平安人寿保险股份有限公司 Automatic test method, device, computer equipment and storage medium
CN112363922A (en) * 2020-11-09 2021-02-12 中国农业银行股份有限公司 Test case generation method and related equipment thereof
CN112328489B (en) * 2020-11-11 2022-07-08 南京领行科技股份有限公司 Test case generation method and device, terminal equipment and storage medium
CN112527630B (en) * 2020-11-18 2023-07-07 平安消费金融有限公司 Test case generation method, device, computer equipment and storage medium
CN112346989B (en) * 2020-11-26 2023-06-20 网易(杭州)网络有限公司 Interface testing method, device, medium and computing equipment
CN112363948B (en) * 2020-11-30 2024-04-09 深圳市六度人和科技有限公司 Interface testing method and device, electronic equipment and storage medium
CN113778846B (en) * 2020-11-30 2024-07-16 北京沃东天骏信息技术有限公司 Method and device for generating test data
CN112650600B (en) * 2020-12-22 2023-10-27 广州市家庭医生在线信息有限公司 Method, device and computer equipment for pushing message content
CN112597018A (en) * 2020-12-22 2021-04-02 未来电视有限公司 Interface test case generation method, device, equipment and storage medium
CN112631914A (en) * 2020-12-24 2021-04-09 上海幻电信息科技有限公司 Data testing method and device
CN112783779B (en) * 2021-01-28 2024-06-04 北京达佳互联信息技术有限公司 Method and device for generating test case, electronic equipment and storage medium
CN112860581B (en) * 2021-03-18 2024-04-26 浙江诺诺网络科技有限公司 Execution method, device, equipment and storage medium of test case
CN113051171B (en) * 2021-04-08 2024-04-02 深圳赛安特技术服务有限公司 Interface testing method, device, equipment and storage medium
CN113176993A (en) * 2021-04-28 2021-07-27 平安银行股份有限公司 Case testing method and device, electronic equipment and storage medium
CN113342647A (en) * 2021-05-31 2021-09-03 中国工商银行股份有限公司 Test data generation method and device
CN113434396A (en) * 2021-06-22 2021-09-24 中国农业银行股份有限公司 Interface test method, device, equipment, storage medium and program product
CN113448869B (en) * 2021-07-16 2022-12-13 中国建设银行股份有限公司 Method and device for generating test case, electronic equipment and computer readable medium
WO2023014282A1 (en) * 2021-08-02 2023-02-09 Shopee Singapore Private Limited Device and method for automated generation of parameter testing requests
CN113742242A (en) * 2021-09-16 2021-12-03 中国银行股份有限公司 Interface testing method and device
CN113923038A (en) * 2021-10-19 2022-01-11 北京快确信息科技有限公司 Aggregation test system for multi-scenario financial interface
CN114338451B (en) * 2021-12-31 2023-10-13 武汉思普崚技术有限公司 Controller local area network bus test system, method and storage medium
CN115080419A (en) * 2022-06-27 2022-09-20 康键信息技术(深圳)有限公司 Automatic testing method and device, storage medium and computer equipment
CN115334166A (en) * 2022-08-15 2022-11-11 平安壹钱包电子商务有限公司 Method, device, equipment and storage medium for calling encryption machine

Family Cites Families (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP5669630B2 (en) * 2011-03-04 2015-02-12 インターナショナル・ビジネス・マシーンズ・コーポレーションInternational Business Machines Corporation Test case generation method, program and system
CN103631720B (en) * 2013-12-20 2016-08-17 百度在线网络技术(北京)有限公司 The generation method and apparatus of test case
CN105095325A (en) * 2014-05-23 2015-11-25 中兴通讯股份有限公司 Method and device for generating test data
CN104133772B (en) * 2014-08-13 2017-04-12 广东电网公司信息中心 Automatic test data generation method
CN104123227A (en) * 2014-08-13 2014-10-29 广东电网公司信息中心 Method for automatically generating testing cases
CN106354634A (en) * 2016-08-25 2017-01-25 青岛海信传媒网络技术有限公司 Interface testing method and device
CN106598851A (en) * 2016-12-05 2017-04-26 广州唯品会信息科技有限公司 Software interface test method and system
CN106953855B (en) * 2017-03-16 2020-10-20 国网江苏省电力公司淮安供电公司 Method for intrusion detection of GOOSE message of IEC61850 digital substation
CN107391379B (en) * 2017-07-28 2021-01-01 武汉斗鱼网络科技有限公司 Automatic interface testing method and device
CN108399130A (en) * 2018-02-28 2018-08-14 平安科技(深圳)有限公司 Method, device and equipment for automatically generating test case and readable storage medium
CN109446068B (en) * 2018-09-26 2024-04-05 平安健康保险股份有限公司 Interface test method, device, computer equipment and storage medium
CN109766262B (en) * 2018-12-15 2022-05-06 深圳壹账通智能科技有限公司 Interface data processing method, automatic testing method, device, equipment and medium

Also Published As

Publication number Publication date
CN110750442A (en) 2020-02-04

Similar Documents

Publication Publication Date Title
CN110750442B (en) Test case generation method, device, equipment and storage medium
CN109634837B (en) Automatic test method, device, equipment and storage medium
CN108459964B (en) Test case selection method, device, equipment and computer readable storage medium
CN102665231B (en) Method of automatically generating parameter configuration file for LTE (Long Term Evolution) system
CN111475390A (en) Log collection system deployment method, device, equipment and storage medium
CN111026672A (en) Test method, terminal equipment and mock server
CN111399822A (en) Micro-service development method, device, equipment and computer storage medium
CN112181749A (en) Hardware testing method and device, electronic equipment and storage medium
CN112035344A (en) Multi-scenario test method, device, equipment and computer readable storage medium
CN112214714A (en) Request processing method, device and equipment based on configuration file and storage medium
CN114579203B (en) Script file checking method and device, electronic equipment and storage medium
CN112214405A (en) Software testing method and device, electronic equipment and readable storage medium
CN110543427B (en) Test case storage method and device, electronic equipment and storage medium
CN109656567B (en) Dynamic method and system for heterogeneous service data processing logic
CN109634836B (en) Test data encapsulation method, device, equipment and storage medium
CN112561690B (en) Method, system, equipment and storage medium for testing credit card staged service interface
CN107783867B (en) Gesture testing method and device, computer equipment and storage medium
CN110516258B (en) Data verification method and device, storage medium and electronic device
CN113806209A (en) Interface testing method, frame, computer device and storage medium
KR101488815B1 (en) Device for generating a script for menu test, menu test automatic system having the same, and method thereof
CN112988602B (en) Verification platform generation method and device, computer equipment and storage medium
CN114756183A (en) Data printing method, device, equipment and storage medium
CN110855526B (en) Method and device for detecting data source connection, storage medium and electronic equipment
CN111078571B (en) Test method for analog response, terminal equipment and computer readable storage medium
CN110389754B (en) Service processing method, system, server, terminal, electronic equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
TA01 Transfer of patent application right
TA01 Transfer of patent application right

Effective date of registration: 20220524

Address after: 518000 China Aviation Center 2901, No. 1018, Huafu Road, Huahang community, Huaqiang North Street, Futian District, Shenzhen, Guangdong Province

Applicant after: Shenzhen Ping An medical and Health Technology Service Co.,Ltd.

Address before: Room 12G, Area H, 666 Beijing East Road, Huangpu District, Shanghai 200001

Applicant before: PING AN MEDICAL AND HEALTHCARE MANAGEMENT Co.,Ltd.

GR01 Patent grant
GR01 Patent grant