Test case generation method and related equipment

By automating the processing of mind map information to generate a population of test cases, the problem of low efficiency in manual writing of test cases in existing technologies is solved, and efficient and comprehensive test case generation is achieved, which is suitable for frequent iteration scenarios.

CN120929388AActive Publication Date: 2025-11-11DALIAN TONGFANG SOFTBANK TECHNOLOGY CO LTD

Patent Information

Application Number
CN202511463609.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-10-14
Publication Date
2025-11-11
Estimated Expiration
2045-10-14

AI Technical Summary

Technical Problem

The existing test case generation process relies on manual writing, which is inefficient, has uneven coverage, and is not well-suited for scenarios with frequent iterations.

Method used

By acquiring mind map parameters based on the target command line, reading and processing mind map information to generate tree-structured data, extracting entity, relationship and event information, using intelligent agents to generate a population of test cases, and automatically generating test cases through iterative evolution and similarity judgment.

Benefits of technology

It enables efficient and comprehensive test case generation without human intervention, improving the applicability to frequent iteration scenarios and the accuracy of test results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120929388A_ABST
    Figure CN120929388A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a test case generation method and related equipment, and relates to the technical field of automatic testing, the method comprises the following steps: obtaining related parameters of a target brain map based on a target command line; according to the related parameters, reading the target brain map to determine target information; generating a target test case population according to the target information; wherein the target information comprises entity information, relation information and / or event information. In this way, the test case population can be automatically generated without manual participation, and the generation efficiency, the coverage rate and the applicability to frequent iteration scenes of the test case population are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of this application relate to the field of automated testing technology, and in particular to a test case generation method and related equipment. Background Technology

[0002] In software testing, a test case is a set of execution conditions, input data, operation steps, and expected results designed for a specific test objective. As the complexity of software systems continues to increase, the design and generation of test cases have gradually become a key aspect of ensuring system quality.

[0003] Currently, most existing test case generation processes rely on manual coding, which suffers from problems such as low efficiency, uneven coverage, and poor applicability to frequent iteration scenarios. Summary of the Invention

[0004] According to embodiments of this application, a test case generation method and related equipment are provided, which can automatically generate a test case population without human intervention, thereby improving the generation efficiency, coverage, and applicability of the test case population to frequent iteration scenarios.

[0005] In a first aspect of this application, a test case generation method is proposed, applicable to intelligent agents, comprising: Based on the target command line, obtain the relevant parameters of the target mind map; Based on relevant parameters, read the target mind map to determine the target information; Based on the target information, generate a population of target test cases; The target information includes: entity information, relationship information, and / or event information.

[0006] In some feasible implementations, the above-mentioned reading of the target mind map based on relevant parameters to determine target information includes: Read the target mind map and generate the first tree-structured data; Perform preprocessing operations on the first tree-structured data to generate the second tree-structured data; Based on the second tree-structured data, target information is extracted.

[0007] In some feasible implementations, the above-mentioned generation of a target test case population based on target information includes: Based on the target information, generate an initial test case population; Based on the initial test case population, select the target parent test case individual; Target operations are performed on multiple target parent test cases to iteratively evolve and generate a population of target generation test cases.

[0008] In some feasible implementations, the above selection of target parent test case individuals based on the initial test case population includes: If the target fitness of the initial test case individual is greater than the preset fitness threshold, the initial test case individual is determined to correspond to the target parent test case individual. Among them, target fitness is determined based on target coverage, target risk coefficient, target path depth, and / or the historical frequency of target occurrence.

[0009] In some feasible implementations, the above-described target operations are performed on multiple individual target parent test cases to iteratively evolve and generate a population of target generation test cases, including: Exchange the target information corresponding to multiple target parent test case individuals to generate target child test case individuals; Randomly modify the target information corresponding to individual target child test cases to generate a population of target child test cases.

[0010] In some feasible implementations, the above method further includes: If the difference between the population diversity corresponding to the first target generation test case population and the population diversity corresponding to the second target generation test case population is less than or equal to a preset difference threshold, the iterative evolution stops. Population diversity is determined using the following formula: ; in, Used to represent population diversity; Used to indicate population size; Used to indicate the first Individual target child test cases; Used to indicate the first Individual target child test cases; , The index value used to represent an individual test case of the target child generation; Used to represent individual test cases of the target child generation. individual test cases for the target offspring Similarity; Among them, individual target child test cases individual test cases for the target offspring similarity Determined according to the following formula: ; in, Used to represent the individual test cases that execute the target child generation test cases. The set of elements covered; Used to represent the individual test cases that execute the target child generation test cases. The set of elements covered.

[0011] In some feasible implementations, the above method further includes: In determining the individual target child test cases and target child test case individuals If the similarity between test cases exceeds a preset similarity threshold, merge individual test cases of the target child generation. and target child test case individuals .

[0012] In some feasible implementations, the above method further includes: If it is determined that there is missing boundary value information, the first boundary value and the second boundary value are determined based on the entity information; Based on the first boundary value, the second boundary value, and / or the target partitioning granularity, determine the target boundary value set to supplement the boundary value information.

[0013] In some feasible implementations, the above method further includes: Based on the target test case population, generate target data frames to export target format files.

[0014] A second aspect of this application proposes a test case generation system applicable to the above-mentioned method, including: The acquisition module is used to obtain relevant parameters of the target mind map based on the target command line. The determination module is used to read the target mind map based on relevant parameters to determine the target information; The generation module is used to generate a population of target test cases based on the target information. The target information includes: entity information, relationship information, and / or event information.

[0015] The test case generation method and related equipment provided in this application include: obtaining relevant parameters of a target mind map based on a target command line; reading the target mind map to determine target information based on the relevant parameters; and generating a target test case population based on the target information. The target information includes entity information, relationship information, and / or event information. In this way, a test case population can be automatically generated without manual intervention, improving the generation efficiency, coverage, and applicability to frequent iteration scenarios.

[0016] It should be understood that the description in the Summary Section is not intended to limit the key or essential features of the embodiments of this application, nor is it intended to restrict the scope of this application. Other features of this application will become readily apparent from the following description. Attached Figure Description

[0017] The above and other features, advantages, and aspects of the embodiments of this application will become more apparent from the accompanying drawings and the following detailed description. In the drawings, the same or similar reference numerals denote the same or similar elements, wherein: Figure 1 A flowchart illustrating a test case generation method provided in an embodiment of this application; Figure 2 A structural schematic diagram of a test case generation system provided in an embodiment of this application; Figure 3 This is a structural schematic diagram of an electronic device provided in an embodiment of this application. Detailed Implementation

[0018] To make the objectives, technical solutions, and advantages of the embodiments of this disclosure clearer, the technical solutions of the embodiments of this disclosure will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this disclosure, and not all embodiments. Based on the embodiments of this disclosure, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this disclosure.

[0019] Furthermore, the term "and / or" in this article is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, or B existing alone. Additionally, the character " / " in this article generally indicates that the preceding and following related objects have an "or" relationship.

[0020] In a first aspect, this application proposes a test case generation method applicable to intelligent agents. Figure 1 This is a flowchart illustrating a test case generation method 100 provided in an embodiment of this application, as shown below. Figure 1 As shown, method 100 includes: Step S1: Obtain relevant parameters of the target mind map based on the target command line.

[0021] For example, the target command line mentioned above can be automatically generated by the agent based on the test scenario and / or the historical dialogue content with the user; or it can be set by the user. The historical dialogue content mentioned above may include test requirements, etc.

[0022] For example, the target mind map described above is used to determine test function points, business processes, data relationships, and / or constraints, etc., wherein the target mind map may include: XMind format mind map, and / or, mindmup format mind map.

[0023] For example, the aforementioned related parameters may include: path parameters, and / or, business type parameters, etc.

[0024] For example, it can automatically construct target command lines based on the test scenario and / or the historical dialogue content between the agent and the user regarding test requirements, and / or automatically obtain the path parameters of the target mind map based on the target command line entered by the user, and / or business type parameters, etc.

[0025] Step S2: Based on the relevant parameters, read the target mind map to determine the target information.

[0026] For example, based on the aforementioned path parameters and / or business type parameters, the aforementioned XMind format mind map and / or MindMup format mind map can be read to determine entity information, relationship information, and / or event information. The aforementioned entity information may include: test function point information, system component information, data object information, and / or constraint information, etc. The aforementioned relationship information may include: test business process guidance information, component dependency relationship information, and / or data relationship information, etc. The aforementioned event information may include: operation event information, system triggered event information, state change event information, etc.

[0027] In some feasible implementations, step S2 above; reading the target mind map to determine target information based on relevant parameters, includes: Step S21: Read the target mind map and generate the first tree-structured data.

[0028] For example, a mind map in XMind format and / or MindMup format can be read to generate a first tree-structured data. This first tree-structured data may include structured JSON data.

[0029] Step S22: Perform preprocessing operations on the first tree-structured data to generate the second tree-structured data.

[0030] For example, structural cleaning, hierarchical optimization, attribute standardization, and / or relationship strengthening operations can be performed on the first tree-structured data to generate the second tree-structured data.

[0031] For example, a structure cleaning operation can be performed on the first tree-structured data to remove empty nodes, invalid nodes, and / or duplicate nodes.

[0032] For example, a hierarchical optimization operation can be performed on the first tree-structured data to adjust the node hierarchy in the second tree-structured data, and / or optimize the tree structure representation in the second tree-structured data.

[0033] For example, attribute standardization operations can be performed on the first tree-structured data to unify the naming rules and data format of node attributes in the second tree-structured data.

[0034] For example, relationship enhancement operations can be performed on the first tree-structured data to improve the description of the relationships between nodes in the second tree-structured data.

[0035] Step S23: Extract target information based on the second tree-structured data.

[0036] For example, the entity information, relationship information, and / or event information can be extracted based on the second tree-structured data generated in step S22.

[0037] Therefore, through the above steps S21~S23, the target mind map can be converted into tree-structured data, thereby accurately preserving the hierarchical relationships and effective information in the target mind map; by performing preprocessing operations on the data, the standardization and consistency of the data can be improved, redundancy or noise interference can be reduced, thereby improving the accuracy and efficiency of target information extraction.

[0038] Step S3: Generate a population of target test cases based on the target information.

[0039] For example, a target test case population can be generated based on the aforementioned entity information, relationship information, and / or event information.

[0040] In some feasible implementations, step S3 above; generating a target test case population based on the target information, includes: Step S31: Generate an initial test case population based on the target information.

[0041] For example, an initial test case population can be generated based on the aforementioned entity information, relationship information, and / or event information.

[0042] Step S32: Based on the initial test case population, select the target parent test case individual.

[0043] For example, the target parent test case individual can be selected based on the fitness of each initial test case individual in the initial test case population.

[0044] In some feasible implementations, step S32 above; selecting target parent test case individuals based on the initial test case population, includes: Step S321: If the target fitness corresponding to the initial test case individual is greater than the preset fitness threshold, determine that the initial test case individual corresponds to the target parent test case individual; wherein, the target fitness is determined based on the target coverage, target risk coefficient, target path depth, and / or the target historical occurrence frequency.

[0045] For example, the target coverage can be determined based on the code branches, statements, and / or requirement points that the initial test case can cover. The target risk coefficient can be determined based on the risk level corresponding to the function being tested by the initial test case. The target path depth can be determined based on the step length of the initial test case and / or the depth of the covered business process. The target historical occurrence frequency can be determined based on the number of times the initial test case has appeared in historical test scenarios.

[0046] For example, the target fitness corresponding to the above initial test case individual can be determined based on the target coverage and the corresponding first weight, the target risk coefficient and the corresponding second weight, the target path depth and the corresponding third weight, and / or the target historical occurrence frequency and the corresponding fourth weight.

[0047] Specifically, the above-mentioned target fitness can be determined according to the following formula: ; in, Used to represent the fitness of a target; Used to indicate target coverage; Used to represent the target risk coefficient; Used to indicate the depth of the target path; Used to represent the reciprocal of the historical frequency of a target; Used to represent the first weight; Used to represent the second weight; Used to represent the third weight; Used to represent the fourth weight.

[0048] It should be noted that the above first weight The aforementioned second weight The aforementioned third weight ; and the aforementioned fourth weight The value can be automatically determined by the agent based on the test scenario and / or the historical dialogue content with the user, or it can be set by the user.

[0049] The aforementioned preset fitness threshold is positively correlated with the selection accuracy requirement of the target parent test case individual corresponding to the test scenario, and / or the test accuracy requirement. That is, the higher the selection accuracy requirement of the target parent test case individual, and / or the test accuracy requirement, the larger the aforementioned preset fitness threshold.

[0050] Therefore, the above method can comprehensively and accurately determine the target fitness of the initial test case individuals based on multi-dimensional indicators such as target coverage, target risk coefficient, target path depth, and / or target historical occurrence frequency. Based on the comparison results between the target fitness and the preset fitness threshold, it can accurately select the initial test case individuals with high coverage, risk control, business process coverage depth, and low historical occurrence frequency as the target parent test case individuals, thereby improving the generation accuracy and generation quality of the target generation test case population.

[0051] Step S33: Perform target operations on multiple target parent test case individuals to iteratively evolve and generate a target generation test case population.

[0052] For example, crossover and / or mutation operations can be performed on multiple target parent test case individuals to iteratively evolve and generate a target generation test case population.

[0053] In some feasible implementations, step S33 above; performing target operations on multiple target parent test case individuals to iteratively evolve and generate a target generation test case population, including: Step S331: Exchange the target information corresponding to multiple target parent test case individuals to generate target child test case individuals.

[0054] For example, entity information, relationship information, and / or event information corresponding to multiple target parent test case individuals can be exchanged to generate target child test case individuals.

[0055] For example, it can exchange test function point information, system component information, data object information, and / or constraint information, etc., corresponding to multiple target parent test case individuals; test business process pointing information, component dependency information, and / or data relationship information, etc.; operation event information, system trigger event information, state change event information, etc., to generate target child test case individuals.

[0056] Step S332: Randomly modify the target information corresponding to the individual target child test cases to generate a population of target child test cases.

[0057] For example, the entity information, relationship information, and / or event information corresponding to the target child test case individual can be randomly modified to generate the target child test case individual.

[0058] For example, the test function point information, system component information, data object information, and / or constraint information corresponding to the individual target child test cases can be randomly modified; test business process pointing information, component dependency information, and / or data relationship information; operation event information, system trigger event information, state change event information, etc., to generate a population of target child test cases.

[0059] Therefore, by exchanging the target information of different target parent test case individuals, the above method can integrate the superior features of multiple target parent test case individuals into the target child test case individuals, thereby improving the overall performance of the newly generated target child test case individuals in terms of coverage, risk control capability, business process coverage depth, and historical repetition rate control. By randomly modifying the target information of the target child test case individuals, new structures and features can be introduced into the target generation test case population, thereby increasing the diversity of the target generation test case population and avoiding the test case evolution process from getting stuck in local optima. Furthermore, through the synergistic effect of crossover and mutation operations, the target generation test case population can inherit superior genes while maintaining exploratory capabilities, enabling continuous iterative optimization and improving the overall quality of the generated target generation test case population in terms of coverage, reliability, and effectiveness, thereby enhancing the comprehensiveness of the testing process and the accuracy of the test results.

[0060] Based on this, the test case generation method provided in this application includes: obtaining relevant parameters of a target mind map based on a target command line; reading the target mind map to determine target information based on the relevant parameters; and generating a target test case population based on the target information; wherein the target information includes entity information, relationship information, and / or event information. In this way, a test case population can be automatically generated without manual intervention, improving the generation efficiency, coverage, and applicability to frequent iteration scenarios.

[0061] In some feasible implementations, the above method further includes: If the difference between the population diversity corresponding to the first target generation test case population and the population diversity corresponding to the second target generation test case population is less than or equal to a preset difference threshold, the iterative evolution stops. Population diversity is determined using the following formula: ; in, Used to represent population diversity; Used to indicate population size; Used to indicate the first Individual target child test cases; Used to indicate the first Individual target child test cases; , The index value used to represent an individual test case of the target child generation; Used to represent individual test cases of the target child generation. individual test cases for the target offspring The similarity.

[0062] It should be noted that the above-mentioned population diversity The value of is greater than or equal to 0 and less than or equal to 1. The above population size That is, the total number of individual target child test cases contained in the target generation test case population.

[0063] Among them, individual target child test cases individual test cases for the target offspring similarity Determined according to the following formula: ; in, Used to represent the individual test cases that execute the target child generation test cases. The set of elements covered; Used to represent the individual test cases that execute the target child generation test cases. The set of elements covered.

[0064] It should be noted that the above target child test cases are individual individual test cases for the target offspring similarity The value range is greater than or equal to 0 and less than or equal to 1. The above set of elements can include: a set of nodes, a set of branches, and / or a set of statements, etc.

[0065] For example, if the difference between the population diversity corresponding to the first target generation test case population and the population diversity corresponding to the second target generation test case population, determined according to formulas (2) to (3) above, is less than or equal to a preset difference threshold, the iterative evolution stops. The preset difference threshold can be determined based on the generation accuracy requirement of the target test case population and / or the test efficiency requirement. The preset difference threshold is negatively correlated with the generation accuracy requirement of the target test case population corresponding to the test scenario and / or positively correlated with the test efficiency requirement. That is, the higher the generation accuracy requirement of the target test case population, the smaller the preset difference threshold; and / or, the higher the test efficiency requirement, the larger the preset difference threshold.

[0066] Therefore, by using the above formulas (2) to (3), the population diversity corresponding to the first target generation test case population and the difference between the population diversity corresponding to the second target generation test case population can be accurately quantified. Based on the comparison results of the above differences with the preset difference threshold, it is automatically determined whether to continue the iterative evolution operation to avoid invalid iteration, thereby improving the generation efficiency of the target generation test case population. By quantifying the similarity between individual target child generation test cases, the diversity of the target generation test case population can be improved, thereby improving the coverage of the test process and the quality of the test results to meet the requirements of high precision and high efficiency test scenarios.

[0067] In some feasible implementations, the above method further includes: In determining the individual target child test cases and target child test case individuals If the similarity between test cases exceeds a preset similarity threshold, merge individual test cases of the target child generation. and target child test case individuals .

[0068] For example, when determining any target child test case individual according to the above formula (3), and target child test case individuals If the similarity between the test cases is greater than a preset similarity threshold, determine the individual target child test cases. individual test cases for the target offspring For individual test cases of the target child generation of the equivalence class, the individual test cases of the target child generation are... and target child test case individuals Perform a merge operation. The aforementioned preset similarity threshold is positively correlated with the generation accuracy requirement of the target test case population corresponding to the test scenario, and / or negatively correlated with the test efficiency requirement. That is, the higher the generation accuracy requirement of the target test case population, the higher the aforementioned preset similarity threshold, and / or the higher the test efficiency requirement, the lower the aforementioned preset similarity threshold.

[0069] Therefore, the above method can be used to determine the individual test cases of the target offspring generation. and target child test case individuals If the similarity between test cases exceeds a preset similarity threshold, a precise merging operation is performed to reduce redundant target child test cases in the target test case population, thereby further improving the generation accuracy of the target test case population.

[0070] In some feasible implementations, the above method further includes: If it is determined that there is missing boundary value information, the first boundary value and the second boundary value are determined based on the entity information; Based on the first boundary value, the second boundary value, and / or the target partitioning granularity, determine the target boundary value set to supplement the boundary value information.

[0071] For example, when it is determined that boundary value information is missing, a first boundary value (i.e., a larger boundary value) and a second boundary value (i.e., a smaller boundary value) can be determined based on the entity information. Based on the first boundary value (i.e., the larger boundary value), the second boundary value (i.e., the smaller boundary value), and / or the target partitioning granularity, a target boundary value set is determined to supplement the boundary value information. The target partitioning granularity can be determined based on the generation accuracy requirements of the target test case population corresponding to the test scenario, and / or the test efficiency requirements. The target partitioning granularity is negatively correlated with the generation accuracy requirements of the target test case population, and / or positively correlated with the test efficiency requirements; that is, the higher the generation accuracy requirements of the target test case population, the smaller the target partitioning granularity, and / or the higher the test efficiency requirements, the larger the target partitioning granularity.

[0072] Therefore, the above method can automatically detect and supplement missing boundary value information to ensure that the target test case population covers key boundary conditions, thereby further improving the coverage of the testing process and the quality of test results, and meeting the requirements of high-precision and high-efficiency testing scenarios.

[0073] In some feasible implementations, the above method further includes: Based on the target test case population, generate target data frames to export target format files.

[0074] For example, a target data frame can be generated using pandas based on the target test case population described above to export a target format file. The target format file may include: an Excel file, a CSV file, and / or an XML file, etc.

[0075] Specifically, format optimization, title style adjustment, column width and line wrapping adjustment, and / or priority color encoding can be performed on the target data frame to export the Excel file.

[0076] Therefore, by generating target data frames based on the target test case population and exporting target format files, it is possible to achieve structured management, standardized storage, and visual presentation of the target test case population data, thereby improving the efficiency and usability of test data processing.

[0077] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that this application is not limited to the described order of actions, as some steps may be performed in other orders or simultaneously according to this application. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are all optional embodiments, and the actions and modules involved are not necessarily essential to this application.

[0078] The above is an introduction to the method embodiments. The following system embodiments will further illustrate the solution described in this application.

[0079] A second aspect of this application provides a test case generation system applicable to the method described above. Figure 2 This is a structural schematic diagram of a test case generation system 200 provided in an embodiment of this application. For example... Figure 2 The test case generation system 200 shown includes: an acquisition module 210, a determination module 220, and a generation unit 230.

[0080] The acquisition module 210 is used to acquire relevant parameters of the target mind map based on the target command line; The determination module 220 is used to read the target mind map based on relevant parameters to determine the target information; The generation module 230 is used to generate a population of target test cases based on the target information. The target information includes: entity information, relationship information, and / or event information.

[0081] Figure 3 This is a schematic diagram of the structure of an electronic device 300 provided in an embodiment of this application. Figure 3 As shown, the electronic device 300 includes a central processing unit (CPU) 301, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 302 or a program loaded from a storage section 308 into a random access memory (RAM) 303. The RAM 303 also stores various programs and data required for the operation of the terminal device or server. The CPU 301, ROM 302, and RAM 303 are interconnected via a bus 304. An input / output (I / O) interface 305 is also connected to the bus 304.

[0082] The following components are connected to I / O interface 305: an input section 306 including a keyboard, mouse, etc.; an output section 307 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and speakers, etc.; a storage section 308 including a hard disk, etc.; and a communication section 309 including a network interface card such as a LAN card, modem, etc. The communication section 309 performs communication processing via a network such as the Internet. A drive 310 is also connected to I / O interface 305 as needed. A removable medium 311, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed on drive 310 as needed so that computer programs read from it can be installed into storage section 308 as needed.

[0083] Specifically, according to embodiments of this application, the above method flow steps can be implemented as a computer software program. For example, embodiments of this application include a computer program product comprising a computer program carried on a machine-readable medium, the computer program containing program code for performing the methods shown in the flowchart. In such embodiments, the computer program can be downloaded and installed from a network via communication section 309, and / or installed from removable medium 311. When the computer program is executed by central processing unit (CPU) 301, it performs the functions defined in the system of this application.

[0084] It should be noted that the computer-readable medium described in this application can be a computer-readable signal medium or a computer-readable storage medium, or any combination of the two. A computer-readable storage medium can 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 a computer-readable storage medium may include, but are not limited to: 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 application, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In this application, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. Computer-readable signal media can also be any computer-readable medium other than computer-readable storage media, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wireless, wire, optical fiber, RF, etc., or any suitable combination thereof.

[0085] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0086] The units or modules described in the embodiments of this application can be implemented in software or hardware. The described units or modules can also be located in a processor. The names of these units or modules do not, in certain circumstances, constitute a limitation on the unit or module itself.

[0087] The above description is merely a preferred embodiment of this application and an explanation of the technical principles employed. Those skilled in the art should understand that the scope of this application is not limited to technical solutions formed by specific combinations of the above-described technical features, but should also cover other technical solutions formed by arbitrary combinations of the above-described technical features or their equivalents without departing from the foregoing application concept. For example, technical solutions formed by substituting the above features with (but not limited to) technical features with similar functions claimed in this application.

Claims

1. A test case generation method, characterized in that, Applicable to intelligent agents, including: Based on the target command line, obtain the relevant parameters of the target mind map; Based on the relevant parameters, the target mind map is read to determine the target information; Based on the target information, a target test case population is generated; The target information includes: entity information, relationship information, and / or event information; The step of reading the target mind map based on the relevant parameters to determine the target information includes: Read the target mind map and generate the first tree-structured data; Perform preprocessing operations on the first tree-structured data to generate the second tree-structured data; Based on the second tree-structured data, the target information is extracted; The step of generating a target test case population based on the target information includes: Based on the target information, an initial test case population is generated; Based on the initial test case population, select the target parent test case individual; The target operation is performed on multiple target parent test case individuals to iteratively evolve and generate a target generation test case population.

2. The method according to claim 1, characterized in that, The selection of target parent test case individuals based on the initial test case population includes: If the target fitness of the initial test case individual is greater than the preset fitness threshold, it is determined that the initial test case individual corresponds to the target parent test case individual; The target fitness is determined based on target coverage, target risk coefficient, target path depth, and / or the historical frequency of target occurrence.

3. The method according to claim 2, characterized in that, Perform target operations on multiple individual target parent test cases to iteratively evolve and generate a population of target generation test cases, including: Exchange the target information corresponding to multiple target parent test case individuals to generate target child test case individuals; The target information corresponding to the individual target child test cases is randomly modified to generate the target child test case population.

4. The method according to claim 3, characterized in that, Also includes: If the difference between the population diversity corresponding to the first target generation test case population and the population diversity corresponding to the second target generation test case population is less than or equal to a preset difference threshold, the iterative evolution is stopped. The population diversity is determined according to the following formula: ; in, Used to represent population diversity; Used to indicate population size; Used to indicate the first Individual target child test cases; Used to indicate the first Individual target child test cases; , The index value used to represent an individual test case of the target child generation; Used to represent individual test cases of the target child generation. individual test cases for the target offspring Similarity; Among them, individual target child test cases individual test cases for the target offspring similarity Determined according to the following formula: ; in, Used to represent the individual test cases that execute the target child generation test cases. The set of elements covered; Used to represent the individual test cases that execute the target child generation test cases. The set of elements covered.

5. The method according to claim 4, characterized in that, Also includes: In determining the individual target child test cases and the target child test case individual If the similarity between the individual target child test cases is greater than a preset similarity threshold, the individual target child test cases will be merged. and the target child test case individual .

6. The method according to any one of claims 1 to 5, characterized in that, Also includes: If it is determined that boundary value information is missing, the first boundary value and the second boundary value are determined based on the entity information; Based on the first boundary value, the second boundary value, and / or the target partitioning granularity, a target boundary value set is determined to supplement the boundary value information.

7. The method according to claim 6, characterized in that, Also includes: Based on the target test case population, generate target data frames to export target format files.

8. A test case generation system, applicable to the method of claim 1, characterized in that, include: The acquisition module is used to obtain relevant parameters of the target mind map based on the target command line. The determination module is used to read the target mind map based on the relevant parameters to determine the target information; The generation module is used to generate a population of target test cases based on the target information. The target information includes: entity information, relationship information, and / or event information; The step of reading the target mind map based on the relevant parameters to determine the target information includes: Read the target mind map and generate the first tree-structured data; Perform preprocessing operations on the first tree-structured data to generate the second tree-structured data; Based on the second tree-structured data, the target information is extracted; The step of generating a target test case population based on the target information includes: Based on the target information, an initial test case population is generated; Based on the initial test case population, select the target parent test case individual; The target operation is performed on multiple target parent test case individuals to iteratively evolve and generate a target generation test case population.

Citation Information

Patent Citations

  • Test case management method and device

    CN115422066A

  • Test case sorting method and device, equipment and storage medium

    CN115629987A

  • Test case generation method and target test case generation model training method

    CN117707929A

  • Test case generation method and device, computer equipment, computer readable storage medium and computer program product

    CN119357068A

  • Test case automatic generation method and device, electronic equipment and storage medium

    CN120743780A

Cited By

  • Software testing method and system

    CN121144212A