Test case generation method and device, equipment and storage medium

By determining the target variables and test case templates in the store product management system, and automatically combining parameters using the Cartesian generic algorithm, the problem of low efficiency and effectiveness of test case generation under traditional methods is solved, and efficient and automated test case generation is achieved.

CN119807076AActive Publication Date: 2025-04-11创优数字科技(广东)有限公司

Patent Information

Application Number
CN202510069684.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-16
Publication Date
2025-04-11
Estimated Expiration
2045-01-16

AI Technical Summary

Technical Problem

In the prior art, the generation efficiency and effectiveness of test cases are not high, especially in store product management systems. For the combined testing of multiple variables, the generation efficiency of traditional methods is low and the flexibility is not strong.

Method used

By determining the target variables and test case templates, the Cartesian genesis algorithm is used to automatically combine the target parameters, fill them into the test case template, and output standardized test cases.

Benefits of technology

It realizes the rapid generation of standardized test cases, improves the efficiency and automation level of test case generation, and meets the specific needs of specific business conditions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119807076A_ABST
    Figure CN119807076A_ABST
Patent Text Reader

Abstract

The invention provides a test case generation method and device, equipment and a storage medium. Input parameters are automatically combined in a Cartesian product mode to generate test cases in batches, the test case generation efficiency and the automation level are improved, target variables and test case templates are determined and can serve as fixed parts of the test cases, and after a target parameter array is input subsequently, the test cases can be automatically generated according to the content in the target parameter array. According to the embodiment of the invention, automatic filling is realized, the test case is generated, in the process of generating the test case, a plurality of target parameter combinations are obtained by executing Cartesian product on each target parameter array, and each target parameter in the target parameter combinations is filled into a pre-generated test case template to output a target test case. Therefore, the effect that the input parameters are automatically combined in a Cartesian product mode to generate the test cases in batches is achieved, automatic batch generation of the test cases is achieved, and the generation efficiency and effectiveness of the test cases are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data analysis, and in particular to a test case generation method, apparatus, device and storage medium. Background Art

[0002] In the retail industry, the store merchandise management system is a core business system, involving multiple operations such as merchandise on and off shelves, promotions, and inventory adjustments. In terms of test cases, traditional methods have low generation efficiency for combined tests of multiple variables such as stores, merchandise, and operations, and are not flexible enough to adjust to actual needs. At the same time, test cases need to follow standardized output, including module names, case numbers, preconditions, operation steps, expected results, etc. Manual writing has the risk of inefficiency and errors. Therefore, a test case generation method is needed that can quickly generate standardized test cases for store merchandise systems and meet the specific needs of specific business conditions, that is, to improve the efficiency and effectiveness of test case generation. Summary of the invention

[0003] The purpose of this application is to solve at least one of the above-mentioned technical defects, especially the technical defect that the test case generation efficiency and effectiveness in the prior art are low.

[0004] In a first aspect, the present application provides a test case generation method, the method comprising:

[0005] Determine target variables and test case templates;

[0006] The test case template includes a plurality of placeholders, and the placeholders are used to indicate the preset positions of the target variables in the test case;

[0007] Determine a target parameter array corresponding to the target variable;

[0008] Performing a Cartesian product on each of the target parameter arrays to obtain a plurality of target parameter combinations;

[0009] Fill each target parameter in the target parameter combination into the test case template and output the target test case.

[0010] As an optional implementation, the target variables include stores, commodities, and operations;

[0011] Determining the test case template and the target variable includes:

[0012] Determine the module, use case number, and preconditions, and generate operation steps and expected results based on the target variables;

[0013] Among them, the attribution module is used to indicate the function of each of the test cases, the case number is used to indicate the unique identifier of each of the test cases, the precondition is used to indicate the condition for triggering the execution of each of the test cases, and the expected result is used to indicate the expected output of the operation steps corresponding to each of the test cases.

[0014] As an optional implementation manner, before performing the Cartesian product on each of the target parameter arrays to obtain a plurality of target parameter combinations, the method further includes:

[0015] Determining parameter combination conditions according to expected input parameters of the target variable;

[0016] The parameter combination condition is used to indicate the restriction condition for combining different target parameters in the target parameter array.

[0017] As an optional implementation manner, before determining the parameter combination condition according to the expected input parameters of the target variable, the method further includes:

[0018] Determine the store business scenario indicated by each of the target variables;

[0019] According to the store business scenario, association rules for each of the target variables are determined, and expected input parameters for each of the target variables are determined according to the association rules.

[0020] As an optional implementation manner, determining the association rules of the target variables according to the store business scenario includes:

[0021] According to the execution results of historical test cases, adjusting the association rules of each of the target variables;

[0022] The method further comprises:

[0023] According to the adjusted association rules, adjusting the expected input parameters of each of the target variables;

[0024] Modify the parameter combination conditions based on the adjusted expected input parameters.

[0025] As an optional implementation, the method further includes:

[0026] Output a target list corresponding to the target test case;

[0027] The target list is converted into a target file and output to a preset terminal.

[0028] As an optional implementation manner, after filling each target parameter in the target parameter combination into the test case template and outputting the target test case, the method further includes:

[0029] Determine the data validity of each of the target test cases, and filter out invalid target test cases to obtain a test case set;

[0030] According to the preset process, data analysis is performed on the test case set and a visual chart is generated.

[0031] In a second aspect, the present application provides a test case generation device, the device comprising:

[0032] Determination module, used to determine the target variables and test case templates;

[0033] The test case template includes a plurality of placeholders, and the placeholders are used to indicate the preset positions of the target variables in the test case;

[0034] The determination module is further used to determine the target parameter array corresponding to the target variable;

[0035] A processing module, configured to perform a Cartesian product on each of the target parameter arrays to obtain a plurality of target parameter combinations;

[0036] The processing module is further used to fill each target parameter in the target parameter combination into the test case template and output the target test case.

[0037] In a third aspect, the present application provides a computer device comprising one or more processors and a memory, wherein the memory stores computer-readable instructions, and when the computer-readable instructions are executed by the one or more processors, the steps of the method described in the first aspect are performed.

[0038] In a fourth aspect, the present application provides a storage medium storing computer-readable instructions, which, when executed by one or more processors, causes the one or more processors to perform the steps of the method described in the first aspect.

[0039] It can be seen from the above technical solutions that the embodiments of the present application have the following advantages:

[0040] Based on any of the above embodiments, the method provided by the present application can automatically combine input parameters in a Cartesian product manner to generate test cases in batches, thereby improving the test case generation efficiency and the automation level. Specifically, by determining the target variable and the test case template, it can be used as a fixed part of the test case. Subsequently, after inputting the target parameter array, the test case can be automatically filled and generated according to the content in the target parameter array. In the process of generating test cases, a plurality of target parameter combinations are obtained by performing a Cartesian product on each target parameter array, and each target parameter in the target parameter combination is filled into a pre-generated test case template to output the target test case, thereby achieving the aforementioned effect of automatically combining input parameters in a Cartesian product manner to generate test cases in batches, thereby achieving automatic batch generation of test cases and improving the efficiency and effectiveness of test case generation. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0042] Figure 1 A flowchart of a test case generation method provided by an embodiment of the present application;

[0043] Figure 2 A flowchart of a test case generation method provided by an embodiment of the present application;

[0044] Figure 3 This is a diagram of the internal structure of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0045] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0046] In the retail industry, the store merchandise management system is a core business system, involving multiple operations such as product on-shelf, off-shelf, promotion, inventory adjustment, etc. For the combination test of multiple variables such as stores, products, operations, etc., the traditional method has low generation efficiency and lacks the flexibility of rule restrictions. At the same time, the test cases need to follow the standardized output (such as Excel format), including module name, case number, preconditions, operation steps, expected results, etc., and manual writing has the risk of inefficiency and errors. Therefore, there is an urgent need for a method that can quickly generate standardized test cases for store merchandise systems and meet the specific requirements of business rules.

[0047] This application mainly targets the testing requirements of the store merchandise management system, and provides a test case generation method based on Cartesian product, which supports the rapid generation of large-scale combined test cases, and can implement constraints on specific store and merchandise operations through custom rules. In addition, in some embodiments of this application, the generated test cases can also be exported to a preset data format to adapt to the actual test execution requirements. With respect to some feasible implementation methods, this application has the following features:

[0048] Templated test case generation method:

[0049] Through template definition, users can use placeholders (such as Variable Name ) to quickly configure the core fields of the test case, including module, case number, prerequisites, operation steps and expected results.

[0050] Especially for the testing needs of store merchandise management systems, it supports defining test case templates in natural language.

[0051] Variable combination generation method based on Cartesian product:

[0052] The Cartesian product algorithm is used to automatically generate all possible combinations of variables for generating large-scale test cases.

[0053] Supports flexible rule configuration, including fixed binding rules and variable restriction rules, which are used to filter invalid combinations and ensure that the generated test cases conform to the actual business logic.

[0054] Customized test scenario support for store merchandise management systems:

[0055] Supports the combined generation of multi-dimensional variables (such as stores, products, and operations) in store merchandise systems.

[0056] Design dedicated rules and templates for specific operations in retail scenarios (such as product listing and removal, promotion configuration) to improve generation efficiency and accuracy.

[0057] The present application can achieve the following technical effects, which can be found in the relevant implementation methods:

[0058] Efficient generation: Rapidly generate standardized test case content through extended template definitions and variable combinations.

[0059] Adaptable standardized output: directly generate Excel files that meet test management requirements without the need for subsequent manual sorting.

[0060] Strong flexibility: Users can customize rules to adapt to complex business scenarios.

[0061] Improve accuracy: Reduce manual entry and avoid formatting errors or missing content.

[0062] In summary, the technical concept of the present application is that the method provided by the present application can automatically combine input parameters by means of Cartesian product to generate test cases in batches, thereby improving the test case generation efficiency and automation level. Specifically, by determining the target variable and the test case template, it can be used as a fixed part of the test case. Subsequently, after inputting the target parameter array, the test case can be automatically filled and generated according to the content in the target parameter array. In the process of generating test cases, a plurality of target parameter combinations are obtained by performing a Cartesian product on each target parameter array, and each target parameter in the target parameter combination is filled into a pre-generated test case template to output the target test case, thereby achieving the aforementioned effect of automatically combining input parameters by means of Cartesian product to generate test cases in batches, thereby realizing automatic batch generation of test cases and improving the efficiency and effectiveness of test case generation.

[0063] The method provided in this application is described in detail below based on corresponding implementation methods in some practical application scenarios.

[0064] See also Figure 1 , Figure 1 A flow chart of a test case generation method provided by an embodiment of the present application is as follows: Figure 1 As shown, the method includes:

[0065] S101, determine the target variable and test case template;

[0066] The test case template includes a plurality of placeholders, and the placeholders are used to indicate the preset positions of the target variables in the test case;

[0067] The target variables and test case templates are related to specific application scenarios. For example, the various implementation methods provided in this application can be specifically applied to a store merchandise management system. The corresponding target variables and test case templates are related to specific businesses and can indicate the data processing logic corresponding to the specific business. The fixed part of the test case determined in advance can provide a basis for the subsequent batch automatic generation of test cases.

[0068] S102, determining a target parameter array corresponding to the target variable;

[0069] The target parameter array in this application may be a set of candidate values ​​based on the target variable, presented in the form of an array, and details may be referred to the relevant implementation manner.

[0070] S103, performing a Cartesian product on each of the target parameter arrays to obtain a plurality of target parameter combinations;

[0071] The Cartesian product is a relatively simple data combination method, which can traverse and combine the candidate values ​​in each target parameter array to generate multiple groups of data, thereby realizing batch generation of data based on specific application scenarios. In addition, the generation logic of the Cartesian product can be optimized based on specific business logic or execution effect, and combinations that do not meet preset requirements can be pre-screened, or the combinations can be automatically sorted, and the importance or feasibility of each combination can be indicated in advance. For details, please refer to the relevant description in some implementation methods.

[0072] S104: Fill each target parameter in the target parameter combination into the test case template, and output the target test case.

[0073] After outputting the test cases, you can also implement visual analysis of the output test case effects or generate or push them based on a specific file format. For details, see the multiple implementation methods corresponding to the following processes:

[0074] See also Figure 2 , Figure 2 A flow chart of a test case generation method provided by an embodiment of the present application is as follows: Figure 2 As shown, in a specific application scenario, as an optional implementation, the method further includes:

[0075] Output a target list corresponding to the target test case;

[0076] The target list is converted into a target file and output to a preset terminal.

[0077] After completing the batch generation of test cases, this embodiment can further output the target list corresponding to each generated target test case to push it to a preset terminal or convert the target list into a target file and output it to a preset terminal for user review, thereby improving the user experience, allowing real-time review and manual modification of specific test cases, and improving the practicality of test case generation.

[0078] As an optional implementation manner, after filling each target parameter in the target parameter combination into the test case template and outputting the target test case, the method further includes:

[0079] Determine the data validity of each of the target test cases, and filter out invalid target test cases to obtain a test case set;

[0080] According to the preset process, data analysis is performed on the test case set and a visual chart is generated.

[0081] After outputting the target test cases, this embodiment further automatically performs data validity tests on the target test cases according to the business logic and various constraints, and automatically filters out invalid target test cases to obtain a set of valid target test cases. Then, data analysis can be performed on each target test case in the test case set according to a preset process to generate and push corresponding visualization charts, thereby improving the effectiveness and practicality of test case generation.

[0082] The method provided by the present application automatically combines input parameters by means of Cartesian products to generate test cases in batches, thereby improving the efficiency and automation level of test case generation. Specifically, by determining the target variable and the test case template, it can be used as a fixed part of the test case. After the target parameter array is input later, the test case can be automatically filled and generated according to the content in the target parameter array. In the process of generating the test case, a plurality of target parameter combinations are obtained by performing Cartesian products on each target parameter array, and each target parameter in the target parameter combination is filled into the pre-generated test case template to output the target test case, thereby achieving the aforementioned effect of automatically combining input parameters by means of Cartesian products to generate test cases in batches, thereby achieving the automatic batch generation of test cases, and improving the efficiency and effectiveness of test case generation.

[0083] As an optional implementation, the target variables include stores, commodities, and operations;

[0084] Determining the test case template and the target variable includes:

[0085] Determine the module, use case number, and preconditions, and generate operation steps and expected results based on the target variables;

[0086] Among them, the attribution module is used to indicate the function of each of the test cases, the case number is used to indicate the unique identifier of each of the test cases, the precondition is used to indicate the condition for triggering the execution of each of the test cases, and the expected result is used to indicate the expected output of the operation steps corresponding to each of the test cases.

[0087] The following is a possible example based on a specific application scenario:

[0088] Attribution module: store product management

[0089] Case number: a unique identification number that supports automatic increment or user-defined rules and starts with CASE-.

[0090] Precondition: describes the prerequisites for test execution, such as "Store A has launched a product system."

[0091] Operation steps: Generate based on variable template, for example Stores right commodity implement operate .

[0092] Expected result: describes the expected output of the operation, such as "the product is successfully added and removed from the shelves, and the system status is updated correctly."

[0093] In terms of variable input, users can configure relevant variables and candidate values.

[0094] Specifically, it can be:

[0095] Input template:

[0096] Module: Store merchandise management

[0097] Use Case Number: Use Case Number

[0098] Prerequisites: Prerequisites

[0099] Operation steps: Stores right commodity implement operate

[0100] Expected results: commodity of operate The operation was successful and the status was updated correctly.

[0101] Input variables:

[0102]

[0103] The various implementation methods provided in the present application can be specifically applied to store merchandise management systems, and specific target variables include stores, merchandise, and operations. Furthermore, the process of determining the test case template may include parts such as the attribution module, case number, preconditions, operation steps, and expected results. The logical flow and specific functions of the test case are formed according to the functions of each part, and then the corresponding test case template is generated to complete the generation process of the fixed part of the test case. Subsequently, automatic filling and batch generation of test cases can be achieved, and the corresponding test cases have the logical interpretability under specific application scenarios, thereby improving the efficiency and effectiveness of test case generation.

[0104] As an optional implementation manner, before performing the Cartesian product on each of the target parameter arrays to obtain a plurality of target parameter combinations, the method further includes:

[0105] Determining parameter combination conditions according to expected input parameters of the target variable;

[0106] The parameter combination condition is used to indicate the restriction condition for combining different target parameters in the target parameter array.

[0107] As in the application scenario described above, the parameter combination conditions may include: Store A only supports operations on product 1 and product 2. Store C only supports operation 1 "put on the shelf".

[0108] In addition, if Figure 2 As shown, the method also includes the following implementation details:

[0109] Test case generation: Generate all possible combinations based on Cartesian product and filter invalid combinations according to the rules.

[0110] Excel file export: Output test cases according to the standardized field structure, with each row corresponding to a complete test case.

[0111] Automatic numbering rules: Supports generating case numbers with fixed prefixes and incremental numbers, such as CASE-001, CASE-002. The numbering rules are configurable.

[0112] Thus, a feasible parameter combination can be determined according to the conditional restrictions to execute S104, fill each target parameter in the target parameter combination into the test case template, and output the process of the target test case. A feasible execution effect is shown in Table 1:

[0113] Table 1

[0114]

[0115] This embodiment can also determine the restriction conditions that can or cannot be combined between the parameters in the target parameter array according to the expected input parameters corresponding to the target variables, or according to the business logic and specific business requirements corresponding to the target variables in specific application scenarios before performing Cartesian products on the target parameter arrays to obtain multiple target parameter combinations for batch generation of test cases. This improves the interpretability of the test cases, and further improves the efficiency and effectiveness of test case generation.

[0116] As an optional implementation manner, before determining the parameter combination condition according to the expected input parameters of the target variable, the method further includes:

[0117] Determine the store business scenario indicated by each of the target variables;

[0118] According to the store business scenario, association rules for each of the target variables are determined, and expected input parameters for each of the target variables are determined according to the association rules.

[0119] In this implementation, before determining the parameter combination conditions based on the expected parameters, the store business scenarios indicated by the target variables and the combinations corresponding to the target variables are first determined, and then the association rules of the target variables are determined based on the store business scenarios. The reasonable expected input parameters of each target variable under the association rules are further determined, thereby improving the effectiveness and interpretability of the test cases in the corresponding business scenarios.

[0120] As an optional implementation manner, determining the association rules of the target variables according to the store business scenario includes:

[0121] According to the execution results of historical test cases, adjusting the association rules of each of the target variables;

[0122] The method further comprises:

[0123] According to the adjusted association rules, adjusting the expected input parameters of each of the target variables;

[0124] Modify the parameter combination conditions based on the adjusted expected input parameters.

[0125] In the process of determining the association rules of each target variable, in addition to the influence of the business logic itself, the association rules of each target variable can be adjusted according to the execution results and corresponding parameters of the historical test cases generated under each association rule, and the corresponding adjustment and generation process can be executed according to the adjusted association rules in subsequent steps, thereby further improving the effectiveness and interpretability of the test cases in the corresponding business scenarios.

[0126] For example, the following are some examples of Cartesian product optimization in some relevant application scenarios:

[0127] First, Cartesian product application combined with business semantics:

[0128] Integrate retail business logic to deeply analyze variable relationships;

[0129] Data-driven business rule mining establishes a special business data analysis module to extract information from the massive transaction data, inventory change data, user purchase behavior data, and marketing activity data of the store commodity management system on a regular basis (e.g., once a week). Use data mining algorithms (such as the Apriori algorithm and FP-Growth algorithm for association rule mining) to deeply analyze the potential relationship between different variables. For example, by analyzing the sales combination of different types of stores (classified by scale, location, and business category characteristics) and various types of commodities (subdivided into brands, categories, and price ranges) in the past year, it was found that "small fashion stores located on commercial pedestrian streets" frequently have a strong correlation sales model with "mid-to-high-end trendy women's clothing brands with a price range of 300-800 yuan". Such strong association rules are used as important constraints for the Cartesian product to generate variable combinations.

[0130] Combine machine learning classification algorithms (such as decision trees and random forests) to model and train product operation types (listing, delisting, price adjustment, promotion configuration, etc.) and store and product attributes. Based on historical operation records and corresponding business results (such as sales growth, inventory turnover rate improvement, profit change and other indicators), let the model learn which store-product combination is suitable for which operation strategy, so that when the Cartesian product is generated, it can accurately generate variable combinations according to business goals (such as improving the inventory turnover rate of a certain type of product or increasing sales in a specific store). For example, the model learns that in tourist scenic area stores, large-scale listing and promotion configuration operations of special souvenir products near holidays can significantly increase sales, so when generating test cases in the relevant time period, focus on this type of combination.

[0131] Dynamic business semantic adaptation mechanism develops sensor-type functional components that monitor business dynamic changes in real time. It can capture the immediate impact of market trends, seasonal changes, emergencies and other factors on store merchandise business and convert them into dynamic variable labels. For example, when social media monitors that a certain online celebrity fashion item suddenly becomes popular, the system quickly labels the relevant fashion category products with the "potential for online celebrity hits" label; when the weather forecast predicts that a certain area will experience a significant drop in temperature, the "expected surge in demand" label is added to the winter clothing category products in the stores in that area.

[0132] The Cartesian product generation engine obtains these dynamic tags in real time and combines them with static variables such as stores, products, and operations to generate combinations. For example, products with the label "potential for popular online products" will be combined with stores that are good at trendy marketing and aggressive promotional operations (such as limited-time ultra-low discounts, buy one get one free, etc.) to generate test cases, ensuring that the system can adapt to the ever-changing retail market in a timely manner and test the effectiveness of business processes in response to emerging business opportunities.

[0133] Dynamically adjust variable ranges based on retail scenarios;

[0134] The retail calendar module is built with variables driven by seasons and promotion cycles, and contains key time information such as the annual season division, statutory holidays, e-commerce shopping festivals, and brand-owned promotion nodes. As the calendar progresses, the system automatically identifies the current season or promotion cycle, such as summer, the Double Eleven Shopping Festival, etc.

[0135] According to different time periods, the range of commodity variables participating in the Cartesian product is dynamically adjusted. In summer, popular summer commodities such as swimsuits, cold drinks, and sunscreen products are included in the key variable set; during the Double Eleven period, all commodities suitable for participating in the big promotion (such as high-profit, high-inventory, popular hot items, etc.) are used as core variables. At the same time, operational variables are adapted according to the characteristics of different promotion cycles. For example, the 618 e-commerce festival may focus on complex promotion rule configuration operations such as cross-store full reduction and red envelope rain, while daily weekend small promotions focus on simple discounts, full gifts and other operations and the combination of commodities and stores.

[0136] The store operation status trigger variable adjustment is connected to the store real-time data collection system to obtain the store's real-time operation status information, including customer flow, sales, inventory level, employee scheduling, etc. When the customer flow of a store is lower than the threshold for 2 consecutive hours (such as less than 50 people per hour), it is judged as a slow business period. At this time, the store is combined with clearance sales, low-cost traffic-generating products, and simplified operation processes (such as quickly removing slow-selling products and temporarily adjusting the display layout of goods) to generate test cases, aiming to test the system's ability to assist stores in coping with business difficulties.

[0137] If the store is newly opened, based on the characteristics of the new store, select variables such as the novice guided listing process, opening promotion configuration, and new employee training related operations, and combine them with the new store and basic products to test the system's support functions for the new store opening preparations and initial operations, and ensure that the system flexibly matches the needs of each store at different operation stages.

[0138] The second aspect is the optimization of rule configuration, which may specifically include intelligent learning and adaptive rule optimization.

[0139] A rule optimization system based on a reinforcement learning framework (such as Q-learning, deep Q network, etc.) is designed based on the rule evolution model of reinforcement learning. After each test case is executed, a reward or penalty signal is given to the current Cartesian product generation rule based on the test results (such as the severity of the system defects found, the number of business process interruptions, the cost of repair and other indicators). If the generated test case successfully finds a serious system vulnerability, resulting in a business suspension of more than 1 hour, a large penalty is given to the rule to prompt it to adjust to avoid the subsequent generation of similar invalid or low-value combinations; conversely, if the test case efficiently verifies that there are no abnormalities in the key business path, a reward is given to strengthen the rule strategy.

[0140] The model is constantly iterating, and gradually learns to generate the optimal variable combination rules in different business scenarios (such as new product launch promotion, store inventory inventory season, etc.). For example, after multiple reinforcement learning, the model has learned that when a new product is launched, it should give priority to combining the new product with stores with new product promotion experience, omni-channel publicity and promotion operations, and strict inventory monitoring operations, to ensure the smooth entry of new products to the market to the greatest extent, improve the new product success rate index, and realize the automatic evolution of rules with actual business experience.

[0141] Collaborative filtering auxiliary rule customization introduces collaborative filtering algorithms to collect operational preferences and evaluation feedback data from different project teams (development, testing, business operations, etc.) in the process of using Cartesian products to generate test cases. For example, the development team may pay more attention to the variable combinations corresponding to high-risk modules at the code level.

[0142] The third aspect is to integrate data-driven and Cartesian product optimization:

[0143] Variable weight allocation based on big data analysis;

[0144] Multi-dimensional data integration and indicator construction integrates the internal database of the store product management system, data warehouse, external market research reports, industry dynamic information and other multi-source data. Internal data covers detailed records of transaction flows (including product details, purchase time, store location, payment method, etc. for each order), inventory life cycle data (warehousing time, batch, shelf life, inventory change track), user behavior logs (browsing, searching, collecting, adding to cart, etc., linking products and stores); external data involves price trends of competing products of the same type, market share changes, consumer preference research reports, etc.

[0145] Key indicators are extracted from the data for weight calculation, such as profit contribution of goods (the proportion of net profit of a certain product in a specific store in the past quarter, calculated by (selling price - cost) * sales volume, with a weight of 30%), sales volatility (using standard deviation to measure sales fluctuations in the past six months, large fluctuations mean that risks and opportunities coexist, with a weight of 20%), inventory health (inventory backlog days or the inverse of inventory turnover rate, reflecting the difficulty of inventory management, with a weight of 15%), market popularity (external search index, social media discussion volume converted into numerical values, with a weight of 10%) and user loyalty correlation (weighted scores of old customer repurchase rate and recommendation rate, with a weight of 5%), etc., to build a comprehensive evaluation system and comprehensively consider the importance of variables.

[0146] Dynamic weight update mechanism establishes a weight update mechanism that combines regular (such as the low-peak period of the system from 2 to 5 a.m. on the first day of each month) and event triggers (such as new product launches, the end of major promotional activities, and major public opinion in the market). The monthly routine update recalculates the values ​​of each indicator based on the complete business data of the previous month and adjusts the weight coefficient; when new products are launched, due to the lack of historical sales data, a higher weight (such as 40%) is initially given to the market heat and potential user demand matching, and gradually transitions to a regular weight system as sales data accumulates; after the promotion ends, immediately analyze the performance of each product and store during the event period, and adjust the weights of the variable combinations with abnormal or abnormal performance, quickly respond to market changes, and ensure that the Cartesian product generation always focuses on key business scenarios.

[0147] Using data mining to discover implicit variable relationships to assist in Cartesian product generation;

[0148] Advanced applications of deep association rule mining use improved Eclat algorithms or graph database-based association rule mining technology to break through the traditional limitation of mining only binary variable relationships and mine complex associations of multiple variables (three or more). For example, it is found that "emerging community stores in specific areas + emerging national trend brand sportswear + social media influencer cooperation + school season promotion period" have a strong association, that is, such community stores can achieve sales blowouts by promoting emerging national trend sports brands with the help of influencers during the school season. The mining results are visualized as a multi-level association network diagram, with nodes as variables and the thickness of the connection line proportional to the strength of the association, which is convenient for intuitive insight into complex business logic.

[0149] The mined multivariate association rules are converted into Cartesian products to generate constraints or guiding strategies, with priority given to combinations that conform to strong correlation patterns. At the same time, exploratory parameters are set (such as a probability threshold of 5%) to occasionally generate combinations that deviate from strong correlations but have potential innovative value, taking into account both stability and innovative testing needs, helping to discover hidden business growth opportunities and potential system risk points.

[0150] Sequential pattern mining Mining dynamic associations Use sequential pattern mining algorithms (such as PrefixSpan) to analyze the dynamic associations of product operations, store operating status, and market environment changes over time. For example, mining a typical sequential pattern of "Store A has a backlog of a certain category of goods for two consecutive months -> Headquarters issued a clearance order -> Stores implemented combined promotions (buy one get one free + cross-category discounts) and employee sales incentives -> Inventory returned to a healthy level" means that the system needs to focus on testing this type of dynamic operation combination response capabilities in the inventory backlog scenario.

[0151] Generate dynamic Cartesian product rules based on sequence patterns, and adjust the variable combination priority according to the business process evolution stage. When the system detects an inventory backlog warning signal, it automatically increases the corresponding clearance operation, promotion configuration and other variable combination weights, prompting the generation of targeted test cases to ensure that the system can adapt to the business dynamics and orderly flow, resolve potential operational crises in advance, and ensure business continuity and stability.

[0152] Fourthly, Cartesian product optimization from the perspective of cross-system interaction can consider the expansion of variable sets associated with upstream and downstream systems:

[0153] The full-link variable integration of the supply chain will deeply connect and interact with the store product management system with the upstream supplier management system (covering variables such as supplier qualifications, production capacity, supply cycle, raw material quality control, etc.), the downstream sales terminal system (such as checkout efficiency, customer queue time, mobile APP interaction fluency, real-time update accuracy of electronic shelf labels, etc.) and the logistics distribution system (logistics carrier service quality score, delivery timeliness compliance rate, cargo damage and loss rate, distribution route planning rationality, etc.).

[0154] Build a unified data model and include cross-system key variables into the Cartesian product core variable pool. For example, when generating test cases, combine the risk of delayed raw material supply from suppliers and the inventory warning of a certain product in the store, with the combination of logistics expedited delivery options and store emergency replenishment operations, to comprehensively test the system's emergency coordination capabilities in supply chain disruption scenarios; or associate the payment jams of sales terminal users with the complexity of product promotion rules to examine the system's ability to ensure smooth business and data consistency under high concurrent transaction pressure, and achieve expansion from single store product management to full supply chain ecosystem testing.

[0155] Strengthening of business process breakpoint connection variables Through business process combing and data analysis, we can accurately locate the breakpoints, bottlenecks and risk points in the cross-system interaction process, and introduce connection variables to strengthen the Cartesian product coverage. For example, in the store product return process, it is found that in the link of "customer initiates return application at sales terminal -> store review -> product return to warehouse -> supplier confirms receipt -> financial refund settlement", "store and supplier return product information verification" often makes mistakes, and the details of the verification information (accurate to single product batch, quality defect labeling, etc.), verification method (manual comparison, system automatic verification, third-party quality inspection intervention) and communication frequency (real-time synchronization, daily scheduled summary) are strengthened.

[0156] In addition, in some related scenarios, the fifth aspect, optimization of simulating real user behavior scenarios, can also be included:

[0157] Variable combination generation based on user portraits;

[0158] The dynamic user portrait label system integrates transaction data, member information, marketing interaction records in the store product management system, external social media monitoring data, and market research data to build a dynamic, multi-dimensional user portrait label system. Labels cover basic attributes (age, gender, region), consumer preferences (category preferences, brand loyalty, price sensitivity), purchasing power (income range, consumption frequency, customer unit price), social behavior (social media activity, word-of-mouth communication influence, community participation) and life cycle stage (new customers, growing customers, mature customers, churn warning customers) and other categories, and each label regularly (weekly or monthly) updates the weight and value range based on real-time data.

[0159] For example, in the beauty category, by analyzing user purchase records and hot topics of social media discussions, young female users who are keen on natural beauty products, frequently participate in online beauty tutorial sharing, and have made multiple purchases recently are labeled with a composite label of "young beauty expert - natural skin care preference - high consumption frequency - strong social communication ability". This accurately outlines user characteristics, provides a delicate portrait basis for Cartesian product generation, and ensures that the variable combination fits the real user's micro-needs.

[0160] The precise variable screening and combination design driven by the portrait is based on the variable screening algorithm of the user portrait label, giving priority to the selection of stores, products and operation variables that are strongly associated with the target user portrait. For example, for stores targeting young and fashionable groups, combined with the popular trendy brand preferences and high impulse consumption tendencies in their audience portraits, variables such as popular trendy brand new products of the season, limited-time purchases, and personalized recommendation configurations are screened for combination; for stores with a concentration of high-net-worth mature customers, high-end customized products, exclusive member service upgrade operations (such as one-on-one private shopping guide appointments, exclusive lounge access rights configuration) and store high-end display adjustments are selected and matched with other variables to simulate the real consumption experience of users at different levels, accurately locate the shortcomings of the system service capabilities, and improve user satisfaction targeted testing.

[0161] Introducing random factors to simulate real usage uncertainty;

[0162] The probabilistic misoperation simulation mechanism establishes a misoperation probability model and sets the probability of various misoperations based on real user behavior survey data. For example, in the product search scenario, the probability of no search results or wrong results due to ambiguous or misspelled keywords is set at 5%; when adding to the shopping cart, the probability of abnormal increase in quantity due to multiple missed clicks is about 3%; in the settlement payment process, the probability of retrying payment failure due to network fluctuations or operation interruptions is set at 7%, etc.

[0163] When Cartesian product generation involves combinations of operating variables, erroneous operating variables are randomly injected according to probability. For example, abnormal value combinations such as "uploaded image format error" and "price input exceeds a reasonable range" are occasionally added to the product listing process to ensure that the system stability and fault tolerance test covers unexpected situations in daily use, making the test scenario more realistic and resolving potential user complaint risk points in advance.

[0164] The random environmental interference factors are integrated to consider the interference of the real store operation environment, such as network signal fluctuations (simulating the network strength in different regions, randomly switching from weak signal 2G to strong signal 5G, and network delay fluctuating between 100 milliseconds and 5 seconds), slow response during peak hours of the system (setting a specific time period every day such as 8-10 pm, the order volume soars, causing the system to process slowly), and equipment failures (such as occasional freezes of store cash registers, barcode scanner recognition errors, and the probability of failure is set according to the historical failure rate) and other factors, and quantify them into a combination of environmental variables and conventional business variables. For example, generate test cases to simulate customers using faulty cash registers to buy promotional products in stores with poor networks during peak hours, observe the system's full-process response, and hone the system's reliability in complex and changeable real-world scenarios, ensure uninterrupted business and services, and comprehensively improve the user's smooth shopping experience.

[0165] The present application also provides a test case generation device, the device comprising:

[0166] Determination module, used to determine the target variables and test case templates;

[0167] The test case template includes a plurality of placeholders, and the placeholders are used to indicate the preset positions of the target variables in the test case;

[0168] The determination module is further used to determine the target parameter array corresponding to the target variable;

[0169] A processing module, configured to perform a Cartesian product on each of the target parameter arrays to obtain a plurality of target parameter combinations;

[0170] The processing module is further used to fill each target parameter in the target parameter combination into the test case template and output the target test case.

[0171] This embodiment automatically combines input parameters by means of Cartesian product to generate test cases in batches, thereby improving the efficiency and automation level of test case generation. Specifically, by determining the target variable and the test case template, it can be used as a fixed part of the test case. After the target parameter array is subsequently input, the test case can be automatically filled and generated according to the content in the target parameter array. In the process of generating the test case, a plurality of target parameter combinations are obtained by performing Cartesian product on each target parameter array, and each target parameter in the target parameter combination is filled into the pre-generated test case template to output the target test case, thereby achieving the aforementioned effect of automatically combining input parameters by means of Cartesian product to generate test cases in batches, thereby achieving the automatic batch generation of test cases and improving the efficiency and effectiveness of test case generation.

[0172] As an optional implementation, the target variables include stores, commodities, and operations;

[0173] The specific manner in which the determination module determines the test case template and the target variable includes:

[0174] Determine the module, use case number, and preconditions, and generate operation steps and expected results based on the target variables;

[0175] Among them, the attribution module is used to indicate the function of each of the test cases, the case number is used to indicate the unique identifier of each of the test cases, the precondition is used to indicate the condition for triggering the execution of each of the test cases, and the expected result is used to indicate the expected output of the operation steps corresponding to each of the test cases.

[0176] The various implementation methods provided in the present application can be specifically applied to store merchandise management systems, and specific target variables include stores, merchandise, and operations. Furthermore, the process of determining the test case template may include parts such as the attribution module, case number, preconditions, operation steps, and expected results. The logical flow and specific functions of the test case are formed according to the functions of each part, and then the corresponding test case template is generated to complete the generation process of the fixed part of the test case. Subsequently, automatic filling and batch generation of test cases can be achieved, and the corresponding test cases have the logical interpretability under specific application scenarios, thereby improving the efficiency and effectiveness of test case generation.

[0177] As an optional implementation, the determining module is further configured to, before the processing module performs a Cartesian product on each of the target parameter arrays to obtain a plurality of target parameter combinations,

[0178] Determining parameter combination conditions according to expected input parameters of the target variable;

[0179] The parameter combination condition is used to indicate the restriction condition for combining different target parameters in the target parameter array.

[0180] This embodiment can also determine the restriction conditions that can or cannot be combined between the parameters in the target parameter array according to the expected input parameters corresponding to the target variables, or according to the business logic and specific business requirements corresponding to the target variables in the specific application scenario, before performing Cartesian product on each of the target parameter arrays to obtain multiple target parameter combinations for batch generation of test cases. This improves the interpretability of the test cases, and further improves the efficiency and effectiveness of test case generation.

[0181] As an optional implementation, the processing module is further configured to, before the determining module determines the parameter combination condition according to the expected input parameters of the target variable,

[0182] Determine the store business scenario indicated by each of the target variables;

[0183] According to the store business scenario, association rules for each of the target variables are determined, and expected input parameters for each of the target variables are determined according to the association rules.

[0184] In this implementation, before determining the parameter combination conditions based on the expected parameters, the store business scenarios indicated by the target variables and the combinations corresponding to the target variables are first determined, and then the association rules of the target variables are determined based on the store business scenarios. The reasonable expected input parameters of each target variable under the association rules are further determined, thereby improving the effectiveness and explainability of the test cases in the corresponding business scenarios.

[0185] As an optional implementation, the processing module determines the specific manner of the association rule of each target variable according to the store business scenario, including:

[0186] According to the execution results of historical test cases, adjusting the association rules of each of the target variables;

[0187] The processing module is also used for:

[0188] According to the adjusted association rules, adjusting the expected input parameters of each of the target variables;

[0189] Modify the parameter combination conditions based on the adjusted expected input parameters.

[0190] In the process of determining the association rules of each target variable, in addition to the influence of the business logic itself, the association rules of each target variable can be adjusted according to the execution results and corresponding parameters of the historical test cases generated under each association rule, and the corresponding adjustment and generation process can be executed according to the adjusted association rules in subsequent steps, thereby further improving the effectiveness and interpretability of the test cases in the corresponding business scenarios.

[0191] As an optional implementation, the processing module is further configured to:

[0192] Output a target list corresponding to the target test case;

[0193] The target list is converted into a target file and output to a preset terminal.

[0194] After completing the batch generation of test cases, this embodiment can further output the target list corresponding to each generated target test case to push it to a preset terminal or convert the target list into a target file and output it to a preset terminal for user review, thereby improving the user experience, allowing real-time review and manual modification of specific test cases, and improving the practicality of test case generation.

[0195] As an optional implementation, the processing module is further used to fill each target parameter in the target parameter combination into the test case template, and after outputting the target test case,

[0196] Determine the data validity of each of the target test cases, and filter out invalid target test cases to obtain a test case set;

[0197] According to the preset process, data analysis is performed on the test case set and a visual chart is generated.

[0198] After outputting the target test cases, this embodiment further automatically performs data validity tests on the target test cases according to the business logic and various constraints, and automatically filters out invalid target test cases to obtain a set of valid target test cases. Then, data analysis can be performed on each target test case in the test case set according to a preset process to generate and push corresponding visualization charts, thereby improving the effectiveness and practicality of test case generation.

[0199] It should be noted that it should be understood that the division of the various modules of the above device is only a division of logical functions. In actual implementation, they can be fully or partially integrated into one physical entity, or they can be physically separated. And these modules can all be implemented in the form of software called by processing elements; they can also be all implemented in the form of hardware; some modules can also be implemented in the form of software called by processing elements, and some modules can be implemented in the form of hardware. For example, the processing module can be a separately established processing element, or it can be integrated in a chip of the above device. In addition, it can also be stored in the memory of the above device in the form of program code, and called and executed by a processing element of the above device. The function of the above-determined module. The implementation of other modules is similar. In addition, these modules can be fully or partially integrated together, or they can be implemented independently. The processing element here can be an integrated circuit with signal processing capabilities. In the implementation process, each step of the above method or each module above can be completed by an integrated logic circuit of hardware in the processor element or instructions in the form of software.

[0200] Indicatively, Figure 3 As shown, Figure 3 This is a schematic diagram of the internal structure of a computer device provided in an embodiment of the present application. The computer device 300 may be provided as a server. Figure 3 , the computer device 300 includes a processing component 302, which further includes one or more processors, and a memory resource represented by a memory 301, for storing instructions that can be executed by the processing component 302, such as an application. The application stored in the memory 301 may include one or more modules, each corresponding to a set of instructions. In addition, the processing component 302 is configured to execute instructions to perform the method of any of the above embodiments.

[0201] The computer device 300 may further include a power supply component 303 configured to perform power management of the computer device 300, a wired or wireless network interface 304 configured to connect the computer device 300 to a network, and an input / output (I / O) interface 305. The computer device 300 may operate based on an operating system stored in the memory 301, such as Windows Server TM, Mac OS X TM, Unix TM, Linux TM, Free BSD TM, or the like.

[0202] Those skilled in the art will understand that Figure 3 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0203] An embodiment of the present application provides a storage medium, in which computer-readable instructions are stored. When the computer-readable instructions are executed by one or more processors, the one or more processors execute a method provided in any embodiment.

[0204] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.

[0205] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The various embodiments can be combined as needed, and the same or similar parts can refer to each other.

[0206] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A test case generation method, characterized in that: The method comprises: Determine target variables and test case templates; The test case template includes a plurality of placeholders, and the placeholders are used to indicate the preset positions of the target variables in the test case; Determine a target parameter array corresponding to the target variable; Performing a Cartesian product on each of the target parameter arrays to obtain a plurality of target parameter combinations; Fill each target parameter in the target parameter combination into the test case template and output the target test case.

2. The method according to claim 1, characterized in that The target variables include stores, products, and operations; Determining the test case template and the target variable includes: Determine the module, use case number, and preconditions, and generate operation steps and expected results based on the target variables; Among them, the attribution module is used to indicate the function of each of the test cases, the case number is used to indicate the unique identifier of each of the test cases, the precondition is used to indicate the condition for triggering the execution of each of the test cases, and the expected result is used to indicate the expected output of the operation steps corresponding to each of the test cases.

3. The method according to claim 1, characterized in that Before performing Cartesian product on each of the target parameter arrays to obtain a plurality of target parameter combinations, the method further includes: Determining parameter combination conditions according to expected input parameters of the target variable; The parameter combination condition is used to indicate the restriction condition for combining different target parameters in the target parameter array.

4. The method according to claim 3, characterized in that Before determining the parameter combination conditions according to the expected input parameters of the target variable, the method further includes: Determine the store business scenario indicated by each of the target variables; According to the store business scenario, association rules for each of the target variables are determined, and expected input parameters for each of the target variables are determined according to the association rules.

5. The method according to claim 4, characterized in that Determining association rules of the target variables according to the store business scenario includes: According to the execution results of historical test cases, adjusting the association rules of each of the target variables; The method further comprises: According to the adjusted association rules, adjusting the expected input parameters of each of the target variables; Modify the parameter combination conditions based on the adjusted expected input parameters.

6. The method according to any one of claims 1 to 5, characterized in that: The method further comprises: Output a target list corresponding to the target test case; The target list is converted into a target file and output to a preset terminal.

7. The method according to any one of claims 1 to 5, characterized in that: After filling each target parameter in the target parameter combination into the test case template and outputting the target test case, the method further includes: Determine the data validity of each of the target test cases, and filter out invalid target test cases to obtain a test case set; According to the preset process, data analysis is performed on the test case set and a visual chart is generated.

8. A test case generating device, characterized in that: The device comprises: Determination module, used to determine the target variables and test case templates; The test case template includes a plurality of placeholders, and the placeholders are used to indicate the preset positions of the target variables in the test case; The determination module is further used to determine the target parameter array corresponding to the target variable; A processing module, configured to perform a Cartesian product on each of the target parameter arrays to obtain a plurality of target parameter combinations; The processing module is further used to fill each target parameter in the target parameter combination into the test case template and output the target test case.

9. A computer device, characterized in that: The method comprises one or more processors and a memory, wherein the memory stores computer-readable instructions, and when the computer-readable instructions are executed by the one or more processors, the steps of the method according to any one of claims 1 to 7 are performed.

10. A storage medium, characterized in that: The storage medium stores computer-readable instructions, and when the computer-readable instructions are executed by one or more processors, the one or more processors execute the steps of the method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Implementation method and device for telecommunication charging service automatic testing

    CN111240983A

  • Interface testing method, device, equipment and medium

    CN117033234A

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

    CN118484375A

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

    CN119127659A

  • Systems and methods for managing testing functionalities

    US20100299561A1

Cited By

  • A graphical management method and system of EDA simulation flow based on declarative specification

    CN122616444A