CN111078526A - Test case generation method and device and storage medium - Google Patents

Test case generation method and device and storage medium Download PDF

Info

Publication number
CN111078526A
CN111078526A CN201911064973.0A CN201911064973A CN111078526A CN 111078526 A CN111078526 A CN 111078526A CN 201911064973 A CN201911064973 A CN 201911064973A CN 111078526 A CN111078526 A CN 111078526A
Authority
CN
China
Prior art keywords
test
data set
test data
target
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
CN201911064973.0A
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.)
Taikang Insurance Group Co Ltd
Taikang Online Property Insurance Co Ltd
Original Assignee
Taikang Insurance Group Co Ltd
Taikang Online Property Insurance 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 Taikang Insurance Group Co Ltd, Taikang Online Property Insurance Co Ltd filed Critical Taikang Insurance Group Co Ltd
Priority to CN201911064973.0A priority Critical patent/CN111078526A/en
Publication of CN111078526A publication Critical patent/CN111078526A/en
Pending legal-status Critical Current

Links

Images

Classifications

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

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 relates to a method and a device for generating a test case and a storage medium, which are used for solving the problem that the current generation mode of the test case is not flexible enough. The embodiment of the invention receives a general test case which comprises at least one test object and is reported by a terminal; determining a target test data set corresponding to the type of the test object in the universal test case according to the corresponding relation between the type of the test object and the test data set; and replacing data corresponding to the test object in the universal test case according to the test data in the target test data set to obtain the test case used in the test process. The embodiment of the invention saves the trouble of manual writing, can generate a large number of test cases required by the test more quickly, can ensure the accuracy of the generated test cases, and can meet the requirement of product test.

Description

Test case generation method and device and storage medium
Technical Field
The invention relates to the technical field of internet, in particular to a method and a device for generating a test case and a storage medium.
Background
A test case is a set of test inputs, execution conditions, and expected results tailored for a particular purpose to test a certain program path or verify that a certain requirement is met.
At present, test cases required by testing are compiled by testers according to different product requirements, and are maintained in an excel table after the compilation is completed. When a demand comes, test cases are manually compiled according to the demand. However, in the test cases compiled to meet the test requirements of different products, when the same test requirement is tested, only the data of the test object in the different test cases are different, and when a plurality of test cases are needed, the parts except the test object also need to be manually compiled by a tester, so that the tester can repeatedly work when compiling each time. When the workload is high, it is time consuming and inefficient and prone to errors.
In summary, the generation method of the test case is not flexible at present.
Disclosure of Invention
The invention relates to the technical field of internet, in particular to a method, a device and a storage medium for generating a test case, which are used for solving the problem that the current generation mode of the test case is not flexible enough.
Based on the foregoing problem, in a first aspect, an embodiment of the present invention provides a method for generating a test case, where the method includes:
receiving a universal test case which comprises at least one test object and is reported by a terminal;
determining a target test data set corresponding to the type of the test object in the universal test case according to the corresponding relation between the type of the test object and the test data set;
and replacing data corresponding to the test object in the universal test case according to the test data in the target test data set to obtain the test case used in the test process.
Optionally, a general test case containing at least one test object reported by the terminal through the json message is received.
Optionally, the replacing, according to the test data in the target test data set, data corresponding to the test object in the general test case to obtain the test case used in the test process includes:
and aiming at a target test data set corresponding to the type of any test object, using at least one target test data in the target test data set to respectively replace the data corresponding to the test object in the universal test case to obtain the test case.
Optionally, the at least one target test datum is determined from the target test data set according to the following manner:
and taking all the test data in the target test data set as the target test data.
Optionally, when receiving the general test case containing at least one test object reported by the terminal, the method further includes:
receiving test conditions reported by the terminal; determining the at least one target test data from the set of target test data according to: and determining at least one piece of test data meeting the test condition from the target test data set as the target test data.
Optionally, the test data set corresponding to the test object type is generated according to the following manner:
obtaining a test case sample containing at least one test object; aiming at any test object, determining a test data set corresponding to the type of the test object according to the corresponding relation between the type of the test object and the test data set; and taking the data corresponding to the test object analyzed from the test case sample as the test data in the test data set corresponding to the test object type.
Optionally, after determining the test data set corresponding to the type of the test object, before using the data corresponding to the test object, which is parsed from the test case sample, as the test data in the test data set corresponding to the type of the test object, the method further includes:
and determining that the test data set corresponding to the test object type does not contain the data corresponding to the test object analyzed from the test case sample.
In a second aspect, an embodiment of the present invention provides an apparatus for generating a test case, including a processor, a memory, and a transceiver;
wherein the processor is configured to read a program in the memory and execute:
receiving a universal test case which comprises at least one test object and is reported by a terminal;
determining a target test data set corresponding to the type of the test object in the universal test case according to the corresponding relation between the type of the test object and the test data set;
and replacing data corresponding to the test object in the universal test case according to the test data in the target test data set to obtain the test case used in the test process.
In a third aspect, an embodiment of the present invention provides an apparatus for generating a test case, where the apparatus includes:
the receiving module is used for receiving a universal test case which contains at least one test object and is reported by the terminal;
the determining module is used for determining a target test data set corresponding to the type of the test object in the universal test case according to the corresponding relation between the type of the test object and the test data set;
and the generating module is used for replacing the data corresponding to the test object in the universal test case according to the test data in the target test data set to obtain the test case used in the test process.
In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, on which a computer program is stored, which when executed by a processor implements the steps of the method according to the first aspect.
The technical scheme provided by the embodiment of the invention at least has the following beneficial effects:
the method for generating the test case provided by the embodiment of the invention is characterized in that the universal test case reported by the terminal is received, the universal test case comprises at least one test object, a target test data set corresponding to the type of the test object is determined in the test data set, and after the target data set is obtained, the test data in the target test data set is used for replacing the data corresponding to the test object in the universal test case, so that the test case which can be used in the test process is obtained. The embodiment of the invention can automatically identify the test objects required by the test in the universal test case, and the type of each test object corresponds to one test data set; aiming at any test object in the universal test cases, the test data in the target test data set corresponding to the type of the test object is used for replacing the data of the test object in the universal test cases to obtain a plurality of test cases, so that the trouble of manual writing is saved, a large number of test cases required by the test can be generated more quickly, the accuracy of the generated test cases can be ensured, and the requirement of product test can be met.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed to be used in the description of the embodiments will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without inventive exercise.
Fig. 1 is a schematic view of an application scenario according to an embodiment of the present invention;
FIG. 2 is a flowchart of a method for generating a test case according to an embodiment of the present invention;
FIG. 3 is a flowchart of a method for generating a test data set according to an embodiment of the present invention;
FIG. 4 is a flowchart illustrating the generation of a test case according to an embodiment of the present invention;
FIG. 5 is a schematic diagram of an electronic device for test case generation according to an embodiment of the present invention;
fig. 6 is a schematic diagram of a test case generation apparatus according to an embodiment of the present invention.
Detailed Description
In order to make those skilled in the art better understand the technical solution of the present invention, the technical solution in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings.
It should be noted that the terms "first," "second," and the like in the description and claims of the present invention and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the invention described herein are capable of operation in sequences other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present invention. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the invention, as detailed in the appended claims.
Some terms appearing herein are explained below:
1. the term "and/or" in the embodiments of the present invention describes an association relationship of associated objects, and indicates that three relationships may exist, for example, a and/or B may indicate: a exists alone, A and B exist simultaneously, and B exists alone. The character "/" generally indicates that the former and latter associated objects are in an "or" relationship.
2. The term "test case" in the embodiments of the present invention is a set of test inputs, execution conditions, and expected results tailored for a particular purpose in order to test a certain program path or verify whether a certain requirement is met.
The product is tested and checked for many times before being released, the product is further improved through debugging, a large number of test cases are needed in the test process, test data contained in every two test cases are different, and if a certain test case is used in the test process, errors occur, and problems possibly existing in the product can be checked according to the currently used test case.
At present, in the prior art, test cases required for testing are compiled by testers according to different product requirements, and are maintained in an excel table after the compilation is completed. And when a demand comes, manually compiling the test case according to the demand document. However, in the test cases compiled to meet the test requirements of different products, when the same test requirement is tested, only the data of the test object in the different test cases are different, and when a plurality of test cases are needed, the parts except the test object also need to be manually compiled by a tester, so that the tester can repeatedly work when compiling each time. When the workload is high, it is time consuming and inefficient and prone to errors.
An optional application scenario is shown in a schematic diagram shown in fig. 1, before a tester performs a test, a general test case is reported to a server 12 through a terminal 11 according to a test requirement of a current test, the general test case includes at least one test object, the server 12 analyzes the general test case to obtain the at least one test object after receiving the general test case, a target test data set corresponding to the type of the test object is determined according to a corresponding relationship between the type of the test object and the test data set, data corresponding to the test object in the general test case is replaced by test data in the target test data set to obtain the test case, and the tester can perform the test by using the test case.
Based on the above problem, the present invention provides a method for generating a test case, as shown in fig. 2, including the following steps:
step S201, receiving a general test case which comprises at least one test object and is reported by a terminal;
step S202, determining a target test data set corresponding to the type of the test object in the universal test case according to the corresponding relation between the type of the test object and the test data set;
and S203, replacing data corresponding to the test object in the universal test case according to the test data in the target test data set to obtain the test case used in the test process.
The method for generating the test case provided by the embodiment of the invention is characterized in that the universal test case reported by the terminal is received, the universal test case comprises at least one test object, a target test data set corresponding to the type of the test object is determined in the test data set, and after the target data set is obtained, the test data in the target test data set is used for replacing the data corresponding to the test object in the universal test case, so that the test case which can be used in the test process is obtained. The embodiment of the invention can automatically identify the test objects required by the test in the universal test case, and the type of each test object corresponds to one test data set; aiming at any test object in the universal test cases, the test data in the target test data set corresponding to the type of the test object is used for replacing the data of the test object in the universal test cases to obtain a plurality of test cases, so that the trouble of manual writing is saved, a large number of test cases required by the test can be generated more quickly, the accuracy of the generated test cases can be ensured, and the requirement of product test can be met.
The following describes embodiments of the present invention in further detail.
In step S201, a general test case including at least one test object reported by a terminal is received;
the universal test case is a complete and correct test case which meets the current test requirement, and comprises at least one test object and data corresponding to the test object, and the fact that the universal test case is correct means that no problem occurs when the universal test case is used for testing;
optionally, the test objects in the universal test case include, but are not limited to:
name, mobile phone number, mail box, certificate number.
In step S202, after receiving a universal test case reported by a terminal, determining a target test data set corresponding to a type of a test object in the universal test case according to a corresponding relationship between the type of the test object and the test data set;
the test object type is obtained by analyzing a general test case reported by a terminal, the test object type is matched with the test data set, and the successfully matched test data set is used as a target test data set;
in the embodiment of the invention, the corresponding relation between the type of the test object and the test data set is pre-stored; or the embodiment of the invention can extract the data of the test objects of different types from a large number of test case samples to generate the corresponding relation between the types of the test objects and the test data set.
It should be noted that all test objects extracted from the general test case are matched with the test data set, and if the matching is unsuccessful, the test object is ignored, that is, the test case is not generated for the test object.
Optionally, in the embodiment of the present invention, the terminal may report a general test case including at least one test object through a json message.
After receiving a universal test case reported by a terminal, analyzing a test object in the universal test case; determining a target test data set corresponding to the type of each test object, replacing data corresponding to the test object in a universal test case with test data in the target test data set, and obtaining the test case used in the test process;
when the test data in the target test data set is used to replace data corresponding to one test object in the universal test case, data corresponding to other test objects in the universal test case remains unchanged.
In implementation, the embodiment of the present invention may replace data corresponding to a test object in a general test case with test data in a target test data set according to the following manner to obtain the test case used in the test process:
and aiming at a target test data set corresponding to the type of any test object, at least one target test data in the target test data set is used for replacing the data corresponding to the test object in the universal test case respectively to obtain the test case.
It should be noted that, when generating a test case, the test case is performed on any one test object in the general test case, and what is generated is the test case related to the test object;
for example, the general test cases reported by the terminal are:
name: zhang III; age: 23; mail box: com, 123456@ email.
Analyzing the general test case to obtain test objects including name, age and mailbox; determining a test data set corresponding to the name aiming at the test object of the name, and replacing data Zhang III corresponding to the name in the universal test case by using at least one target test data in the test data set corresponding to the name respectively to obtain a test case corresponding to the name; determining a test data set corresponding to the age aiming at the test object of the age, and replacing data '23' corresponding to the age in the universal test case by using at least one target test data in the test data set corresponding to the age respectively to obtain a test case corresponding to the age; and determining a test data set corresponding to the mailbox aiming at the test object of the mailbox, and replacing data '123456 @ email.com' corresponding to the mailbox in the general test case by using at least one target test data in the test data set corresponding to the mailbox respectively to obtain the test case corresponding to the mailbox.
In practice, the embodiment of the present invention may determine the target test data from the target test data set according to the following manner:
and in the mode 1, all the test data in the target test data set are used as the target test data.
In implementation, after a target test data set corresponding to the type of a test object is determined for any test object in a universal test case, all data in the target test data set are extracted, and the data corresponding to the test object in the universal test case are replaced respectively.
Assuming that the target test data set corresponding to the test object a contains 50 test data, all 50 test data are extracted to respectively replace the data corresponding to the test object a in the universal test case, so as to obtain 50 test cases related to the test object a.
For example, the general test cases reported by the terminal are:
name: zhang III; age: 23; mail box: com, 123456@ email; and analyzing the general test case to obtain the test objects including the name, the age and the mailbox.
For the test object of the name, assuming that the test data set corresponding to the determined name is { lie four, king xiao five, and zhao six }, respectively replacing the name "zhang three" in the universal test case with the test data "lie four", "king xiao five", and zhao six "in the test data set corresponding to the name, and obtaining the following test cases about the name:
name: plum four; age: 23; mail box: com, 123456@ email;
name: king xiao wu; age: 23; mail box: com, 123456@ email;
name: zhao Liu; age: 23; mail box: com, 123456@ email.
For the test object with age, assuming that the test data set corresponding to the determined age is {56, 78, 9}, the test data "56", "78", and "9" in the test data set corresponding to the age are respectively used to replace the age "23" in the general test case, and the following test cases with the ages are obtained:
name: zhang III; age: 56; mail box: com, 123456@ email;
name: zhang III; age: 78, a nitrogen source; mail box: com, 123456@ email;
name: zhang III; age: 9; mail box: com, 123456@ email.
For a test object of the mailbox, assuming that the test data set corresponding to the determined mailbox is {0124@ email.com, 4578@ email.com, 336487@ email.com }, replacing the mailbox "123456 @ email.com" in the general test case with the test data "0124 @ email.com", "4578 @ email.com" and "336487 @ email.com" in the test data set corresponding to the mailbox respectively, obtaining the following test case about the mailbox:
name: zhang III; age: 23; mail box: 0124@ email.com;
name: zhang III; age: 23; mail box: 4578@ email.com;
name: zhang III; age: 23; mail box: 336487@ email.
And 2, determining at least one piece of test data meeting the test condition from the target test data set as the target test data.
Wherein, the test condition is reported by the terminal;
it should be noted that the test conditions reported by the terminal in the embodiment of the present invention may be reported simultaneously with the general test case.
After receiving the test conditions reported by the terminal, the data in the target test data set needs to be screened according to the test conditions, and the test data meeting the test conditions is used as the target test data and is generated according to the target test data.
For example, the general test cases reported by the terminal are:
name: zhang III; age: 23; analyzing the general test case to obtain the name and the age of the test object;
the test conditions reported by the terminal include: the name is two words, and the age is not more than 35 years old.
Aiming at the test object of the name, assuming that the test data set corresponding to the determined name is { Li four, Wang Xiao Wu, Zhao six and Sun Xiao Ming }, the target test data corresponding to the name meeting the test conditions comprises Li four and Zhao six; respectively replacing the name "zhang san" in the universal test case with the test data "li si" and "zhao xi" in the target test data set corresponding to the name, and obtaining the following test cases about the name:
name: plum four; age: 23; mail box: com, 123456@ email;
name: zhao Liu; age: 23; mail box: com, 123456@ email.
For the test object with age, assuming that the test data set corresponding to the determined age is {56, 9, 33, 101}, target test data corresponding to the age meeting the test conditions comprise 33 and 9; respectively replacing the age "23" in the general test case with the test data "33" and "9" in the target test data set corresponding to the age, and obtaining the following test cases with respect to the age:
name: zhang III; age: 33;
name: zhang III; age: 9.
in addition, as shown in fig. 3, an embodiment of the present invention further provides a method for generating a test data set corresponding to a test object type:
step S301, obtaining a test case sample containing at least one test object;
step S302, aiming at any test object, determining a test data set corresponding to the type of the test object according to the corresponding relation between the type of the test object and the test data set; and taking the data corresponding to the test object analyzed from the test case sample as the test data in the test data set corresponding to the test object type.
The test case sample may be a test case manually written by a technician.
It should be noted that, when generating a test data set corresponding to each test object type, the embodiment of the present invention needs to use a large number of test case samples, so as to generate abundant test data for the test object types.
In specific implementation, after a test case sample is obtained, the test case sample is analyzed to obtain a test object, and data corresponding to the test object is stored in a test data set as test data corresponding to the type of the test object aiming at any test object;
it should be noted that after the test data set corresponding to the type of the test object is determined, before the data corresponding to the test object is stored in the test data set, it is further determined that the test data set corresponding to the type of the test object does not include the data corresponding to the test object, which is analyzed from the test case sample, so that an increase in workload due to repeated storage of the same data can be avoided.
The following further illustrates embodiments of the invention in a specific example:
as shown in fig. 4, a complete flow chart of test case generation according to an embodiment of the present invention includes the following steps:
step S401, receiving a general test case which comprises at least one test object and is reported by a terminal;
for example, the received general test cases reported by the terminal are: name: the Chinese character Xiu Lian; age: 35; mobile phone number: 10098981010, respectively;
s402, analyzing the general test case to obtain a test object in the general test case;
analyzing the general test case, and obtaining a test object as follows: name, age, and cell phone number.
Step S403, determining a target test data set corresponding to the type of the test object in the universal test case according to the corresponding relation between the type of the test object and the test data set;
determining a target test data set corresponding to the name, a target test data set corresponding to the age and a target test data set corresponding to the mobile phone number by analyzing the test objects acquired by the universal test case, wherein the test objects comprise the name, the age and the mobile phone number; suppose that the target test data set corresponding to the name is { Nad, Li Ming, Chen Xiao Li }; the target test data set corresponding to age is {9, 78, 25, 100 }; the target test set corresponding to the mobile phone number is {10298070000, 90109090890 }.
Step S404, regarding the target test data set corresponding to any type of test object, taking all test data in the target test data set as target test data.
S405, respectively replacing data corresponding to test objects in the universal test cases with the determined target test data to obtain test cases;
generating a test case for the name for the test object is:
name: nad, respectively; age: 35; mobile phone number: 10098981010, respectively;
name: plum amine; age: 35; mobile phone number: 10098981010, respectively;
name: aging; age: 35; mobile phone number: 10098981010, respectively;
generating a test case for the age of the test object is as follows:
name: the Chinese character Xiu Lian; age: 9; mobile phone number: 10098981010, respectively;
name: the Chinese character Xiu Lian; age: 78, a nitrogen source; mobile phone number: 10098981010, respectively;
name: the Chinese character Xiu Lian; age: 25; mobile phone number: 10098981010, respectively;
name: the Chinese character Xiu Lian; age: 100, respectively; mobile phone number: 10098981010, respectively;
the method for generating the test case for the mobile phone number aiming at the test object comprises the following steps:
name: the Chinese character Xiu Lian; age: 35; mobile phone number: 10298070000, respectively;
name: the Chinese character Xiu Lian; age: 35; mobile phone number: 90109090890.
based on the same inventive concept, the embodiment of the present invention further provides an electronic device for generating a test case, and since the principle of solving the problem of the electronic device is similar to the method for generating the test case provided by the embodiment of the present invention, the implementation of the electronic device may refer to the implementation of the method, and repeated details are not repeated.
As shown in fig. 5, an apparatus for generating a test case according to an embodiment of the present invention includes a processor 500, a memory 501;
the processor 500 is configured to read a program in a memory and execute:
receiving a universal test case which comprises at least one test object and is reported by a terminal;
determining a target test data set corresponding to the type of the test object in the universal test case according to the corresponding relation between the type of the test object and the test data set;
and replacing data corresponding to the test object in the universal test case according to the test data in the target test data set to obtain the test case used in the test process.
Optionally, the processor 500 is specifically configured to:
and receiving a universal test case which contains at least one test object and is reported by the terminal through the json message.
Optionally, the processor 500 is specifically configured to:
and aiming at a target test data set corresponding to the type of any test object, using at least one target test data in the target test data set to respectively replace the data corresponding to the test object in the universal test case to obtain the test case.
Optionally, the processor 500 is specifically configured to:
determining the at least one target test data from the set of target test data according to:
and taking all the test data in the target test data set as the target test data.
Optionally, the processor 500 is further configured to:
receiving a test condition reported by a terminal when receiving a universal test case containing at least one test object reported by the terminal; determining the at least one target test data from the set of target test data according to: and determining at least one piece of test data meeting the test condition from the target test data set as the target test data.
Optionally, the processor 500 is specifically configured to:
generating a test data set corresponding to the test object type according to the following modes:
obtaining a test case sample containing at least one test object; aiming at any test object, determining a test data set corresponding to the type of the test object according to the corresponding relation between the type of the test object and the test data set; and taking the data corresponding to the test object analyzed from the test case sample as the test data in the test data set corresponding to the test object type.
Optionally, the processor 500 is specifically configured to:
after the test data set corresponding to the type of the test object is determined, before the data corresponding to the test object analyzed from the test case sample is used as the test data in the test data set corresponding to the type of the test object, it is determined that the test data set corresponding to the type of the test object does not contain the data corresponding to the test object analyzed from the test case sample.
Based on the same inventive concept, the embodiment of the present invention provides a device for generating a test case, and since the device corresponds to the method for generating a test case in the embodiment of the present invention, and the principle of the device for solving the problem is similar to that of the method, the implementation of the device may refer to the implementation of the method, and repeated details are not repeated.
As shown in fig. 6, an apparatus for generating a test case according to an embodiment of the present invention includes:
a receiving module 601, configured to receive a general test case including at least one test object reported by a terminal;
a determining module 602, configured to determine, according to a corresponding relationship between a test object type and a test data set, a target test data set corresponding to the test object type in the universal test case;
the generating module 603 is configured to replace data corresponding to the test object in the general test case according to the test data in the target test data set, so as to obtain a test case used in the test process.
Optionally, the receiving module 601 is specifically configured to:
and receiving a universal test case which contains at least one test object and is reported by the terminal through the json message.
Optionally, the generating module 603 is specifically configured to:
and aiming at a target test data set corresponding to the type of any test object, using at least one target test data in the target test data set to respectively replace the data corresponding to the test object in the universal test case to obtain the test case.
Optionally, the determining module 602 is specifically configured to:
determining the at least one target test data from the set of target test data according to:
and taking all the test data in the target test data set as the target test data.
Optionally, the receiving module 601 is further configured to:
receiving test conditions reported by the terminal;
the determining module 602 is further configured to:
determining the at least one target test data from the set of target test data according to:
and determining at least one piece of test data meeting the test condition from the target test data set as the target test data.
Optionally, the generating module 603 is specifically configured to:
generating a test data set corresponding to the test object type according to the following modes:
obtaining a test case sample containing at least one test object; aiming at any test object, determining a test data set corresponding to the type of the test object according to the corresponding relation between the type of the test object and the test data set; and taking the data corresponding to the test object analyzed from the test case sample as the test data in the test data set corresponding to the test object type.
Optionally, the generating module 603 is further configured to:
after the test data set corresponding to the type of the test object is determined, before the data corresponding to the test object analyzed from the test case sample is used as the test data in the test data set corresponding to the type of the test object, it is determined that the test data set corresponding to the type of the test object does not contain the data corresponding to the test object analyzed from the test case sample.
Embodiments of the present invention also provide a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the steps of any of the methods described above.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
It will be apparent to those skilled in the art that various changes and modifications may be made in the present application without departing from the spirit and scope of the application. Thus, if such modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is intended to include such modifications and variations as well.

Claims (10)

1. A method for generating test cases, the method comprising:
receiving a universal test case which comprises at least one test object and is reported by a terminal;
determining a target test data set corresponding to the type of the test object in the universal test case according to the corresponding relation between the type of the test object and the test data set;
and replacing data corresponding to the test object in the universal test case according to the test data in the target test data set to obtain the test case used in the test process.
2. The method of claim 1, wherein the receiving the generic test case reported by the terminal and containing at least one test object comprises:
and receiving a universal test case which contains at least one test object and is reported by the terminal through the json message.
3. The method of claim 1, wherein the replacing the data corresponding to the test object in the general test case according to the test data in the target test data set to obtain the test case used in the test process comprises:
and aiming at a target test data set corresponding to the type of any test object, using at least one target test data in the target test data set to respectively replace the data corresponding to the test object in the universal test case to obtain the test case.
4. The method of claim 3, wherein the at least one target test data is determined from the set of target test data according to:
and taking all the test data in the target test data set as the target test data.
5. The method of claim 3, wherein receiving the generic test case including at least one test object reported by the terminal, further comprises:
receiving test conditions reported by the terminal;
determining the at least one target test data from the set of target test data according to:
and determining at least one piece of test data meeting the test condition from the target test data set as the target test data.
6. The method according to any one of claims 1 to 5, wherein the test data set corresponding to the test object type is generated according to the following manner:
obtaining a test case sample containing at least one test object;
aiming at any test object, determining a test data set corresponding to the type of the test object according to the corresponding relation between the type of the test object and the test data set; and taking the data corresponding to the test object analyzed from the test case sample as the test data in the test data set corresponding to the test object type.
7. The method of claim 6, wherein after the determining the test data set corresponding to the type of the test object, before the data corresponding to the test object parsed from the test case sample is used as the test data in the test data set corresponding to the type of the test object, the method further comprises:
and determining that the test data set corresponding to the test object type does not contain the data corresponding to the test object analyzed from the test case sample.
8. An apparatus for generating test cases, comprising a processor and a memory;
wherein the processor is configured to read a program in the memory and execute:
receiving a universal test case which comprises at least one test object and is reported by a terminal;
determining a target test data set corresponding to the type of the test object in the universal test case according to the corresponding relation between the type of the test object and the test data set;
and replacing data corresponding to the test object in the universal test case according to the test data in the target test data set to obtain the test case used in the test process.
9. An apparatus for generating test cases, comprising:
the receiving module is used for receiving a universal test case which contains at least one test object and is reported by the terminal;
the determining module is used for determining a target test data set corresponding to the type of the test object in the universal test case according to the corresponding relation between the type of the test object and the test data set;
and the generating module is used for replacing the data corresponding to the test object in the universal test case according to the test data in the target test data set to obtain the test case used in the test process.
10. A computer-readable storage medium having stored thereon computer-executable instructions for performing the method of any one of claims 1 to 7.
CN201911064973.0A 2019-11-04 2019-11-04 Test case generation method and device and storage medium Pending CN111078526A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911064973.0A CN111078526A (en) 2019-11-04 2019-11-04 Test case generation method and device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911064973.0A CN111078526A (en) 2019-11-04 2019-11-04 Test case generation method and device and storage medium

Publications (1)

Publication Number Publication Date
CN111078526A true CN111078526A (en) 2020-04-28

Family

ID=70310653

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911064973.0A Pending CN111078526A (en) 2019-11-04 2019-11-04 Test case generation method and device and storage medium

Country Status (1)

Country Link
CN (1) CN111078526A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112433941A (en) * 2020-11-23 2021-03-02 中国建设银行股份有限公司 Test analysis method, device, equipment and storage medium
WO2021139272A1 (en) * 2020-05-28 2021-07-15 平安科技(深圳)有限公司 Test case reference method and apparatus

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103530223A (en) * 2012-07-06 2014-01-22 百度在线网络技术(北京)有限公司 Method and device for automatically generating unit test cases
CN103838672A (en) * 2014-03-04 2014-06-04 中国工商银行股份有限公司 Automated testing method and device for all-purpose financial statements
CN107908548A (en) * 2017-10-10 2018-04-13 深圳市买买提乐购金融服务有限公司 A kind of method and apparatus for generating test case
CN108446190A (en) * 2017-02-16 2018-08-24 杭州海康威视数字技术股份有限公司 interface test method and device

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103530223A (en) * 2012-07-06 2014-01-22 百度在线网络技术(北京)有限公司 Method and device for automatically generating unit test cases
CN103838672A (en) * 2014-03-04 2014-06-04 中国工商银行股份有限公司 Automated testing method and device for all-purpose financial statements
CN108446190A (en) * 2017-02-16 2018-08-24 杭州海康威视数字技术股份有限公司 interface test method and device
CN107908548A (en) * 2017-10-10 2018-04-13 深圳市买买提乐购金融服务有限公司 A kind of method and apparatus for generating test case

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2021139272A1 (en) * 2020-05-28 2021-07-15 平安科技(深圳)有限公司 Test case reference method and apparatus
CN112433941A (en) * 2020-11-23 2021-03-02 中国建设银行股份有限公司 Test analysis method, device, equipment and storage medium

Similar Documents

Publication Publication Date Title
CN106294120B (en) Method, apparatus and computer program product for testing code
CN109726093B (en) Method, apparatus and computer program product for executing test cases
EP2960799A1 (en) Defect localization in software integration tests
CN110221933B (en) Code defect auxiliary repairing method and system
CN105930257A (en) Method and apparatus for determining target test cases
CN107329889B (en) Method for automatically testing C compiler
CN115656791B (en) Test method and test platform for chip testability design
CN111078526A (en) Test case generation method and device and storage medium
CN104750601A (en) Test method and test device
CN106919431B (en) Code comparison method, equipment and system in continuous integration
CN110990289B (en) Method and device for automatically submitting bug, electronic equipment and storage medium
CN110688173B (en) Positioning method and device of components in cross-platform interface framework and electronic equipment
CN111680463A (en) File checking method and device
CN103309807B (en) program testing method and platform
US10853051B2 (en) Automated candidate repair patch generation
CN115794639B (en) Visual test based on flow and visual simulation test system and method
US20140281719A1 (en) Explaining excluding a test from a test suite
CN116431522A (en) Automatic test method and system for low-code object storage gateway
CN107102938A (en) The update method and device of test script
CN110347589B (en) Software unit test automatic detection method and system
CN108536587A (en) A kind of automated testing method and system based on Appium
CN111061258B (en) Function testing method and device based on train control system
CN115357513A (en) Program fuzzing test method, device, equipment and storage medium
CN115292159A (en) Test debugging method and system, corresponding computer equipment and storage medium
CN114020645A (en) Test method, device, equipment, readable storage medium and computer program product

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
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20200428