Test case generation method and related device

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

CN120929388BActive Publication Date: 2025-12-05DALIAN TONGFANG SOFTBANK TECHNOLOGY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

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

Smart Images

  • Figure CN120929388B_ABST
    Figure CN120929388B_ABST
Patent Text Reader

Abstract

Embodiments of the present application provide a test case generation method and related equipment, which relate to the field of automatic testing technology, and the method comprises: obtaining related parameters of a target mind map based on a target command line; reading the target mind map to determine target information according to the related parameters; and generating a target test case population according to the target information; wherein the target information comprises entity information, relationship information, and / or event information. In this way, the test case population can be automatically generated without human intervention, thereby improving the generation efficiency, coverage rate and applicability to frequent iteration scenarios of the test case population.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] Embodiments of the present application relate to the field of automated testing, and in particular, to a test case generation method and related device. BACKGROUND

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

[0003] Currently, most existing test case generation processes rely on manual writing by humans, which has problems such as low efficiency, uneven coverage, and poor applicability to frequent iteration scenarios. SUMMARY

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

[0005] In a first aspect of the present application, a test case generation method is provided, which is applicable to an agent, and includes:

[0006] Based on a target command line, obtaining related parameters of a target mind map;

[0007] According to the related parameters, reading the target mind map to determine target information;

[0008] According to the target information, generating a target test case population;

[0009] Wherein, the target information includes entity information, relationship information, and / or event information.

[0010] In some possible implementations, the above reading the target mind map to determine the target information according to the related parameters includes:

[0011] Reading the target mind map to generate first tree structured data;

[0012] Performing a preprocessing operation on the first tree structured data to generate second tree structured data;

[0013] Extracting the target information based on the second tree structured data.

[0014] In some possible implementations, the above generating a target test case population according to the target information includes:

[0015] Generating an initial test case population according to the target information;

[0016] select target parent test case individuals based on the initial test case population;

[0017] perform target operations on the target parent test case individuals to iteratively evolve and generate a target generation test case population.

[0018] In some possible implementations, the selecting the target parent test case individuals based on the initial test case population includes:

[0019] determining that the initial test case individual corresponds to a target parent test case individual when a target fitness of the initial test case individual is greater than a preset fitness threshold.

[0020] The target fitness is determined based on a target coverage rate, a target risk coefficient, a target path depth, and / or a target historical occurrence frequency.

[0021] In some possible implementations, the performing the target operations on the target parent test case individuals to iteratively evolve and generate the target generation test case population includes:

[0022] swapping target information corresponding to the target parent test case individuals to generate target offspring test case individuals;

[0023] randomly modifying the target information corresponding to the target offspring test case individuals to generate the target generation test case population.

[0024] In some possible implementations, the method further includes:

[0025] stopping the iteratively evolving when a difference between a population diversity corresponding to the first target generation test case population and a population diversity corresponding to the second target generation test case population is less than or equal to a preset difference threshold.

[0026] The population diversity is determined according to the following formula:

[0027] ;

[0028] wherein, is used to represent the population diversity; is used to represent a population size; is used to represent an i-th target offspring test case individual; is used to represent an i-th target offspring test case individual; is used to represent an i-th target offspring test case individual; is used to represent an i-th target offspring test case individual; , is used to represent an index value of the target offspring test case individual; is used to represent a target offspring test case individual is used to represent a target offspring test case individual Similarity;

[0029] Among them, individual test cases of the target child generation individual test cases for the target offspring similarity Determined according to the following formula:

[0030] ;

[0031] 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.

[0032] In some feasible implementations, the above method further includes:

[0033] 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 .

[0034] In some feasible implementations, the above method further includes:

[0035] 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;

[0036] 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.

[0037] In some feasible implementations, the above method further includes:

[0038] Based on the target test case population, generate target data frames to export target format files.

[0039] A second aspect of this application proposes a test case generation system applicable to the above-mentioned method, including:

[0040] The acquisition module is used to obtain relevant parameters of the target mind map based on the target command line.

[0041] The determination module is used to read the target mind map based on relevant parameters to determine the target information;

[0042] The generation module is used to generate a population of target test cases based on the target information.

[0043] The target information includes entity information, relationship information, and / or event information.

[0044] The test case generation method and related device provided by the embodiments of the present application, the method includes: obtaining related parameters of a target brain map based on a target command line; reading the target brain map to determine target information according to the related parameters; and generating a target test case population according to the target information; wherein the target information includes entity information, relationship information, and / or event information. In this way, the test case population can be automatically generated without human intervention, thereby improving the generation efficiency, coverage rate, and applicability to frequent iteration scenarios of the test case population.

[0045] It should be understood that the content described in the summary section is not intended to limit the key or important features of the embodiments of the present application, nor to limit the scope of the present application. Other features of the present application will become apparent from the following description. BRIEF DESCRIPTION OF DRAWINGS

[0046] The above and other features, advantages, and aspects of the embodiments of the present application will become more apparent upon consideration of the following detailed description, taken in conjunction with the accompanying drawings. In the drawings like reference numerals refer to like elements, wherein:

[0047] Figure 1 A flowchart of a test case generation method provided by the embodiments of the present application;

[0048] Figure 2 A structural schematic diagram of a test case generation system provided by the embodiments of the present application;

[0049] Figure 3 A structural schematic diagram of an electronic device provided by the embodiments of the present application. DETAILED DESCRIPTION

[0050] To make the objects, technical solutions and advantages of the embodiments of the present disclosure clearer, the technical solutions in the embodiments of the present disclosure will be described clearly and completely below with reference to the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are only a part of the embodiments of the present disclosure, rather than all the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by a person of ordinary skill in the art without creative work fall within the protection scope of the present disclosure.

[0051] In addition, the term "and / or" herein is only to describe the association relationship of the associated objects, which means that there can be three relationships, for example, A and / or B can represent the following three cases: A exists alone, A and B exist together, and B exists alone. In addition, the character " / " herein generally represents an "or" relationship between the front and rear associated objects.

[0052] In a first aspect, the embodiments of the present application provide a test case generation method, which is suitable for an agent. Figure 1 A flowchart of a test case generation method 100 provided by the embodiments of the present application is shown in FIG. 1, which includes the following steps. Figure 1

[0053] In step S1, the related parameters of the target mind map are obtained based on the target command line.

[0054] For example, the target command line can be automatically generated by the agent according to the test scenario and / or the historical conversation content with the user, or can be input by the user. The historical conversation content can include test requirements, etc.

[0055] For example, the target mind map is used to determine test function points, business processes, data relationships, and / or constraint conditions, etc. The target mind map can include XMind format mind map and / or mindmup format mind map.

[0056] For example, the related parameters can include path parameters and / or business type parameters, etc.

[0057] For example, the target command line can be automatically constructed according to the test scenario and / or the historical conversation content between the agent and the user about test requirements, and / or the path parameters and / or business type parameters of the target mind map can be automatically obtained according to the target command line input by the user.

[0058] In step S2, the target information is determined by reading the target mind map according to the related parameters.

[0059] For example, the XMind format mind map and / or the mindmup format mind map can be read according to the path parameters and / or the business type parameters to determine entity information, relationship information, and / or event information. The entity information can include test function point information, system component information, data object information, and / or constraint condition information, etc. The relationship information can include test business process pointing information, component dependency relationship information, and / or data relationship information, etc. The event information can include operation event information, system trigger event information, and / or state change event information, etc.

[0060] In some possible embodiments, step S2 includes the following steps.

[0061] In step S21, the first tree-structured data is generated by reading the target mind map.

[0062] ​Exemplarily, an XMind format mind map and / or a mindmup format mind map can be read to generate first tree structured data. The first tree structured data can include structured JSON data.

[0063] Step S22: performing a preprocessing operation on the first tree structured data to generate second tree structured data.

[0064] Exemplarily, a structure cleaning operation, a level optimization operation, an attribute standardization operation, and / or a relationship enhancement operation can be performed on the first tree structured data to generate the second tree structured data.

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

[0066] Exemplarily, a level optimization operation can be performed on the first tree structured data to adjust the node level relationship in the second tree structured data and / or optimize the tree structure representation in the second tree structured data.

[0067] Exemplarily, an attribute standardization operation can be performed on the first tree structured data to unify the naming rules and data formats of node attributes in the second tree structured data.

[0068] Exemplarily, a relationship enhancement operation can be performed on the first tree structured data to perfect the association relationship description between nodes in the second tree structured data.

[0069] Step S23: extracting target information based on the second tree structured data.

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

[0071] Thus, through steps S21-S23, the target mind map can be converted into tree structured data, thereby accurately preserving the hierarchical relationship and effective information in the target mind map. Through preprocessing operations on the data, the standardization and consistency of the data can be improved, and redundant or noise interference can be reduced, thereby improving the accuracy and efficiency of target information extraction.

[0072] Step S3: generating a target test case population according to the target information.

[0073] Exemplarily, the target test case population can be generated according to the entity information, the relationship information, and / or the event information.

[0074] In some possible implementation manners, the step S3 comprises:

[0075] The step S31 comprises: generating an initial test case population according to the target information.

[0076] For example, the initial test case population can be generated according to the entity information, the relationship information, and / or the event information.

[0077] The step S32 comprises: selecting target parent test case individuals based on the initial test case population.

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

[0079] In some possible implementation manners, the step S32 comprises:

[0080] The step S321 comprises: determining that an initial test case individual corresponds to a target parent test case individual in a case where a target fitness of the initial test case individual is greater than a preset fitness threshold, wherein the target fitness is determined based on a target coverage rate, a target risk coefficient, a target path depth, and / or a target historical occurrence frequency.

[0081] For example, the target coverage rate can be determined according to code branches, statements, and / or requirement points that can be covered by the initial test case individual. The target risk coefficient can be determined according to a risk level corresponding to a function to be tested by the initial test case individual. The target path depth can be determined according to a step length of the initial test case individual and / or a business process depth of coverage. The target historical occurrence frequency can be determined according to a number of occurrences of the initial test case individual in a historical test scenario.

[0082] For example, the target fitness of the initial test case individual can be determined according to the target coverage rate and a first weight corresponding thereto, the target risk coefficient and a second weight corresponding thereto, the target path depth and a third weight corresponding thereto, and / or the target historical occurrence frequency and a fourth weight corresponding thereto.

[0083] Specifically, the target fitness can be determined according to the following formula:

[0084] ;

[0085] wherein, is used to represent the target fitness; is used to represent the target coverage rate; is used to represent the target risk coefficient; for representing a target path depth; for representing a reciprocal of a target history occurrence frequency; for representing a first weight; for representing a second weight; for representing a third weight; for representing a fourth weight.

[0086] It should be noted that the values of the above-mentioned first weight , the above-mentioned second weight , the above-mentioned third weight , and the above-mentioned fourth weight may be automatically determined by the agent according to the test scenario, and / or the historical dialogue content with the user, or may be set by the user.

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

[0088] Therefore, the above-mentioned method can comprehensively and accurately determine the target fitness of the initial test case individual based on the multi-dimensional indexes such as the target coverage rate, the target risk coefficient, the target path depth, and / or the target history occurrence frequency, and accurately select the initial test case individual with high coverage ability, risk control ability, business process coverage depth, and low history occurrence frequency as the target parent test case individual according to the comparison result of the target fitness and the preset fitness threshold, thereby improving the generation accuracy and generation quality of the target generation test case population.

[0089] Step S33: performing a target operation on the plurality of target parent test case individuals to iteratively evolve and generate a target generation test case population.

[0090] Exemplarily, a crossover operation and / or a mutation operation can be performed on the plurality of target parent test case individuals to iteratively evolve and generate the target generation test case population.

[0091] In some possible implementations, the above-mentioned step S33: performing a target operation on the plurality of target parent test case individuals to iteratively evolve and generate a target generation test case population, comprises:

[0092] Step S331: exchanging the target information corresponding to the plurality of target parent test case individuals to generate a target child test case individual.

[0093] Exemplarily, the entity information, the relationship information, and / or the event information corresponding to the plurality of target parent test case individuals can be exchanged to generate the target child test case individual.

[0094] For example, the test function point information, the system component information, the data object information, and / or the constraint condition information corresponding to the plurality of target parent test case individuals can be exchanged; the test business process pointing information, the component dependency relationship information, and / or the data relationship information; the operation event information, the system trigger event information, and the state change event information, to generate the target child test case individual.

[0095] Step S332: randomly modifying the target information corresponding to the target child test case individual to generate the target generation test case population.

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

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

[0098] Therefore, the above method can fuse the excellent features of the plurality of target parent test case individuals in the target child test case individual by exchanging the target information of different target parent test case individuals, thereby improving the comprehensive performance of the newly generated target child test case individual in terms of coverage range, risk control ability, business process coverage depth, and historical repetition rate control; by randomly modifying the target information of the target child test case individual, 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 falling into a local optimal solution; further, through the synergistic effect of the crossover and mutation operations, the target generation test case population can maintain the exploration ability while inheriting excellent genes, can be continuously iteratively optimized, and can improve the overall quality of the generated target generation test case population in terms of coverage, reliability, and effectiveness, thereby improving the comprehensiveness of the test process and the accuracy of the test results.

[0099] 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.

[0100] In some feasible implementations, the above method further includes:

[0101] 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.

[0102] Population diversity is determined using the following formula:

[0103] ;

[0104] 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.

[0105] 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.

[0106] Among them, individual target child test cases individual test cases for the target offspring similarity Determined according to the following formula:

[0107] ;

[0108] 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.

[0109] 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.

[0110] 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.

[0111] 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.

[0112] In some feasible implementations, the above method further includes:

[0113] 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 .

[0114] 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 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.

[0115] 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.

[0116] In some feasible implementations, the above method further includes:

[0117] 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;

[0118] 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.

[0119] 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.

[0120] Therefore, the method can realize automatic detection and supplement of missing boundary value information, so as to ensure that the target test case population covers key boundary conditions, thereby further improving the coverage rate of the test process and the quality of the test result, and meeting the needs of high-precision and high-efficiency test scenarios.

[0121] In some possible embodiments, the method further includes:

[0122] According to the target test case population, a target data frame is generated to export a target format file.

[0123] Exemplarily, the target data frame can be generated based on pandas to export the target format file according to the target test case population, where the target format file can include an Excel format file, a CSV format file, and / or an XML format file, and the like.

[0124] Specifically, the target data frame can be subjected to a format optimization operation, a title style adjustment operation, a column width line adjustment operation, and / or a priority color coding operation to export the Excel format file.

[0125] Therefore, the target data frame is generated according to the target test case population and the target format file is exported, which can realize structured management, standardized storage and visual presentation of the target test case population data, thereby improving the efficiency and usability of test data processing.

[0126] It should be noted that, for the foregoing method embodiments, in order to simply describe, they are all described as a series of action combinations, but those skilled in the art should know that the present application is not limited to the action sequence described, because according to the present application, certain steps can be performed in other sequences or simultaneously. Secondly, those skilled in the art should know that the embodiments described in the specification are all optional embodiments, and the actions and modules involved are not necessarily required by the present application.

[0127] The above is the introduction of the method embodiment, and the scheme described in the present application will be further described through the system embodiment.

[0128] The second aspect of the embodiment of the present application proposes a test case generation system suitable for the method described above. Figure 2 A structural schematic diagram of a test case generation system 200 provided by the embodiment of the present application is shown in FIG. 2. Figure 2 As shown in the test case generation system 200, the test case generation system 200 includes an acquisition module 210, a determination module 220 and a generation unit 230.

[0129] The acquisition module 210 is configured to acquire related parameters of a target brain map based on a target command line.

[0130] The determining module 220 is configured to determine target information according to the target brain map and the related parameters.

[0131] The generating module 230 is configured to generate a target test case population according to the target information.

[0132] The target information includes entity information, relationship information, and / or event information.

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

[0134] The following components are connected to the I / O interface 305: an input portion 306 including a keyboard, a mouse, and the like; an output portion 307 including a cathode ray tube (CRT), a liquid crystal display (LCD), and the like, and a speaker, and the like; a storage portion 308 including a hard disk, and the like; and a communication portion 309 including a network interface card such as a LAN card, a modem, and the like. The communication portion 309 performs communication processing via a network such as the Internet. A drive 310 is also connected to the I / O interface 305 as necessary. A removable medium 311 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, and the like is mounted on the drive 310 as necessary, so that a computer program read therefrom is installed in the storage portion 308 as necessary.

[0135] In particular, the above method flow steps can be implemented as a computer software program according to an embodiment of the present application. For example, an embodiment of the present application includes a computer program product comprising a computer program carried on a machine-readable medium, the computer program containing program code for executing the methods shown in the flowcharts. In such an embodiment, the computer program can be downloaded and installed from a network via the communication portion 309, and / or installed from the removable medium 311. When the computer program is executed by the central processing unit (CPU) 301, the above-described functions defined in the system of the present application are performed.

[0136] ​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.

[0137] 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.

[0138] The units or modules described in the embodiments of the present application can be implemented in the form of software or in the form of hardware. The described units or modules can also be arranged in a processor. In some cases, the names of the units or modules do not constitute a limitation on the units or modules themselves.

[0139] The above description is merely the preferred embodiments of the present application and the explanation of the applied technical principles. It should be understood by those skilled in the art that the application scope involved in the present application is not limited to the technical solutions formed by the specific combinations of the above technical features, and should also cover other technical solutions formed by any combinations of the above technical features or equivalent features without departing from the above application concept. For example, the technical solutions formed by the mutual replacement of the above features and the technical features applied in the present application (but not limited to) having similar functions.

Claims

1. A test case generation method characterized by, The method is suitable for an intelligent agent, and comprises the following steps: acquiring relevant parameters of a target mind map based on a target command line; reading the target mind map to determine target information according to the relevant parameters; generating a target test case population according to the target information; wherein the target information comprises entity information, relationship information, and / or event information; the reading of the target mind map to determine the target information according to the relevant parameters comprises: reading the target mind map to generate first tree structured data; performing a preprocessing operation on the first tree structured data to generate second tree structured data; extracting the target information based on the second tree structured data; the generation of the target test case population according to the target information comprises: generating an initial test case population according to the target information; selecting target parent test case individuals based on the initial test case population; performing a target operation on a plurality of the target parent test case individuals to iteratively evolve to generate a target generation test case population; the method further comprises: stopping the iterative evolution when a difference between a population diversity corresponding to a first target generation test case population and a population diversity corresponding to a second target generation test case population is less than or equal to a preset difference threshold; wherein the population diversity is determined according to the following formula: ; wherein, for indicating population diversity; for indicating population size; for indicating the target offspring test case individual; for indicating the target offspring test case individual; , for indicating an index value of the target offspring test case individual; for indicating a similarity of the target offspring test case individual to the target offspring test case individual ;​ wherein the target offspring test case individual is determined according to the following formula: the similarity of the target offspring test case individual is determined according to the following formula: ; wherein, for indicating the execution target child test case individual a set of elements covered; for indicating the execution target child test case individual a set of elements covered.

2. The method of claim 1, wherein, the selection of the target parent test case individuals based on the initial test case population comprises: determining that an initial test case individual corresponds to a target parent test case individual when a target fitness corresponding to the initial test case individual is greater than a preset fitness threshold; wherein the target fitness is determined based on a target coverage rate, a target risk coefficient, a target path depth, and / or a target historical occurrence frequency.

3. The method of claim 2, wherein, the performing of the target operation on the plurality of the target parent test case individuals to iteratively evolve to generate the target generation test case population comprises: exchanging the target information corresponding to the plurality of the target parent test case individuals to generate target child test case individuals; randomly modifying the target information corresponding to the target child test case individuals to generate the target generation test case population.

4. The method of claim 3, wherein, the method further comprises: if a similarity between the target offspring test case individual and the target offspring test case individual is greater than a preset similarity threshold, merging the target offspring test case individual and the target offspring test case individual . . . .

5. The method according to any one of claims 1 to 4, characterized in that, the method further comprises: determining a first boundary value and a second boundary value based on the entity information when it is determined that there is missing boundary value information; determining a target boundary value set based on the first boundary value, the second boundary value, and / or a target division granularity to supplement the boundary value information.

6. The method of claim 5, wherein, the method further comprises: generating a target data frame based on the target test case population to export a target format file.

7. A test case generation system adapted to the method of claim 1, characterized in that, The method comprises the following steps: acquiring a relevant parameter of a target mind map based on a target command line by using an acquisition module; reading the target mind map to determine target information according to the relevant parameters by using a determination module; generating a target test case population according to the target information by using a generation module; wherein the target information comprises entity information, relationship information, and / or event information; the reading of the target mind map to determine the target information according to the relevant parameters comprises: reading the target mind map to generate first tree structured data; performing a preprocessing operation on the first tree-structured data to generate second tree-structured data; extracting the target information based on the second tree-structured data; the generating a target test case population according to the target information comprises: generating an initial test case population according to the target information; selecting target parent test case individuals based on the initial test case population; performing a target operation on a plurality of target parent test case individuals to iteratively evolve to generate a target generation test case population; further comprising: stopping the iterative evolution in a case where a difference between a population diversity corresponding to the first target generation test case population and a population diversity corresponding to the second target generation test case population is less than or equal to a preset difference threshold; wherein the population diversity is determined according to the following formula: ; wherein, for indicating population diversity; for indicating population size; for indicating the target offspring test case individual; for indicating the target offspring test case individual; , for indicating an index value of the target offspring test case individual; for indicating a similarity of the target offspring test case individual to the target offspring test case individual ; wherein the target offspring test case individual is similar to the target offspring test case individual by a similarity determined according to the following formula: ; wherein, for indicating the execution target child test case individual the covered element set. for indicating the execution target child test case individual the covered element set.

Citation Information

Patent Citations

  • Test case management method and device

    CN115422066A

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

    CN120743780A