Recommended methods and devices for test cases

By analyzing test task requirement data and performing Bayesian network calculations, suitable test cases are selected, solving the problem that test case selection relies on subjective experience and improving testing efficiency.

CN115994093BActive Publication Date: 2025-12-02SPREADTRUM COMM (TIANJIN) INC
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202310084519.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-02-07
Publication Date
2025-12-02
Estimated Expiration
2043-02-07

AI Technical Summary

Technical Problem

In existing technologies, the selection of test cases relies on the tester's subjective experience, making it difficult to effectively determine applicable test cases and affecting testing efficiency.

Method used

Test environment information is generated by parsing the requirement data of the test task, test cases suitable for the environment are selected, and the comprehensive evaluation value of the test cases is calculated based on Bayesian network. Test cases with a comprehensive evaluation value greater than a preset threshold are recommended.

Benefits of technology

It can quickly and accurately recommend suitable test cases, improve testing efficiency, and reduce the subjective dependence on test case selection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115994093B_ABST
    Figure CN115994093B_ABST
Patent Text Reader

Abstract

This invention relates to the field of computer technology, and more particularly to a test case recommendation method and apparatus. The method involves parsing the requirement data of a test task to generate test environment information, filtering all test cases suitable for the test environment information from a test case set, calculating a comprehensive evaluation value for each test case based on its environment variables, and identifying test cases with comprehensive evaluation values ​​greater than a preset threshold as selectable test cases for the test task. By calculating the comprehensive evaluation values ​​of different test cases, suitable test tasks can be recommended quickly and accurately, improving testing efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer technology, and in particular to a test case recommendation method and apparatus. Background Technology

[0002] Currently, software testing is mainly divided into automated testing and manual testing. Automated testing can save human resources and reduce the probability of errors in the entire testing process. Although automated testing has become widespread, the selection of test cases still relies heavily on the subjective experience of testers.

[0003] Existing technologies typically employ fuzzy computation based on genetic algorithms. However, since the influence of different environmental variables in software testing is not easily detected, this method struggles to effectively determine applicable test cases, thus impacting testing efficiency. Summary of the Invention

[0004] This invention provides a test case recommendation method and apparatus. By calculating the comprehensive evaluation value of different test cases, it can quickly and accurately recommend test tasks suitable for the test task, thereby improving testing efficiency.

[0005] In a first aspect, embodiments of the present invention provide a test case recommendation method, including:

[0006] Parse the requirement data of the test task and generate the test environment information of the test task;

[0007] Filter out all test cases that are applicable to the test environment information from the test case set;

[0008] The comprehensive evaluation value of each test case is calculated based on the environment variables of each test case;

[0009] Test cases whose comprehensive evaluation value is greater than a preset threshold are identified as optional test cases for the test task.

[0010] In one embodiment, calculating the comprehensive evaluation value of the test case based on the environment variables of each test case includes:

[0011] For any test case, retrieve the historical test data for the current test case;

[0012] The evaluation value of each environment variable for the current test case is determined based on the historical test data.

[0013] The comprehensive evaluation value of the current test case is obtained by summing the evaluation values ​​of all environment variables included in the current test case.

[0014] In one embodiment, determining the evaluation value of each environment variable for the current test case based on the historical test data includes:

[0015] A test matrix for the current test case is generated based on the historical test data of the current test case. Each column of the test matrix corresponds to an environment variable, and the value of any row of the test matrix is ​​the value of each environment variable when the current test case was executed previously.

[0016] Calculate the probability of different values ​​of each environment variable in the current test case occurring under a specific test result based on a Bayesian network;

[0017] For any environmental variable, the evaluation value of the current environmental variable is determined based on the probability of different values ​​of the current environmental variable appearing under a specific test result.

[0018] In one embodiment, the step of filtering all test cases applicable to the test environment information from the test case set includes:

[0019] Historical test data for each test case is collected from the database using Structured Query Language (SQL).

[0020] The key test characteristics of the test cases are determined based on the historical test data.

[0021] Based on the key test features, all test cases applicable to the test environment information are selected from the test case set.

[0022] In one embodiment, the method further includes:

[0023] The optional test cases are sorted in descending order of their comprehensive evaluation values;

[0024] The optional test cases are recommended in sequence.

[0025] Secondly, embodiments of the present invention provide a test case recommendation device, comprising:

[0026] The parsing module is used to parse the requirement data of the test task and generate the test environment information of the test task;

[0027] The filtering module is used to filter out all test cases that are applicable to the test environment information from the test case set;

[0028] The processing module is used to calculate the comprehensive evaluation value of each test case based on the environment variables of each test case;

[0029] The processing module is also used to determine test cases with a comprehensive evaluation value greater than a preset threshold as optional test cases for the test task.

[0030] Thirdly, embodiments of the present invention provide an electronic chip, comprising:

[0031] At least one processor; and

[0032] At least one memory communicatively connected to the processor, wherein:

[0033] The memory stores program instructions, and the processor can execute the method provided in the first aspect by calling the program instructions.

[0034] Fourthly, embodiments of the present invention provide a computer-readable storage medium comprising a stored program, wherein the program, when executed by a processor, implements the method provided in the first aspect.

[0035] In this embodiment of the invention, the requirement data of the test task is parsed to generate test environment information for the test task. All test cases suitable for the test environment information are selected from the test case set. A comprehensive evaluation value for each test case is calculated based on its environment variables. Test cases with a comprehensive evaluation value greater than a preset threshold are identified as optional test cases for the test task. By calculating the comprehensive evaluation values ​​of different test cases, suitable test tasks can be recommended quickly and accurately, improving testing efficiency. Attached Figure Description

[0036] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0037] Figure 1 A flowchart of a test case recommendation method provided in an embodiment of the present invention;

[0038] Figure 2 A flowchart illustrating another test case recommendation method provided in an embodiment of the present invention;

[0039] Figure 3 A schematic diagram illustrating a test case recommendation method provided in an embodiment of the present invention;

[0040] Figure 4 This is a schematic diagram of the structure of a test case recommendation device provided in an embodiment of the present invention;

[0041] Figure 5 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. Detailed Implementation

[0042] To better understand the technical solutions in this specification, the embodiments of the present invention will be described in detail below with reference to the accompanying drawings.

[0043] It should be understood that the described embodiments are merely some, not all, of the embodiments in this specification. All other embodiments obtained by those skilled in the art based on the embodiments in this specification without inventive effort are within the scope of protection of this specification.

[0044] The terminology used in the embodiments of this invention is for the purpose of describing particular embodiments only and is not intended to be limiting of this specification. The singular forms “a,” “the,” and “the” as used in the embodiments of this invention and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise.

[0045] Currently, test case selection in software testing still relies heavily on testers' subjective experience, and is often influenced by objective factors such as the testers' business depth and level of involvement. How to extract test case priorities based on historical data, reduce the subjective dependence on test case selection, provide a reliable recommendation model, and reduce insufficient test case coverage has become one of the key issues in improving quality and testing efficiency.

[0046] To address the aforementioned issues, this invention provides a test case recommendation method. By calculating the comprehensive evaluation value of different test cases, it can quickly and accurately recommend suitable test tasks, thereby improving testing efficiency.

[0047] Figure 1 A flowchart illustrating a test case recommendation method provided in an embodiment of the present invention. This method can be applied to processing devices, such as… Figure 1 As shown, the method may include:

[0048] Step 101: Parse the requirement data of the test task and generate the test environment information of the test task.

[0049] In this embodiment of the invention, the requirement data for the test task may include data such as test objectives, test scope, and test methods. The processing device can parse the requirement data and generate corresponding test environment information.

[0050] Step 102: Filter out all test cases that are applicable to the test environment information from the test case set.

[0051] The test case set contains multiple test cases, and each test case contains multiple environment variables. The processing device can determine the test cases that match the current test environment information based on the historical test data of different test cases.

[0052] In one embodiment, historical test data for each test case is stored in a database. The processing device can collect historical test data for each test case from the database using Structured Query Language (SQL), then determine the key test features of the test cases based on the historical test data, match the key test features with the test environment information, and filter out all test cases suitable for the test environment information from the test case set.

[0053] Step 103: Calculate the comprehensive evaluation value of each test case based on the environment variables of each test case.

[0054] After the processing device obtains the historical test data of the test cases, it can determine the evaluation value of each environment variable in each test case. The sum of the evaluation values ​​of all environment variables contained in any test case is the comprehensive evaluation value of that test case.

[0055] In one embodiment, the processing device can generate a test matrix for test cases based on historical test data of the test cases. Each column of the test matrix corresponds to an environment variable of the test case. The value of any row in the test matrix is ​​the value of each environment variable when the test task was previously executed. Each row of values ​​corresponds to a test result. For each test matrix, the processing device can calculate the probability of different values ​​of each environment variable of the test case appearing under a specific test result based on a Bayesian network. For any environment variable, the processing device can determine the evaluation value of the current environment variable based on the probability value of different values ​​of the current environment variable appearing under a specific test result.

[0056] Step 104: Select test cases whose comprehensive evaluation value is greater than the preset threshold as optional test cases for the test task.

[0057] For all optional test cases, the processing device can sort them in descending order of comprehensive evaluation value and recommend optional test cases in that order.

[0058] In this embodiment of the invention, the processing device can quickly and accurately recommend suitable test tasks by calculating the comprehensive evaluation value of different test cases, thereby improving testing efficiency.

[0059] Figure 2 A flowchart illustrating another test case recommendation method provided in an embodiment of the present invention. (See attached flowchart.) Figure 2 As shown, the method may include:

[0060] Step 201: Filter test cases.

[0061] After obtaining the test environment information, the processing equipment filters out test cases that meet the conditions.

[0062] Step 202: Determine if the test case has corresponding historical test data.

[0063] When a test case has historical versions or execution information, the corresponding historical test data will be stored in the database. For each test case, if the corresponding historical test data is detected in the database, proceed to step 203; otherwise, proceed to step 205.

[0064] Step 203: Generate the test matrix and calculate the evaluation value for each environment variable.

[0065] The processing device generates a test matrix corresponding to the test cases based on historical test data, and calculates the evaluation values ​​of environmental variables based on the test matrix. Each row of the test matrix is ​​a sample, representing different values ​​of the environmental variable. When the values ​​of the environmental variable are different, the test results may be different.

[0066] Step 204: Calculate the overall evaluation value of the test cases.

[0067] The processing device sums the evaluation values ​​of each environmental variable to obtain the comprehensive evaluation value of the test case.

[0068] Step 205: Recommend test cases based on the comprehensive evaluation value.

[0069] The processing equipment recommends test cases in descending order of comprehensive evaluation values.

[0070] Step 206: Calculate the overall evaluation value on a per-test-case basis.

[0071] If historical test data is not saved in the database, the processing device directly calculates the comprehensive evaluation value on a per-test-case basis.

[0072] The following specific embodiments further illustrate the test case recommendation method of the present invention.

[0073] The test matrix for a test case can be as follows: Figure 3 As shown, X, Y, and Z are different environment variables. The test matrix can also contain other environment variables. Each row of the test matrix contains different historical test data. When the same environment variable takes different values, the test results may be different.

[0074] In this embodiment of the invention, the processing device uses Bayes' theorem to calculate the evaluation values ​​of environmental variables. This means the processing device can obtain the probability of different values ​​of environmental variables occurring under a specific test result. The processing device adds these probability values ​​to obtain the evaluation value of the environmental variable, and then adds the evaluation values ​​of all environmental variables to obtain the comprehensive evaluation value of the test case. When the testing task wants to select a specific test result, such as "pass," the higher the comprehensive evaluation value of the test case under "pass," the more suitable it is for execution.

[0075] Figure 4This is a schematic diagram of a test case recommendation device provided in an embodiment of the present invention. This device can be used as a specific equipment to implement the test case recommendation method provided in the embodiment of the present invention, such as… Figure 4 As shown, the device may include: a parsing module 410, a filtering module 420, and a processing module 430.

[0076] The parsing module 410 is used to parse the requirement data of the test task and generate the test environment information of the test task.

[0077] The filtering module 420 is used to filter out all test cases in the test case set that are applicable to the test environment information.

[0078] Processing module 430 is used to calculate the comprehensive evaluation value of each test case based on the environment variables of each test case.

[0079] The processing module 430 is also used to identify test cases whose comprehensive evaluation value is greater than a preset threshold as optional test cases for the test task.

[0080] Figure 5 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. Figure 5 The electronic device shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of the present invention.

[0081] like Figure 5 As shown, the electronic device is represented in the form of a general-purpose computing device. The components of the electronic device may include, but are not limited to: one or more processors 510, memory 530, and communication bus 540 connecting different system components (including memory 530 and processor 510).

[0082] The communication bus 540 represents one or more of several bus architectures, including a memory bus or memory controller, a peripheral bus, a graphics acceleration port, a processor, or a local bus using any of the various bus architectures. For example, these architectures include, but are not limited to, Industry Standard Architecture (ISA) buses, Micro Channel Architecture (MAC) buses, Enhanced ISA buses, Video Electronics Standards Association (VESA) local buses, and Peripheral Component Interconnect (PCI) buses.

[0083] Electronic devices typically include a variety of computer-readable media. These media can be any available media that can be accessed by the electronic device, including volatile and non-volatile media, and removable and non-removable media.

[0084] Memory 530 may include computer system readable media in the form of volatile memory, such as random access memory (RAM) and / or cache memory. The electronic device may further include other removable / non-removable, volatile / non-volatile computer system storage media. Although Figure 5 Not shown, a disk drive for reading and writing to a removable non-volatile disk (e.g., a "floppy disk") and an optical disc drive for reading and writing to a removable non-volatile optical disc (e.g., a compact disc read-only memory (CD-ROM), a digital video disc read-only memory (DVD-ROM), or other optical media). In these cases, each drive may be connected to the communication bus 540 via one or more data media interfaces. The memory 530 may include at least one program product having a set (e.g., at least one) of program modules configured to perform the functions of the embodiments of the present invention.

[0085] A program / utility having a set (at least one) of program modules can be stored in memory 530. Such program modules include—but are not limited to—an operating system, one or more application programs, other program modules, and program data. Each or some combination of these examples may include an implementation of a network environment. The program modules typically perform the functions and / or methods described in the embodiments of the present invention.

[0086] The electronic device can also communicate with one or more external devices, one or more devices that enable a user to interact with the electronic device, or any device that enables the electronic device to communicate with one or more other computing devices (e.g., network interface card, modem, etc.). This communication can be performed through the communication interface 520. Furthermore, the electronic device can also communicate through a network adapter (…). Figure 5 (Not shown) communicates with one or more networks (e.g., Local Area Network (LAN), Wide Area Network (WAN), and / or public networks, such as the Internet). The aforementioned network adapter can communicate with other modules of the electronic device via the communication bus 540. It should be understood that, although... Figure 5Not shown, other hardware and / or software modules can be used in conjunction with electronic devices, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, disk arrays (Redundant Arrays of Independent Drives; hereinafter referred to as RAID) systems, tape drives, and data backup storage systems.

[0087] The processor 510 executes various functional applications and data processing by running programs stored in the memory 530, such as implementing the test case recommendation method provided in the embodiments of the present invention.

[0088] This invention also provides a computer-readable storage medium storing computer instructions that cause the computer to execute the test case recommendation method provided in this invention.

[0089] The aforementioned computer-readable storage medium may be any combination of one or more computer-readable media. A computer-readable medium may be a computer-readable signal medium or a computer-readable storage medium. A computer-readable storage medium may be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of computer-readable storage media (a non-exhaustive list) include: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM), or flash memory, optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this document, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in connection with an instruction execution system, apparatus, or device.

[0090] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals may take various forms, including—but not limited to—electromagnetic signals, optical signals, or any suitable combination thereof. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, capable of transmitting, propagating, or transmitting programs for use by or in connection with an instruction execution system, apparatus, or device.

[0091] The program code contained on a computer-readable medium may be transmitted using any suitable medium, including—but not limited to—wireless, wire, optical fiber, RF, etc., or any suitable combination thereof.

[0092] In the description of this specification, the references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of the present invention. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples. Moreover, without contradiction, those skilled in the art can combine and integrate the different embodiments or examples described in this specification, as well as the features of different embodiments or examples.

[0093] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of that feature. In the description of this invention, "a plurality of" means at least two, such as two, three, etc., unless otherwise explicitly specified.

[0094] Any process or method description in the flowchart or otherwise herein can be understood as representing a module, segment, or portion of code comprising one or more executable instructions for implementing custom logic functions or processes, and the scope of preferred embodiments of the invention includes additional implementations in which functions may be performed not in the order shown or discussed, including substantially simultaneously or in reverse order depending on the functions involved, as should be understood by those skilled in the art to which embodiments of the invention pertain.

[0095] In the embodiments provided by this invention, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between devices or units may be electrical, mechanical, or other forms.

[0096] Furthermore, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or in the form of hardware plus software functional units.

[0097] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.

Claims

1. A test case recommendation method, characterized in that, include: Parse the requirement data of the test task and generate the test environment information of the test task; Filter out all test cases that are applicable to the test environment information from the test case set; The comprehensive evaluation value of each test case is calculated based on the environment variables of each test case; Test cases whose comprehensive evaluation value is greater than a preset threshold are identified as optional test cases for the test task; The calculation of the comprehensive evaluation value of each test case based on the environment variables of each test case includes: For any test case, retrieve the historical test data for the current test case; The evaluation value of each environment variable for the current test case is determined based on the historical test data. The comprehensive evaluation value of the current test case is obtained by summing the evaluation values ​​of all environment variables included in the current test case. The step of determining the evaluation value of each environment variable for the current test case based on the historical test data includes: A test matrix for the current test case is generated based on the historical test data of the current test case. Each column of the test matrix corresponds to an environment variable, and the value of any row of the test matrix is ​​the value of each environment variable when the current test case was executed previously. Calculate the probability of different values ​​of each environment variable in the current test case occurring under a specific test result based on a Bayesian network; For any environmental variable, the evaluation value of the current environmental variable is determined based on the probability of different values ​​of the current environmental variable appearing under a specific test result.

2. The method according to claim 1, characterized in that, The step of filtering out all test cases applicable to the test environment information from the test case set includes: Historical test data for each test case is collected from the database using Structured Query Language (SQL). The key test characteristics of the test cases are determined based on the historical test data. Based on the key test features, all test cases applicable to the test environment information are selected from the test case set.

3. The method according to claim 1, characterized in that, The method further includes: The optional test cases are sorted in descending order of their comprehensive evaluation values; The optional test cases are recommended in sequence.

4. A test case recommendation device, characterized in that, include: The parsing module is used to parse the requirement data of the test task and generate the test environment information of the test task; The filtering module is used to filter out all test cases that are applicable to the test environment information from the test case set; The processing module is used to calculate the comprehensive evaluation value of each test case based on the environment variables of each test case; The processing module is also used to determine test cases with a comprehensive evaluation value greater than a preset threshold as optional test cases for the test task; The processing module is used to obtain historical test data for any test case. The evaluation value of each environment variable for the current test case is determined based on the historical test data. The comprehensive evaluation value of the current test case is obtained by summing the evaluation values ​​of all environment variables included in the current test case. A test matrix for the current test case is generated based on the historical test data of the current test case. Each column of the test matrix corresponds to an environment variable, and the value of any row of the test matrix is ​​the value of each environment variable when the current test case was executed previously. Calculate the probability of different values ​​of each environment variable in the current test case occurring under a specific test result based on a Bayesian network; For any environmental variable, the evaluation value of the current environmental variable is determined based on the probability of different values ​​of the current environmental variable appearing under a specific test result.

5. An electronic device, characterized in that, include: At least one processor; as well as At least one memory communicatively connected to the processor, wherein: The memory stores program instructions, and the processor invokes the program instructions to execute the method as described in any one of claims 1 to 3.

6. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes a stored program, wherein the program, when executed by a processor, implements the method as described in any one of claims 1 to 3.

Citation Information

Patent Citations

  • Method for Testing and Testing Device

    US20210182707A1