CN110716869B - Test case generation method and device, electronic equipment and computer readable storage medium - Google Patents

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

Info

Publication number
CN110716869B
CN110716869B CN201910881190.5A CN201910881190A CN110716869B CN 110716869 B CN110716869 B CN 110716869B CN 201910881190 A CN201910881190 A CN 201910881190A CN 110716869 B CN110716869 B CN 110716869B
Authority
CN
China
Prior art keywords
program
test case
identification information
segments
determining
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
CN201910881190.5A
Other languages
Chinese (zh)
Other versions
CN110716869A (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.)
Ping An Technology Shenzhen Co Ltd
Original Assignee
Ping An Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ping An Technology Shenzhen Co Ltd filed Critical Ping An Technology Shenzhen Co Ltd
Priority to CN201910881190.5A priority Critical patent/CN110716869B/en
Publication of CN110716869A publication Critical patent/CN110716869A/en
Application granted granted Critical
Publication of CN110716869B publication Critical patent/CN110716869B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

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
    • 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

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 application relates to test case generation in the technical field of software testing, in particular to a test case generation method, a device, electronic equipment and a computer readable storage medium, wherein the method comprises the following steps: acquiring N program segments and N identification information from a program library, wherein the N identification information corresponds to the N program segments one by one, and N is an integer greater than 1; determining the running sequence corresponding to the N program segments according to the N identification information; and generating test cases according to the N program segments and the running sequence. The embodiment of the application is beneficial to improving the generation efficiency of the test case.

Description

Test case generation method and device, electronic equipment and computer readable storage medium
Technical Field
The present application relates to the field of software testing technologies, and in particular, to a test case generating method, a test case generating device, an electronic device, and a computer readable storage medium.
Background
At present, the generation process of the test case is as follows: firstly, sequentially executing a plurality of touch function operations on a user graphical interface in a manual mode; then, a plurality of program segments corresponding to the touch function operations are called; finally, executing the operation of the connection program on the program segments to generate a test case; this approach results in inefficient generation of test cases.
Disclosure of Invention
The embodiment of the application provides a test case generation method, a device, electronic equipment and a computer readable storage medium, which are used for improving the generation efficiency of test cases.
In a first aspect, an embodiment of the present application provides a test case generating method, where the method includes:
Acquiring N program segments and N pieces of identification information from a program library, wherein the N pieces of identification information are in one-to-one correspondence with the N program segments, and N is an integer greater than 1;
determining the operation sequence corresponding to the N program segments according to the N identification information;
and generating test cases according to the N program segments and the running sequence.
In a second aspect, an embodiment of the present application provides a test case generating apparatus, including:
The device comprises an acquisition unit, a processing unit and a processing unit, wherein the acquisition unit is used for acquiring N program segments and N identification information from a program library, the N identification information corresponds to the N program segments one by one, and N is an integer greater than 1;
the first determining unit is used for determining the running sequence corresponding to the N program segments according to the N pieces of identification information;
and the generating unit is used for generating test cases according to the N program segments and the running sequence.
In a third aspect, an embodiment of the present application provides an electronic device, where the electronic device includes a touch display screen, and the electronic device further includes a processor, a memory, a communication interface, and one or more programs, where the one or more programs are stored in the memory and configured to be executed by the processor, where the programs include instructions for executing some or all of the steps in the method according to the first aspect of the present application.
In a fourth aspect, embodiments of the present application provide a computer readable storage medium storing a computer program, where the computer program is executed by a processor to implement some or all of the steps described in the method according to the first aspect of the embodiments of the present application.
Compared with the method that a plurality of touch function operations are sequentially executed on a user graphical interface in a manual mode, a plurality of program segments corresponding to the touch function operations are called, and a test case is generated by executing a connection program operation on the program segments, in the embodiment of the application, the electronic equipment automatically selects N program segments and N identification information from a program library, determines the operation sequence corresponding to the N program segments according to the N identification information, and generates the test case according to the N program segments and the operation sequence, so that the generation efficiency of the test case is improved.
These and other aspects of the application will be more readily apparent from the following description of the embodiments.
Drawings
In order to more clearly describe the embodiments of the present application or the technical solutions in the background art, the following description will describe the drawings that are required to be used in the embodiments of the present application or the background art.
FIG. 1 is a schematic diagram of a test case generating system according to an embodiment of the present application;
FIG. 2A is a schematic flow chart of a test case generation method according to an embodiment of the present application;
Fig. 2B is a schematic diagram of a touch function interface according to an embodiment of the present application;
FIG. 2C is a schematic diagram of a test case interface according to an embodiment of the present application;
FIG. 3 is a flowchart illustrating another test case generating method according to an embodiment of the present application;
FIG. 4 is a functional block diagram of a test case generating device according to an embodiment of the present application;
Fig. 5 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed description of the preferred embodiments
In order that those skilled in the art will better understand the present application, a technical solution in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in which it is apparent that the described embodiments are only some embodiments of the present application, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the present application without making any inventive effort, shall fall within the scope of the present application.
The following will describe in detail.
The terms "first," "second," "third," and "fourth" and the like in the description and in the claims and drawings are used for distinguishing between different objects and not necessarily for describing a particular sequential or chronological order. Furthermore, the terms "comprise" and "have," as well as any variations thereof, are intended to cover a non-exclusive inclusion. For example, a process, method, system, article, or apparatus that comprises a list of steps or elements is not limited to only those listed steps or elements but may include other steps or elements not listed or inherent to such process, method, article, or apparatus.
Reference herein to "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment may be included in at least one embodiment of the application. The appearances of such phrases in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. Those of skill in the art will explicitly and implicitly appreciate that the embodiments described herein may be combined with other embodiments.
The electronic devices may include various handheld devices, vehicle mounted devices, wearable devices, computing devices, or other processing devices connected to a wireless modem, as well as various forms of User Equipment (UE), mobile Station (MS), terminal devices (TERMINAL DEVICE), and the like.
Embodiments of the present application are described in detail below.
Referring to fig. 1, fig. 1 is a schematic structural diagram of a test case generating system according to an embodiment of the present application, where the test case generating system includes a processor and a touch display screen, and the method includes:
the processor is used for acquiring N program segments and N identification information from the program library, wherein the N identification information corresponds to the N program segments one by one, and N is an integer greater than 1;
the processor is used for determining the running sequence corresponding to the N program segments according to the N identification information;
The processor is used for generating test cases according to the N program segments and the running sequence;
the processor is used for executing pre-test operation on the test case to obtain the target test duration and the target touch function number of the test case;
the touch display screen is used for displaying a test case interface, and the test case interface comprises a test case, target test duration, the number of target touch functions and N target touch functions.
Referring to fig. 2A, fig. 2A is a flowchart of a test case generating method according to an embodiment of the present application, which is applied to an electronic device including a touch display screen, and the test case generating method includes steps 201 to 203, specifically as follows:
201: the electronic equipment acquires N program segments and N pieces of identification information from a program library, wherein the N pieces of identification information are in one-to-one correspondence with the N program segments, and N is an integer greater than 1.
In one possible example, the electronic device obtains N program segments and N pieces of identification information from a program library, including:
when detecting an acquisition request of program segment information, the electronic equipment acquires N program segment information from a program library;
The electronic device makes i=i+1, and circularly executes the operation of determining the ith program segment and the ith identification information corresponding to the ith program segment information according to the ith program segment information in the N program segment information until i=N exits from the circulation to obtain N program segments and N identification information, wherein the N program segments and the N identification information are in one-to-one correspondence with the N program segment information, and the i is an integer with an initial value of 1.
The electronic device can determine N program segments and N identification information according to the N program segment information in a parallel mode, and the N program segments and the N identification information are in one-to-one correspondence with the N program segment information.
202: And the electronic equipment determines the running sequence corresponding to the N program segments according to the N identification information.
In one possible example, the determining, by the electronic device, an operation sequence corresponding to the N program segments according to the N pieces of identification information includes:
The electronic device makes j=j+1, and circularly executes the operation of determining the j program segment creation time corresponding to the j identification information according to the j identification information in the N identification information until j=N exits the circulation to obtain N program segment creation times, wherein the N program segment creation times are in one-to-one correspondence with the N identification information, and j is an integer with an initial value of 1;
And the electronic equipment determines the time sequence of the creation time of the N program segments as the operation sequence corresponding to the N program segments.
The electronic device can determine N program segment creation moments according to N pieces of identification information in a parallel mode, wherein the N program segment creation moments are in one-to-one correspondence with the N pieces of identification information.
In one possible example, the determining, by the electronic device, an operation sequence corresponding to the N program segments according to the N pieces of identification information includes:
The electronic equipment determines N program annotations according to the N identification information, wherein the N program annotations are in one-to-one correspondence with the N identification information;
the electronic equipment determines N target touch functions according to the N program annotations, wherein the N target touch functions are in one-to-one correspondence with the N program annotations;
The electronic equipment determines N target execution sequence numbers according to a mapping relation between a pre-stored touch function and the execution sequence numbers, wherein the N target execution sequence numbers are in one-to-one correspondence with the N target touch functions;
And the electronic equipment determines the execution sequence of the N target execution sequence numbers as the operation sequence corresponding to the N program segments.
The program annotation is an annotation of a touch function corresponding to the program segment by a programmer.
The mapping relationship between the touch function and the execution sequence number is shown in the following table 1:
TABLE 1
Touch control function Execution sequence number
Touch control function 1 Execution sequence number 1
Touch control function 2 Execution sequence number 2
Touch control function 3 Execution sequence number 3
...... ......
In one possible example, the determining, by the electronic device, an operation order corresponding to the N program segments according to the N identification information includes:
the electronic equipment determines N program annotations according to the N identification information, wherein the N program annotations are in one-to-one correspondence with the N identification information;
the electronic equipment determines N target touch functions according to the N program annotations, and the N target touch functions are in one-to-one correspondence with the N program annotations;
The electronic equipment displays a touch function interface on a touch display screen, wherein the touch function interface comprises N target touch functions and N execution sequence number input boxes, and the N execution sequence number input boxes are in one-to-one correspondence with the N target touch functions;
when the touch operation aiming at the N execution sequence number input boxes is detected, the electronic equipment acquires N target execution sequence numbers corresponding to the touch operation;
the electronic equipment determines the execution sequence of the N target execution sequence numbers as the operation sequence corresponding to the N program segments.
For example, as shown in fig. 2B, fig. 2B is a schematic diagram of a touch function interface provided by the embodiment of the application, where the touch function interface includes 5 target touch functions and 5 execution sequence number input boxes, the touch function 1 corresponds to the execution sequence number input box 1, the touch function 2 corresponds to the execution sequence number input box 2, the touch function 3 corresponds to the execution sequence number input box 3, the touch function 4 corresponds to the execution sequence number input box 4, and the touch function 5 corresponds to the execution sequence number input box 5.
203: And the electronic equipment generates test cases according to the N program segments and the running sequence.
Where a test case is a set of test inputs, execution conditions, and expected results that are tailored to a particular goal in order to test a program path or verify whether a particular requirement is met.
Compared with the method that a plurality of touch function operations are sequentially executed on a user graphical interface in a manual mode, a plurality of program segments corresponding to the touch function operations are called, and a test case is generated by executing a connection program operation on the program segments, in the embodiment of the application, the electronic equipment automatically selects N program segments and N identification information from a program library, determines the operation sequence corresponding to the N program segments according to the N identification information, and generates the test case according to the N program segments and the operation sequence, so that the generation efficiency of the test case is improved.
In one possible example, the electronic device generates test cases according to the N program segments and the running order, including:
The electronic equipment judges whether the N is smaller than a preset value;
if the N is smaller than the preset value, the electronic equipment executes a connecting program operation on the kth program section and the (k+1) th program section according to the running sequence;
after the execution of the connection program operation on the kth program segment and the (k+1) th program segment is finished, the electronic device executes the connection program operation on the (k+1) th program segment and the (k+2) th program segment according to the running sequence;
and stopping the operation of the connection program by the electronic equipment until k=N-1, and obtaining the test case, wherein k is an increasing integer with an initial value of 1 and 1 as an interval.
The electronic device performs the program connection operation on the kth program segment group and the (k+1) th program segment according to the prior art, and will not be described herein.
In one possible example, the electronic device generates test cases according to the N program segments and the running order, including:
The electronic equipment judges whether N is smaller than a preset value;
If N is not smaller than the preset value, the electronic equipment performs sequencing operation on the N program segments according to the running sequence to obtain N sequenced program segments;
the electronic equipment divides the N program segments after sequencing into M first program segment groups, wherein each first program segment group from the 1 st first program segment group to the (M-1) th first program segment group comprises P program segments, the M first program segment group comprises [ N- (M-1) x P ] program segments, and M and P are integers larger than 1;
The electronic equipment executes program connection operation on the r first program segment group according to the operation sequence to obtain an r second program segment group corresponding to the r first program segment group, wherein the r first program segment group is any one of M first program segment groups;
the electronic device executes the same operation on the (M-1) first program segment groups except the (r) first program segment group to obtain (M-1) second program segment groups, wherein the (M-1) second program segment groups are in one-to-one correspondence with the (M-1) first program segment groups;
And the electronic equipment executes program connection operation on the (M-1) th second program segment group and the (r) th second program segment group to obtain the test case.
In this example, when N is greater than or equal to a preset value, the electronic device divides the N sequenced program segments into M first program segment groups, performs a program connection operation on each first program segment group to obtain M second program segment groups, and performs a program connection operation on the M second program segment groups to obtain a test case, which is helpful to improve the generation efficiency of the test case to a certain extent.
In one possible example, after the electronic device generates the test cases according to the N program segments and the running order, the method further includes:
The electronic equipment executes a pre-test operation on the test case to obtain the target test duration and the target touch function number of the test case;
The electronic equipment displays a test case interface on the touch display screen, wherein the test case interface comprises the test case, a test duration identifier, the target test duration, a touch function number identifier, the target touch function number and the N target touch functions.
For example, as shown in fig. 2C, fig. 2C is a schematic diagram of a test case interface provided by an embodiment of the present application, where the test case interface includes a test case, a test duration identifier, a target test duration identifier of 30min, a touch function number identifier, a target touch function number of 5, a touch function 1, a touch function 2, a touch function 3, a touch function 4, and a touch function 5.
In one possible example, after the electronic device displays the test case interface on the touch display screen, the method further includes:
the electronic equipment determines a first test case score corresponding to the target test duration according to a mapping relation between the pre-stored test duration and the test case score;
the electronic equipment determines second test case scores corresponding to the target touch function number according to a mapping relation between the pre-stored touch function number and the test case scores;
And the electronic equipment determines a target test case score corresponding to the test case according to the first test case score, the second test case score and the test case score formula.
The mapping relationship between the test duration and the test case score is shown in the following table 2:
TABLE 2
Duration of test Test case score
t≥T1 S1
T2≤t<T1 S2
T3≤t<T2 S3
t<T3 S4
Wherein S1 > S2 > S4.
The mapping relationship between the number of touch functions and the number of test cases is shown in the following table 3:
TABLE 3 Table 3
Number of touch functions Test case score
n≥N1 S5
N2≤n<N1 S6
N3≤n<N2 S7
n<N3 S8
Wherein S5 > S6 > S7 > S8.
The score formula of the test case is as follows:
S=A×α+B×β,
S is a target test case score corresponding to the test case, A is a first test case score corresponding to the target test time length, alpha is a weight corresponding to the test time length, B is a second test case score corresponding to the target touch function number, beta is a weight corresponding to the touch function number, and alpha+beta=1.
Referring to fig. 3, fig. 3 is a schematic flow chart of another test case generating method according to the embodiment of the present application, which is consistent with the embodiment shown in fig. 2A, and is applied to an electronic device including a touch display screen, where the test case generating method includes steps 301 to 311, specifically as follows:
301: the electronic equipment acquires N program segments and N pieces of identification information from a program library, wherein the N pieces of identification information are in one-to-one correspondence with the N program segments, and N is an integer greater than 1.
302: And the electronic equipment determines N program annotations according to the N pieces of identification information, wherein the N program annotations are in one-to-one correspondence with the N pieces of identification information.
303: And the electronic equipment determines N target touch functions according to the N program annotations, wherein the N target touch functions are in one-to-one correspondence with the N program annotations.
304: The electronic equipment determines N target execution serial numbers according to the mapping relation between the touch function and the execution serial numbers, the N target execution serial numbers correspond to the N target touch functions one by one, and the mapping relation between the touch function and the execution serial numbers is prestored in the electronic equipment.
305: And the electronic equipment determines the execution sequence of the N target execution sequence numbers as the operation sequence corresponding to the N program segments.
306: And the electronic equipment judges whether the N is smaller than a preset value.
307: And if the N is smaller than the preset value, the electronic equipment executes the connection program operation on the kth program section and the (k+1) th program section according to the running sequence.
308: After the execution of the linking program operation on the kth program segment and the (k+1) th program segment is ended, the electronic device executes the linking program operation on the (k+1) th program segment and the (k+2) th program segment according to the operation order.
309: And stopping the operation of the connection program by the electronic equipment until k=N-1, and obtaining the test case, wherein k is an increasing integer with an initial value of 1 and 1 as an interval.
310: And the electronic equipment executes a pre-test operation on the test case to obtain the target test duration and the target touch function number of the test case.
311: The electronic equipment displays a test case interface on the touch display screen, wherein the test case interface comprises the test case, a test duration identifier, the target test duration, a touch function number identifier, the target touch function number and the N target touch functions.
It should be noted that, the specific implementation of each step of the method shown in fig. 3 may refer to the specific implementation of the foregoing method, which is not described herein.
The foregoing embodiments mainly describe the solution of the embodiment of the present application from the point of view of the method-side execution process. It will be appreciated that the electronic device, in order to achieve the above-described functions, includes corresponding hardware structures and/or software modules that perform the respective functions. Those of skill in the art will readily appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as hardware or combinations of hardware and computer software. Whether a function is implemented as hardware or computer software driven hardware depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
According to the embodiment of the application, the electronic equipment can be divided into the functional units according to the method examples, for example, each functional unit can be divided corresponding to each function, and two or more functions can be integrated into one processing unit. The integrated units may be implemented in hardware or in software functional units. It should be noted that, in the embodiment of the present application, the division of the units is schematic, which is merely a logic function division, and other division manners may be implemented in actual practice.
Referring to fig. 4, fig. 4 is a functional unit block diagram of a test case generating apparatus according to an embodiment of the present application, which is applied to an electronic device including a touch display screen, and the test case generating apparatus 400 includes:
an obtaining unit 401, configured to obtain N program segments and N pieces of identification information from a program library, where the N pieces of identification information are in one-to-one correspondence with the N program segments, and N is an integer greater than 1;
a first determining unit 402, configured to determine an operation sequence corresponding to the N program segments according to the N pieces of identification information;
And the generating unit 403 is configured to generate test cases according to the N program segments and the running order.
Compared with the method that a plurality of touch function operations are sequentially executed on a user graphical interface in a manual mode, a plurality of program segments corresponding to the touch function operations are called, and a test case is generated by executing a connection program operation on the program segments, in the embodiment of the application, the electronic equipment automatically selects N program segments and N identification information from a program library, determines the operation sequence corresponding to the N program segments according to the N identification information, and generates the test case according to the N program segments and the operation sequence, so that the generation efficiency of the test case is improved.
In one possible example, in acquiring N program segments and N pieces of identification information from the program library, the acquiring unit 401 is specifically configured to:
When detecting an acquisition request of program segment information, acquiring N program segment information from a program library;
And (3) circularly executing the operation of determining the ith program segment and the ith identification information corresponding to the ith program segment information according to the ith program segment information in the N program segment information until the i=i+1 exits the cycle to obtain N program segments and N identification information, wherein the N program segments and the N identification information are in one-to-one correspondence with the N program segment information, and the i is an integer with an initial value of 1.
In one possible example, in determining the running sequence corresponding to the N program segments according to the N pieces of identification information, the first determining unit 402 is specifically configured to:
The j=j+1 is caused to circularly execute the operation of determining the j-th program segment creation time corresponding to the j-th identification information according to the j-th identification information in the N identification information until j=N exits from the circulation to obtain N program segment creation times, wherein the N program segment creation times are in one-to-one correspondence with the N identification information, and j is an integer with an initial value of 1;
And determining the time sequence of the creation time of the N program segments as the operation sequence corresponding to the N program segments.
In one possible example, in determining the running sequence corresponding to the N program segments according to the N pieces of identification information, the first determining unit 402 is specifically configured to:
Determining N program annotations according to the N identification information, wherein the N program annotations are in one-to-one correspondence with the N identification information;
Determining N target touch functions according to the N program notes, wherein the N target touch functions are in one-to-one correspondence with the N program notes;
Determining N target execution sequence numbers according to a mapping relation between a pre-stored touch function and an execution sequence number, wherein the N target execution sequence numbers are in one-to-one correspondence with the N target touch functions;
And determining the execution sequence of the N target execution sequence numbers as the operation sequence corresponding to the N program segments.
In one possible example, in generating test cases according to the N program segments and the running order, the generating unit 403 is specifically configured to:
Judging whether the N is smaller than a preset value or not;
If the N is smaller than the preset value, executing a connecting program operation on the kth program section and the (k+1) th program section according to the running sequence;
After the execution of the linking program operation on the kth program segment and the (k+1) th program segment is finished, executing the linking program operation on the (k+1) th program segment and the (k+2) th program segment according to the running sequence;
And stopping the operation of the connection program until k=N-1, and obtaining the test case, wherein k is an increasing integer with an initial value of 1 and 1 as an interval.
In one possible example, the test case generating apparatus 400 further includes:
the test unit 404 is configured to perform a pre-test operation on the test case, so as to obtain a target test duration and a target number of touch functions of the test case;
The display unit 405 is configured to display a test case interface on the touch display screen, where the test case interface includes the test case, a test duration identifier, the target test duration, a touch function number identifier, the target touch function number, and the N target touch functions.
In one possible example, the test case generating apparatus 400 further includes:
A second determining unit 406, configured to determine a first test case score corresponding to the target test duration according to a mapping relationship between a pre-stored test duration and a test case score;
A third determining unit 407, configured to determine a second test case score corresponding to the target touch function number according to a mapping relationship between the pre-stored touch function number and the test case score;
The fourth determining unit 408 is configured to determine a target test case score corresponding to the test case according to the first test case score, the second test case score, and a test case score formula.
Referring to fig. 5, fig. 5 is a schematic structural diagram of an electronic device 500 according to an embodiment of the present application, where the electronic device 500 includes a touch display screen, and the electronic device 500 further includes a processor, a memory, a communication interface, and one or more programs, where the one or more programs are stored in the memory and configured to be executed by the processor, and the programs include instructions for executing the following steps:
Acquiring N program segments and N pieces of identification information from a program library, wherein the N pieces of identification information are in one-to-one correspondence with the N program segments, and N is an integer greater than 1;
determining the operation sequence corresponding to the N program segments according to the N identification information;
and generating test cases according to the N program segments and the running sequence.
Compared with the method that a plurality of touch function operations are sequentially executed on a user graphical interface in a manual mode, a plurality of program segments corresponding to the touch function operations are called, and a test case is generated by executing a connection program operation on the program segments, in the embodiment of the application, the electronic equipment automatically selects N program segments and N identification information from a program library, determines the operation sequence corresponding to the N program segments according to the N identification information, and generates the test case according to the N program segments and the operation sequence, so that the generation efficiency of the test case is improved.
In one possible example, in acquiring N program segments and N identification information from a program library, the program includes instructions specifically for:
When detecting an acquisition request of program segment information, acquiring N program segment information from a program library;
And (3) circularly executing the operation of determining the ith program segment and the ith identification information corresponding to the ith program segment information according to the ith program segment information in the N program segment information until the i=i+1 exits the cycle to obtain N program segments and N identification information, wherein the N program segments and the N identification information are in one-to-one correspondence with the N program segment information, and the i is an integer with an initial value of 1.
In one possible example, in determining the running sequence corresponding to the N program segments according to the N pieces of identification information, the program includes instructions specifically for performing the following steps:
The j=j+1 is caused to circularly execute the operation of determining the j-th program segment creation time corresponding to the j-th identification information according to the j-th identification information in the N identification information until j=N exits from the circulation to obtain N program segment creation times, wherein the N program segment creation times are in one-to-one correspondence with the N identification information, and j is an integer with an initial value of 1;
And determining the time sequence of the creation time of the N program segments as the operation sequence corresponding to the N program segments.
In one possible example, in determining the running sequence corresponding to the N program segments according to the N pieces of identification information, the program includes instructions specifically for performing the following steps:
Determining N program annotations according to the N identification information, wherein the N program annotations are in one-to-one correspondence with the N identification information;
Determining N target touch functions according to the N program notes, wherein the N target touch functions are in one-to-one correspondence with the N program notes;
Determining N target execution sequence numbers according to a mapping relation between a pre-stored touch function and an execution sequence number, wherein the N target execution sequence numbers are in one-to-one correspondence with the N target touch functions;
And determining the execution sequence of the N target execution sequence numbers as the operation sequence corresponding to the N program segments.
In one possible example, in generating test cases according to the N program segments and the execution order, the program includes instructions specifically for performing the steps of:
Judging whether the N is smaller than a preset value or not;
If the N is smaller than the preset value, executing a connecting program operation on the kth program section and the (k+1) th program section according to the running sequence;
After the execution of the linking program operation on the kth program segment and the (k+1) th program segment is finished, executing the linking program operation on the (k+1) th program segment and the (k+2) th program segment according to the running sequence;
And stopping the operation of the connection program until k=N-1, and obtaining the test case, wherein k is an increasing integer with an initial value of 1 and 1 as an interval.
In one possible example, applied to an electronic device comprising a touch display screen, the program further comprises instructions for performing the steps of:
executing a pre-test operation on the test case to obtain a target test duration and a target touch function number of the test case;
Displaying a test case interface on the touch display screen, wherein the test case interface comprises the test case, a test duration identifier, the target test duration, a touch function number identifier, the target touch function number and the N target touch functions.
In one possible example, the above-described program further includes instructions for performing the steps of:
Determining a first test case score corresponding to the target test duration according to a mapping relation between the pre-stored test duration and the test case score;
Determining a second test case score corresponding to the target touch function number according to a mapping relation between the prestored touch function number and the test case score;
and determining a target test case score corresponding to the test case according to the first test case score, the second test case score and a test case score formula.
The embodiment of the present application also provides a computer readable storage medium storing a computer program, where the computer program is executed by a processor to implement part or all of the steps of any one of the methods described in the embodiments of the method, where the computer includes an electronic device.
Embodiments of the present application also provide a computer program product comprising a non-transitory computer-readable storage medium storing a computer program operable to cause a computer to perform part or all of the steps of any one of the methods described in the method embodiments above. The computer program product may be a software installation package, said computer comprising an electronic device.
It should be noted that, for simplicity of description, the foregoing method embodiments are all described as a series of acts, but it should be understood by those skilled in the art that the present application is not limited by the order of acts described, as some steps may be performed in other orders or concurrently in accordance with the present application. Further, those skilled in the art will also appreciate that the embodiments described in the specification are all preferred embodiments, and that the acts and modules referred to are not necessarily required for the present application.
In the foregoing embodiments, the descriptions of the embodiments are emphasized, and for parts of one embodiment that are not described in detail, reference may be made to related descriptions of other embodiments.
In the several embodiments provided by the present application, it should be understood that the disclosed apparatus may be implemented in other manners. For example, the above-described apparatus embodiments are merely illustrative, such as the above-described division of units, merely a division of logic functions, and there may be additional manners of dividing in actual implementation, such as multiple units or components may be combined or integrated into another system, or some features may be omitted, or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be an indirect coupling or communication connection via some interfaces, devices or units, or may be in electrical or other forms.
The units described above as separate components may or may not be physically separate, and components shown as units may or may not be physical units, may be located in one place, or may be distributed over a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional unit in the embodiments of the present application may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units may be implemented in hardware or in software functional units.
The integrated units described above, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored in a computer readable memory. Based on such understanding, the technical solution of the present application may be embodied in essence or a part contributing to the prior art or all or part of the technical solution in the form of a software product stored in a memory, comprising several instructions for causing a computer device (which may be a personal computer, a server or a network device, etc.) to perform all or part of the steps of the above-mentioned method of the various embodiments of the present application. And the aforementioned memory includes: a usb disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a removable hard disk, a magnetic disk, or an optical disk, or other various media capable of storing program codes.
Those of ordinary skill in the art will appreciate that all or a portion of the steps in the various methods of the above embodiments may be implemented by a program that instructs associated hardware, and the program may be stored in a computer readable memory, which may include: flash disk, read-Only Memory (ROM), random access Memory (Random Access Memory, RAM), magnetic disk or optical disk.
The foregoing has outlined rather broadly the more detailed description of embodiments of the application, wherein the principles and embodiments of the application are explained in detail using specific examples, the above examples being provided solely to facilitate the understanding of the method and core concepts of the application; meanwhile, as those skilled in the art will appreciate, modifications will be made in the specific implementation and application scope in accordance with the idea of the present application, and the above description should not be construed as limiting the present application.

Claims (10)

1. A method for generating test cases, the method comprising:
Acquiring N program segments and N pieces of identification information from a program library, wherein the N pieces of identification information are in one-to-one correspondence with the N program segments, and N is an integer greater than 1;
determining the operation sequence corresponding to the N program segments according to the N identification information;
Generating test cases according to the N program segments and the running sequence, wherein the test cases comprise: judging whether N is smaller than a preset value, if N is not smaller than the preset value, executing a program connection operation on N program sections according to an operation sequence to obtain N program sections after sequencing, dividing the N program sections after sequencing into M first program section groups, wherein each first program section group from the 1 st first program section group to the (M-1) th first program section group comprises P program sections, the M first program section group comprises [ N- (M-1) x P ] program sections, M and P are integers larger than 1, executing a program connection operation on the r first program section group according to the operation sequence to obtain a r second program section group corresponding to the r first program section group, the r first program section group is any one of the M first program section groups, executing the same operation on the (M-1) first program section groups except the r first program section group to obtain (M-1) second program section groups, and executing the first program section group to obtain (M-1) second program section groups corresponding to the second program section group, and executing the first program section groups to obtain the first program section groups.
2. The method of claim 1, wherein the obtaining N program segments and N identification information from the program library comprises:
When detecting an acquisition request of program segment information, acquiring N program segment information from a program library;
And (3) circularly executing the operation of determining the ith program segment and the ith identification information corresponding to the ith program segment information according to the ith program segment information in the N program segment information until the i=i+1 exits the cycle to obtain N program segments and N identification information, wherein the N program segments and the N identification information are in one-to-one correspondence with the N program segment information, and the i is an integer with an initial value of 1.
3. The method according to claim 1 or 2, wherein determining the running order corresponding to the N program segments according to the N pieces of identification information includes:
The j=j+1 is caused to circularly execute the operation of determining the j-th program segment creation time corresponding to the j-th identification information according to the j-th identification information in the N identification information until j=N exits from the circulation to obtain N program segment creation times, wherein the N program segment creation times are in one-to-one correspondence with the N identification information, and j is an integer with an initial value of 1;
And determining the time sequence of the creation time of the N program segments as the operation sequence corresponding to the N program segments.
4. The method according to claim 1 or 2, wherein determining the running order corresponding to the N program segments according to the N pieces of identification information includes:
Determining N program annotations according to the N identification information, wherein the N program annotations are in one-to-one correspondence with the N identification information;
Determining N target touch functions according to the N program notes, wherein the N target touch functions are in one-to-one correspondence with the N program notes;
Determining N target execution sequence numbers according to a mapping relation between a pre-stored touch function and an execution sequence number, wherein the N target execution sequence numbers are in one-to-one correspondence with the N target touch functions;
And determining the execution sequence of the N target execution sequence numbers as the operation sequence corresponding to the N program segments.
5. The method of claim 4, wherein generating test cases from the N program segments and the run order comprises:
Judging whether the N is smaller than a preset value or not;
If the N is smaller than the preset value, executing a connecting program operation on the kth program section and the (k+1) th program section according to the running sequence;
After the execution of the linking program operation on the kth program segment and the (k+1) th program segment is finished, executing the linking program operation on the (k+1) th program segment and the (k+2) th program segment according to the running sequence;
And stopping the operation of the connection program until k=N-1, and obtaining the test case, wherein k is an increasing integer with an initial value of 1 and 1 as an interval.
6. The method of claim 5, applied to an electronic device including a touch display screen, after generating test cases according to the N program segments and the running order, the method further comprising:
executing a pre-test operation on the test case to obtain a target test duration and a target touch function number of the test case;
Displaying a test case interface on the touch display screen, wherein the test case interface comprises the test case, a test duration identifier, the target test duration, a touch function number identifier, the target touch function number and the N target touch functions.
7. The method of claim 6, wherein after displaying the test case interface on the touch display screen, the method further comprises:
Determining a first test case score corresponding to the target test duration according to a mapping relation between the pre-stored test duration and the test case score;
Determining a second test case score corresponding to the target touch function number according to a mapping relation between the prestored touch function number and the test case score;
and determining a target test case score corresponding to the test case according to the first test case score, the second test case score and a test case score formula.
8. A test case generating device, the device comprising:
The device comprises an acquisition unit, a processing unit and a processing unit, wherein the acquisition unit is used for acquiring N program segments and N identification information from a program library, the N identification information corresponds to the N program segments one by one, and N is an integer greater than 1;
the first determining unit is used for determining the running sequence corresponding to the N program segments according to the N pieces of identification information;
the generating unit is used for generating test cases according to the N program segments and the running sequence;
The generating unit is further configured to determine whether N is smaller than a preset value, if N is not smaller than the preset value, execute a program connection operation on the N first program segment groups according to an operation sequence to obtain N ordered program segments, divide the N ordered program segments into M first program segment groups, each of the 1 st first program segment group to the (M-1) first program segment group includes P program segments, the M first program segment groups include [ N- (M-1) x P ] program segments, M and P are integers greater than 1, execute a program connection operation on the first program segment groups according to the operation sequence to obtain an r second program segment group corresponding to the r first program segment groups, the r first program segment groups are any one of the M first program segment groups, execute the same operation on the (M-1) first program segment groups except the first program segment groups to obtain (M-1) first program segments, and execute the first program segment groups corresponding to the first program segments (M-1) to obtain the (M-1 second program segment groups, and execute the first program segment groups to obtain the (M-1) first program segment groups and the second program segment groups corresponding to the first program segment groups).
9. An electronic device comprising a touch display screen, the electronic device further comprising a processor, a memory, a communication interface, and one or more programs stored in the memory and configured to be executed by the processor, the programs comprising instructions for performing part or all of the steps of the method of any of claims 1-7.
10. A computer readable storage medium for storing a computer program for execution by a processor to implement the method of any one of claims 1-7.
CN201910881190.5A 2019-09-18 2019-09-18 Test case generation method and device, electronic equipment and computer readable storage medium Active CN110716869B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910881190.5A CN110716869B (en) 2019-09-18 2019-09-18 Test case generation method and device, electronic equipment and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910881190.5A CN110716869B (en) 2019-09-18 2019-09-18 Test case generation method and device, electronic equipment and computer readable storage medium

Publications (2)

Publication Number Publication Date
CN110716869A CN110716869A (en) 2020-01-21
CN110716869B true CN110716869B (en) 2024-05-14

Family

ID=69209941

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910881190.5A Active CN110716869B (en) 2019-09-18 2019-09-18 Test case generation method and device, electronic equipment and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN110716869B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113360364B (en) * 2020-03-04 2024-04-19 腾讯科技(深圳)有限公司 Target object testing method and device
CN113419954B (en) * 2021-06-25 2023-03-31 陕西浪潮英信科技有限公司 Execution method and system of automation use case of cloud operating system and related components

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103019934A (en) * 2012-11-28 2013-04-03 北京交控科技有限公司 Test case generation method based on data code separation technology
CN103176896A (en) * 2011-12-23 2013-06-26 阿里巴巴集团控股有限公司 Generating method and generating device of test cases
CN103699475A (en) * 2012-09-27 2014-04-02 西门子公司 Method, device and system for optimizing test samples in fuzzy test
CN108073519A (en) * 2018-01-31 2018-05-25 百度在线网络技术(北京)有限公司 Method for generating test case and device
CN108170602A (en) * 2017-12-28 2018-06-15 上海璞恒新能源科技有限公司 A kind of method for generating test case, device, terminal and computer-readable medium
CN108984389A (en) * 2018-06-01 2018-12-11 平安科技(深圳)有限公司 A kind of applied program testing method and terminal device
CN109376069A (en) * 2018-09-03 2019-02-22 中国平安人寿保险股份有限公司 A kind of generation method and equipment of test report
WO2019165691A1 (en) * 2018-02-28 2019-09-06 平安科技(深圳)有限公司 Method, apparatus and device for automatically generating test case, and readable storage medium

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103176896A (en) * 2011-12-23 2013-06-26 阿里巴巴集团控股有限公司 Generating method and generating device of test cases
CN103699475A (en) * 2012-09-27 2014-04-02 西门子公司 Method, device and system for optimizing test samples in fuzzy test
CN103019934A (en) * 2012-11-28 2013-04-03 北京交控科技有限公司 Test case generation method based on data code separation technology
CN108170602A (en) * 2017-12-28 2018-06-15 上海璞恒新能源科技有限公司 A kind of method for generating test case, device, terminal and computer-readable medium
CN108073519A (en) * 2018-01-31 2018-05-25 百度在线网络技术(北京)有限公司 Method for generating test case and device
WO2019165691A1 (en) * 2018-02-28 2019-09-06 平安科技(深圳)有限公司 Method, apparatus and device for automatically generating test case, and readable storage medium
CN108984389A (en) * 2018-06-01 2018-12-11 平安科技(深圳)有限公司 A kind of applied program testing method and terminal device
CN109376069A (en) * 2018-09-03 2019-02-22 中国平安人寿保险股份有限公司 A kind of generation method and equipment of test report

Also Published As

Publication number Publication date
CN110716869A (en) 2020-01-21

Similar Documents

Publication Publication Date Title
CN110716869B (en) Test case generation method and device, electronic equipment and computer readable storage medium
CN106294120B (en) Method, apparatus and computer program product for testing code
CN106980571B (en) Method and equipment for constructing test case suite
CN110750447B (en) Software testing method and related equipment
US11301237B2 (en) Upgrading method and apparatus
CN106776312B (en) The method, apparatus of cloud pressure testing data distribution calculates equipment and pressure testing system
CN110457224B (en) Method and device for generating test data
CN114239952B (en) Abnormality detection method, device, equipment and medium for key performance indexes
CN113590007B (en) Method and device for generating progress bar, computer equipment and storage medium
CN111488278A (en) Test method and device
CN108664593A (en) Data consistency verification method, device, storage medium and electronic equipment
CN108334451B (en) Page compatibility testing method and device
CN111782507B (en) Data testing method and device, storage medium and electronic equipment
CN106874639B (en) Permanent luffing loads the fatigue life reliability appraisal procedure and device of lower mechanical structure
CN107590389A (en) Method for testing security and device, electronic equipment, computer-readable storage medium
CN113158177A (en) Dynamic measurement method, device, equipment and storage medium
CN107451063B (en) Script testing method and device
JP2013242709A (en) Information processing system and program
CN110210522A (en) The training method and device of picture quality Fraction Model
CN104156312A (en) Method for evaluating software reliability
CN111310393B (en) Simulation clock generation method and related product
CN115470095A (en) Test method, test system, electronic equipment and computer storage medium
CN110334017B (en) Test script generation method and related device
CN107885649A (en) The performance test methods and device of IOS application programs
CN112906117A (en) Indoor equipment layout generating method and device, electronic equipment and storage medium

Legal Events

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