Test data construction method and equipment
By obtaining process definition information and rule analysis, the test path is generated, which solves the problem of high cost and incomplete coverage of manually constructed test data, realizes automated test data generation, and improves test effect and coverage.
Patent Information
- Application Number
- CN202410020558.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-01-04
- Publication Date
- 2024-09-20
AI Technical Summary
In the existing technology, test data is manually constructed, resulting in high cost and incomplete coverage, resulting in poor test results.
By obtaining the process definition information, extracting the list of rules in the sub-process, parsing the rules to generate a test path, and obtaining data that satisfies the test path as test data, software is used to implement process analysis and path identification, reducing human intervention.
It improves the coverage and testing effect of test data, reduces the cost of test data construction, and realizes automated test data generation.
Smart Images

Figure CN118672893A
Abstract
Description
Technical Field
[0001] The present application relates to the field of testing, and in particular to a test data construction method and device. Background Art
[0002] In the field of testing, a large amount of test data is required to complete the test. Test data is the data input into the test case, and the execution result of the test case is used to determine whether the function of the test object is normal. Therefore, the quality of test data is an important factor in determining the test effect.
[0003] Test data is usually constructed manually. For example, a tester can obtain test cases to be executed to analyze the test functions of each test case, so that test data can be constructed for the test case based on the test functions.
[0004] However, manually constructed test data has the problems of poor testing effect and high construction cost. Summary of the invention
[0005] The present application provides a test data construction method and device, which can reduce the construction cost of test data and improve the test effect of test data.
[0006] In a first aspect, the present application provides a test data construction method, the method comprising:
[0007] Acquire process definition information, wherein the process definition information includes at least one main process and at least one sub-process included in each main process;
[0008] extracting a list of rules included in each of said sub-processes;
[0009] Parsing each rule in the rule list to obtain a test path for each rule;
[0010] Data satisfying at least one of the test paths is acquired as test data.
[0011] In a second aspect, the present application provides a test data construction device, the device comprising:
[0012] A process definition acquisition module, used to acquire process definition information, wherein the process definition information includes at least one main process and at least one sub-process included in each main process;
[0013] A rule extraction module, used for extracting a list of rules included in each of the sub-processes;
[0014] A rule parsing module, used for parsing each rule in the rule list to obtain a test path for each rule;
[0015] The test data generation module is used to obtain data that satisfies at least one of the test paths as test data.
[0016] In a third aspect, the present application provides an electronic device, comprising: a processor, and a memory communicatively connected to the processor;
[0017] The memory stores computer-executable instructions;
[0018] The processor executes the computer-executable instructions stored in the memory to implement the method according to the first aspect.
[0019] In a fourth aspect, the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are executed by a processor, they are used to implement the method described in the first aspect.
[0020] In a fifth aspect, the present application provides a computer program product for implementing the method of the first aspect.
[0021] It can be seen that in the embodiment of the present application, test data can be generated based on process analysis, and the generated test data can cover all rules of all configured processes, so as to cover all test scenarios as much as possible, which helps to improve the test effect. In addition, the analysis process of the above process and the identification process of the test path are all implemented by software, and no manual analysis is required, which can reduce costs. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0023] Figure 1 It is a life cycle diagram of a software product provided by the prior art;
[0024] Figure 2 It is a flowchart of the steps of a test data construction method provided in an embodiment of the present application;
[0025] Figure 3 is a flowchart of another test data construction method provided by an embodiment of the present application;
[0026] Figure 4 It is a structural block diagram of a test data construction device provided in an embodiment of the present application;
[0027] Figure 5 It is a structural block diagram of an electronic device provided in an embodiment of the present application.
[0028] The above drawings have shown clear embodiments of the present application, which will be described in more detail later. These drawings and text descriptions are not intended to limit the scope of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION
[0029] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.
[0030] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0031] It should be noted that the test data construction method and device of the present application can be used in the field of testing, including the field of automated testing and the field of manual testing. The test object can be a software product that provides any function in any application scenario.
[0032] For software products, they usually go through Figure 1 The three stages shown are: design and development stage, testing stage, and application stage.
[0033] The design and development phase is used to design the software's functions, display, etc., and to develop the software according to the designed functions and display effects to obtain a software product.
[0034] The testing phase is used to input test data into test cases to test the software product and obtain test results. The test cases will call the software product during the testing process.
[0035] The application phase is used to bring software products that have passed the testing phase online to provide software services.
[0036] It is understandable that during the application phase, operational problems of the software product may be discovered, or new functions may be needed, so the software may be redeveloped through the design and development phase to address the operational problems or new functions, and then put online again after passing the test.
[0037] From the above Figure 1It can be seen that the testing phase is an important stage to ensure the functionality and performance of software products, among which test data is an important aspect that affects the test results.
[0038] A typical application scenario of the embodiment of the present application is the risk control decision product test to verify whether the execution plan of the strategy data product is executed according to the configured process and rules. The test requirement is to cover all scenarios, processes, and branches.
[0039] In traditional testing scenarios, test data is manually constructed, which results in high costs and incomplete coverage of test data due to human factors, which in turn results in incomplete test coverage and poor test results.
[0040] The embodiments of the present application are used to construct test data to reduce costs and improve test results. Specifically, the process can be analyzed to obtain the rules used by the process, and then a test path can be generated according to these rules. Test data is selected for the test path, so that the test data can cover all test scenarios and improve the test effect as much as possible. In addition, the analysis process of the above process and the identification process of the test path are both implemented by software, and no manual analysis is required, which can reduce costs.
[0041] The technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems are described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.
[0042] Figure 2 is a flowchart of a test data construction method provided in an embodiment of the present application. Figure 2 As shown, the test data construction method of the present application may include:
[0043] S201: Acquire process definition information, where the process definition information includes at least one main process and at least one sub-process included in each main process.
[0044] Among them, the process definition information is pre-configured, and the pre-configured process definition information can be stored in a database or a file. This application does not limit the storage method of the process definition information.
[0045] In actual applications, process definition information can be obtained in batches to obtain all process definition information of one or more business scenarios. Specifically, multiple main processes can be obtained in batches first, and then for each main process, the configured sub-processes can be obtained to obtain a sub-process list.
[0046] S202: Extract the rule list included in each sub-process.
[0047] The rule list of each sub-process includes at least one rule to be executed for the execution of the sub-process. Each sub-process corresponds to a rule list, so the number of rule lists here is the same as the number of sub-processes. Each rule can be understood as an execution condition. Under different execution conditions, the sub-process jumps to different branches to perform different operations. For example, in a sub-process, it includes two rules A1 and A2. When rule A1 is met, branch B1 is executed to implement the approval end process. When rule A2 is met, branch B2 is executed to further perform identity verification.
[0048] In some implementations, a custom rule extractor can be used to extract the rule lists used by the sub-processes in the business scenarios. The rule extractors of the sub-processes in different business scenarios correspond to the same principle, so a custom rule extractor can realize the rule extraction of all sub-processes.
[0049] In the embodiment of the present application, multiple business scenarios may be used in each sub-process, and multiple rules may be used in each business scenario. Therefore, when extracting the rules of the process, it is necessary to extract the rules of all business scenarios so that the test paths and test data generated subsequently cover all business scenarios, which helps to improve the test coverage. For example, the business scenarios may include M1 and M2, and the rules may include N1, N2, N3 and N4, so that the rules extracted by S202 may include: N1 and N2 in business scenario M1, N1, N2, N3 and N4 in business scenario M1, N2 and N4 in business scenario M1, N1 and N4 in business scenario M2, and N2, N3 and N4 in business scenario M2.
[0050] In the financial field, the business scenarios here may include but are not limited to: loan review scenarios, payment scenarios, deduction scenarios, etc.
[0051] In some implementations, S203 to S204 may be performed for a target main process and / or a target sub-process to generate test data for the target main process and / or the target sub-process. In this way, in some specific scenarios, part of the main process and / or part of the sub-process may be tested first, for example, test data may be generated first for more important main processes and / or sub-processes, or test data may be generated for abnormal main processes and / or sub-processes.
[0052] S203: Parse the rules in each rule list to obtain a test path for each rule.
[0053] In some embodiments, the execution condition in the rule can be directly used as the test path. For example, if the execution condition of the rule is to conduct an audit when parameter C is greater than or equal to 100, then the test path of the rule can be that parameter C is greater than or equal to 100.
[0054] In the embodiments of the present application, for each rule, the process of generating its test path may include: First, determine the rule type of the rule, then, determine the rule parser corresponding to the rule type; Finally, parse the rule through the rule parser to obtain the test path of the rule. In this way, for different rule types, different rule parsers can be called, and different test path generation algorithms can be used to generate test paths, so as to improve the accuracy and coverage of the test paths. In addition, setting different rule parsers for different rule types can facilitate code maintenance and improve code cleanliness.
[0055] Among them, the rule type is the type determined according to the execution condition in the rule. For example, when the execution condition is C = 5103, the rule type can be equal; when the execution condition is: 60 < C < 80, the rule type can be interval. The division of the rule type can be flexibly divided according to actual needs.
[0056] It can be understood that the rule types "equal" and "interval" respectively correspond to two different rule parsers, and their parsing principles are different. For the rule type "equal", a test path equal to the target value can be generated, and for the rule type "interval", a test path within the interval can be generated.
[0057] In traditional algorithms, the execution condition specified by the rule can be used as the corresponding test path, but this method may cause the processing when the execution condition is not met to not be tested, resulting in poor robustness of the software product.
[0058] In some embodiments, for each rule, the process of parsing the rule through the rule parser of the rule to obtain the test path of the rule may include: parsing the rule through the rule parser to obtain the execution condition of the rule, so as to determine the test path of the rule according to the execution condition. Among them, the test path is used to test the processing flow when the execution condition is met, or, to test the processing flow when the execution condition is not met.
[0059] It can be seen that the above test paths include two types. One is used to test the processing flow when the execution condition is met, which can be called the forward test path; the other is used to test the processing flow when the execution condition is not met, which can be called the reverse test path. The forward test path can generate regular forward test data to test the functions of the software product under normal input, and the reverse test path can generate regular reverse test data to test the functions of the software product under abnormal input, so as to improve the test coverage as much as possible. For example, when the execution condition is C = 5103, the test path includes not only the forward test path C = 5103, but also the reverse test path C!= 5103. When the execution condition is 60 < C < 80, the test path includes not only the forward test path 60 < C < 80, but also the reverse test path C <= 60 and the reverse test path C >= 80.
[0060] To further improve the test coverage, the test path can also be split into multiple test sub-paths, and the data that meets at least one test sub-path is used as test data. The length of the test sub-path is a preset length, and / or the length of the test sub-path is determined based on the execution condition. In this way, as many test paths as possible can be generated to improve the test coverage as much as possible.
[0061] Among them, the above execution condition can be a value range, so that the length of the test sub-path can be determined according to the boundary values of the value range. For example, when the execution condition is 60 < C < 80, the original test paths C <= 60 and C >= 80 that do not meet the execution condition can be split into C < 60, C = 60, C > 80, and C = 80 according to the boundary values of the execution condition. The test path 60 < C < 80 that meets the execution condition can also be split into two test sub-paths according to the preset length of 10: 60 < C < 70 and 60 < C < 80.
[0062] S204: Obtain the data that meets at least one test path as test data.
[0063] Among them, the test path is used to limit the value range of the test data, so that the test data is any data within this value range. Therefore, the above S204 can include: selecting data from the value range corresponding to the test path as test data. For example, the test path can be that the parameter C in the test data is greater than or equal to 100, so one or more data can be selected from the data greater than or equal to 100 as the test data for this test path.
[0064] In an embodiment of the present application, in order to improve the accuracy and authenticity of the test, test data can be selected from the target data actually generated during the operation of the system. Specifically, first, the target data is obtained; then, data that satisfies at least one test path or test sub-path is filtered out from the target data as test data. It can be understood that in some scenarios, the test path is not split. In this case, data that satisfies at least one test path can be filtered out from the target data as test data. In other scenarios, each test path is split into one or more test sub-paths. In this case, data that satisfies at least one test sub-path can be filtered out from the target data as test data.
[0065] The target data includes: data obtained when the preset switch is in the on state and data obtained within the preset time period. The target data is the full or partial data actually generated during the operation of the system. The preset switch is used to turn on or off the function of obtaining target data. When the preset switch is in the on state, the target data can be obtained. When the preset switch is in the off state, the target data cannot be obtained.
[0066] The preset time period is used to limit the time for obtaining target data. The target data can be obtained within the preset time period, and the target data cannot be obtained outside the preset time period.
[0067] Therefore, the above-mentioned preset switch and preset time period are used to limit the acquisition time of the target data, so as to obtain the target data without affecting the operation of the system, which helps to ensure the normal operation of the system function and stable performance during the process of obtaining the target data. For example, the preset switch is pre-configured and is closed by default. When the target data needs to be obtained, the administrator can turn on the switch. The preset time period can also be flexibly configured, usually configured as a time period with less system usage. For example, the preset time period can be from 2 am to 5 am every day.
[0068] In practical applications, the target data can be obtained to store the target data in a database for use in subsequent test data construction. In this way, the target data acquisition process and the test data construction process can be decoupled, which helps to improve the flexibility of test data construction time.
[0069] In some embodiments, the process of filtering out data satisfying at least one test path from target data as test data may include: first, obtaining a first rule from all rules, and obtaining first data from target data, wherein the first rule is not associated with a first tag, and the first data is not associated with a second tag, the first tag is used to indicate that test data has been generated based on all test paths of the rule, and the second tag is used to indicate that the data is not used as test data; then, obtaining data satisfying at least one test path of the first rule from the first data as test data. The above-mentioned all rules are all rules in the list of all rules extracted in step S202.
[0070] It can be seen that the first mark is associated with the rule. When a rule is associated with the first mark, it means that test data has been generated based on all test paths of the rule. When a rule is not associated with the first mark, it means that some or all test paths of the rule have not generated test data. Therefore, the first rule is a rule whose all test paths have generated test data.
[0071] Correspondingly, the second tag is associated with the data. When a data is associated with the second tag, it means that the data has been used as test data. When a data is not associated with the second tag, it means that the data is not used as test data. Therefore, the first data is the data in the target data that is not used as test data.
[0072] After obtaining the above-mentioned first rule and first data, data of at least one test path that satisfies the first rule is obtained from the first data as test data. Since the first data is data that is not used as test data, the first rule is a rule that has not completed the test data generation, thereby avoiding repeated matching of data and repeated matching of rules, which helps to improve the efficiency of test data generation. It can be understood that, initially, the rule generated by S203 is not associated with the first tag, and the target data is not associated with the second tag. At this time, all rules are first rules, and all target data are first data. In the case of using the second data included in the first data as test data, a second tag is added to the second data, and a third tag is added to the test path associated with the second data, and in the case where all test paths associated with the second rule in the first rule are added with the third tag, the first tag is added to the second rule.
[0073] The second data is the data in the first data that successfully matches at least one test path during the process of generating the test data. At this time, the second data needs to be used as the test data and the first mark is added to it. This avoids the subsequent re-matching of the test data with the remaining test paths, reduces the number of repeated matches of the test data, and can improve the generation efficiency of the test data.
[0074] The third mark is used to indicate that test data has been generated based on the test path, and the third mark is associated with the test path. When a test path is associated with the third mark, it means that test data has been generated based on the test path; when a test path is not associated with the third mark, it means that test data has not been generated for the test path.
[0075] In some implementations, in order to further reduce the number of repeated matches of the test path, when obtaining data of at least one test path satisfying the first rule from the first data as test data, data satisfying the first test path in the first rule can be obtained from the first data as test data. The first test path is a test path not associated with the third tag. In this way, when generating test data for the first rule, repeated matching of the test path can be further avoided, thereby improving the generation efficiency of the test data.
[0076] It is understandable that when a test path fails to match a first data, the third mark will not be added to the test path that failed to match to continue as the first test path, and the second mark will not be added to the first data to continue as the first data. In this way, the test path that failed to match can be matched with all the first data in the future to select test data for the test path that failed to match. And for the first data that failed to match, it is also necessary to match it with the remaining first test paths in the future to determine whether the first data that failed to match can be used to test the remaining first test paths.
[0077] In actual applications, developers can customize a checker whose input parameters include a first test path and first data. The checker can match and check the first test path and the first data one by one to output the first data matching the first test path as the test data of the first test path. Of course, the checker can also output the test path and rules that do not generate test data, so that the tester can set the test data separately according to these test paths and rules, so as to improve the test data coverage and test effect as much as possible.
[0078] In some implementations, the checker may also output the number of test data for each test path to indicate the test coverage of the test path. A test path with a greater number of matching test data corresponds to a higher test coverage.
[0079] In some implementations, when generating test data, the main process and / or sub-process corresponding to the test data can also be output to store the test data and the corresponding main process and sub-process. During testing, part of the main process and sub-process can be tested, which helps to improve test flexibility.
[0080] In order to reduce the amount of output data as much as possible, the test data can be constructed according to the main process and / or sub-process. Specifically, the test data construction method of the embodiment of the present application includes a test data construction process of multiple main processes, and the test data construction process of each main process includes: the test data construction process of multiple sub-processes in the main process, and the test data construction process of each sub-process includes: extracting all the rules of the sub-process to extract the test path of each rule to generate test data. It can be seen that the embodiment of the present application needs to continuously loop S203 and S204 to achieve the test data construction of each sub-process.
[0081] Before the above test data is stored in the database, the sensitive information in the test data needs to be desensitized to avoid leakage of sensitive information. Specifically, desensitization can be achieved through encryption.
[0082] When testing is required, test data can be read from the test database for testing, and the test results can be saved. The test results are used to indicate whether each test data is tested successfully. In addition, the test results can also include the main process and / or sub-process corresponding to each test data for statistics to obtain test result statistics, including but not limited to: the proportion of main processes that are tested successfully and / or failed, and the proportion of sub-processes that are tested successfully and / or failed. Among them, the proportion of sub-processes can be the proportion of sub-processes that are tested successfully in each main process, and / or the proportion of sub-processes that are tested successfully in all sub-processes.
[0083] Figure 3 is a flowchart of another test data construction method provided by an embodiment of the present application. Figure 3 As shown, the above test data construction method may include:
[0084] S301: Acquire process definition information, where the process definition information includes at least one main process and at least one sub-process included in each main process.
[0085] S302: Extract the rule lists used by the sub-processes in the business scenarios through a custom rule extractor.
[0086] S303: Determine the rule type of the rule.
[0087] S304: Determine a rule parser corresponding to the rule type.
[0088] S305: The rule is parsed by a rule parser to obtain the execution condition of the rule.
[0089] S306: Determine a test path of the rule according to the execution condition, where the test path is used to test the processing flow when the execution condition is met, or to test the processing flow when the execution condition is not met.
[0090] S307: Split the test path to obtain multiple test sub-paths, where the length of the test sub-path is a preset length, and / or the length of the test sub-path is determined based on the execution condition.
[0091] S308: Acquire target data, where the target data includes: data acquired when a preset switch is in an on state, and / or data acquired within a preset time period.
[0092] S309: Obtain a first rule from all rules, and obtain first data from target data, wherein the first rule is not associated with a first tag, and the first data is not associated with a second tag, the first tag is used to represent that test data has been generated based on all test paths of the rule, and the second tag is used to represent that the data is not used as test data.
[0093] S310: Based on the test sub-path of the first rule and the first data, obtain data satisfying at least one test sub-path as test data.
[0094] S311: When the second data included in the first data is used as test data, a second tag is added to the second data, and a third tag is added to the test subpath associated with the second data, where the third tag is used to indicate that the test data has been generated based on the test subpath.
[0095] S312: When all test sub-paths associated with the second rule in the first rule are added with the third mark, add the first mark to the second rule.
[0096] It should be noted that the order of the above steps S301 to S312 can be flexibly adjusted on an independent basis. The corresponding descriptions of the above steps S301 to S312 can refer to the corresponding descriptions in the method embodiment, and will not be repeated here.
[0097] Figure 4 is a structural block diagram of a test data construction device provided in an embodiment of the present application. Figure 4 As shown, the test data construction device 400 includes:
[0098] The process definition acquisition module 401 is used to acquire process definition information, where the process definition information includes at least one main process and at least one sub-process included in each main process.
[0099] The rule extraction module 402 is used to extract the rule list included in each of the sub-processes.
[0100] The rule parsing module 403 is used to parse each rule in the rule list to obtain a test path for each rule.
[0101] The test data generating module 404 is used to obtain data satisfying at least one of the test paths as test data.
[0102] Optionally, the rule parsing module 403 is further used to:
[0103] A rule type is determined for the rule.
[0104] A rule parser corresponding to the rule type is determined.
[0105] The rule is parsed by the rule parser to obtain a test path for the rule.
[0106] Optionally, the rule parsing module 403 is further used to:
[0107] The rule is parsed by the rule parser to obtain the execution condition of the rule.
[0108] According to the execution condition, a test path of the rule is determined, and the test path is used to test the processing flow when the execution condition is met, or to test the processing flow when the execution condition is not met.
[0109] Optionally, the rule parsing module 403 is further used to:
[0110] Splitting the test path to obtain a plurality of test sub-paths, wherein the length of the test sub-path is a preset length, and / or the length of the test sub-path is determined based on the execution condition;
[0111] The test data generation module 404 is also used for:
[0112] Data satisfying at least one of the test sub-paths is obtained as test data.
[0113] Optionally, the test data generating module 404 is further used to:
[0114] Acquiring target data, where the target data includes data acquired when a preset switch is in an on state and / or data acquired within a preset time period;
[0115] Data satisfying at least one of the test paths is acquired from the target data as the test data.
[0116] Optionally, the test data generating module 404 is further used to:
[0117] Acquire a first rule from all the rules, and acquire first data from the target data, wherein the first rule is not associated with a first tag, and the first data is not associated with a second tag, the first tag is used to indicate that test data has been generated based on all test paths of the rule, and the second tag is used to indicate that the data is not used as test data;
[0118] Based on the test path of the first rule and the first data, data satisfying at least one of the test paths is acquired as the test data.
[0119] Optionally, the test data generating module 404 is further used to:
[0120] In the case where the second data included in the first data is used as test data, the second tag is added to the second data, and a third tag is added to the test path associated with the second data, wherein the third tag is used to indicate that the test data has been generated based on the test path;
[0121] When all test paths associated with the second rule in the first rule are added with the third tag, the first tag is added to the second rule.
[0122] Figure 5 6 is a structural block diagram of an electronic device provided in an embodiment of the present application. The electronic device 600 includes a memory 602 and at least one processor 601, and the memory 602 and the processor 601 are communicatively connected.
[0123] The memory 602 stores computer-executable instructions.
[0124] At least one processor 601 executes the computer execution instructions stored in the memory 602, so that the electronic device 600 implements the aforementioned Figure 2 The method in .
[0125] In addition, the electronic device 600 may further include a receiver 603 and a transmitter 604. The receiver 603 is used to receive information from other devices or equipment and forward it to the processor 601. The transmitter 604 is used to send the information to other devices or equipment.
[0126] In an exemplary embodiment, a non-transitory computer-readable storage medium is also provided, in which computer-executable instructions are stored. When the computer-executable instructions are executed by a processor, they are used to implement the above-mentioned test data construction method.
[0127] In an exemplary embodiment, a computer program product is also provided for implementing the aforementioned test data construction method.
[0128] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the invention disclosed herein. The present application is intended to cover any modification, use or adaptation of the present application, which follows the general principles of the present application and includes common knowledge or customary techniques in the art that are not disclosed in the present application. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present application are indicated by the following claims.
[0129] It should be understood that the present application is not limited to the precise structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.
Claims
1. A test data construction method, It is characterized in that include: Acquire process definition information, wherein the process definition information includes at least one main process and at least one sub-process included in each main process; extracting a list of rules included in each of said sub-processes; Parsing each rule in the rule list to obtain a test path for each rule; Data satisfying at least one of the test paths is acquired as test data.
2. The method according to claim 1, It is characterized in that For each of the rules, the rule is parsed to obtain a test path for the rule, including: determining a rule type for the rule; Determine a rule parser corresponding to the rule type; The rule is parsed by the rule parser to obtain a test path for the rule.
3. The method according to claim 2, It is characterized in that The step of parsing the rule by the rule parser to obtain a test path for the rule includes: Parsing the rule by the rule parser to obtain the execution condition of the rule; According to the execution condition, a test path of the rule is determined, and the test path is used to test the processing flow when the execution condition is met, or to test the processing flow when the execution condition is not met.
4. The method according to claim 3, It is characterized in that After determining the test path of the rule according to the execution condition, the method further includes: Splitting the test path to obtain a plurality of test sub-paths, wherein the length of the test sub-path is a preset length, and / or the length of the test sub-path is determined based on the execution condition; The acquiring data satisfying at least one of the test paths as test data includes: Data satisfying at least one of the test sub-paths is obtained as test data.
5. The method according to claim 1, It is characterized in that The acquiring data satisfying at least one of the test paths as test data includes: Acquiring target data, where the target data includes data acquired when a preset switch is in an on state and / or data acquired within a preset time period; Data satisfying at least one of the test paths is acquired from the target data as the test data.
6. The method according to claim 5, It is characterized in that The step of acquiring data satisfying at least one of the test paths from the target data as the test data includes: Acquire a first rule from all the rules, and acquire first data from the target data, wherein the first rule is not associated with a first tag, and the first data is not associated with a second tag, the first tag is used to indicate that test data has been generated based on all test paths of the rule, and the second tag is used to indicate that the data is not used as test data; Data of at least one test path satisfying the first rule is acquired from the first data as the test data.
7. A test data construction device, It is characterized in that include: A process definition acquisition module, used to acquire process definition information, wherein the process definition information includes at least one main process and at least one sub-process included in each main process; A rule extraction module, used for extracting a list of rules included in each of the sub-processes; A rule parsing module, used for parsing each rule in the rule list to obtain a test path for each rule; The test data generation module is used to obtain data that satisfies at least one of the test paths as test data.
8. An electronic device, It is characterized in that include: A processor, and a memory communicatively connected to the processor; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory to implement the method according to any one of claims 1 to 6.
9. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores computer-executable instructions, which are used to implement the method according to any one of claims 1 to 6 when executed by a processor.
10. A computer program product, It is characterized in that The computer program product is used to implement the method according to any one of claims 1 to 6.
Citation Information
Cited By
Test data generation method and device and electronic equipment
CN119829424A
Parallel fuzzy test node optimization method and system for distributed environment
CN120910863A
