Test case generation method, device and equipment and storage medium

By automatically combining input parameters through the Cartesian product algorithm, test cases for the retail industry's store merchandise management system are generated, which solves the problems of low generation efficiency and insufficient flexibility in existing technologies and realizes efficient and standardized test case generation.

CN119807076BActive Publication Date: 2025-10-17创优数字科技(广东)有限公司
View PDF 2 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

Existing technologies for generating test cases for store merchandise management systems in the retail industry suffer from low efficiency and inflexibility. Manual writing is inefficient and carries the risk of errors, making it difficult to meet specific business needs.

Method used

It uses the Cartesian product algorithm to automatically combine input parameters. By determining the target variables and test case templates, it generates multiple target parameter combinations, fills them into the test case template, and outputs the target test case. It supports flexible rule configuration and standardized output.

Benefits of technology

It achieves efficient generation and automated batching of test cases, improves generation efficiency and effectiveness, reduces manual input steps, and reduces the risk of errors.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119807076B_ABST
    Figure CN119807076B_ABST
Patent Text Reader

Abstract

The application provides a test case generation method and device, equipment and a storage medium. The input parameters are automatically combined in a Cartesian product manner to batch generate test cases, improve the test case generation efficiency and automation level, and determine the target variables and test case templates, which can be used as the 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 the test case, the Cartesian product is also performed on each target parameter array to obtain multiple target parameter combinations, and each target parameter in the target parameter combination is filled into the pre-generated test case template to output the target test case. Thus, the effect of automatically combining the input parameters in the Cartesian product manner to batch generate the test case is achieved, and the test case is automatically batch generated, thereby improving the test case generation efficiency and effectiveness.
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 and device, equipment and storage medium. BACKGROUND

[0002] In the retail industry, the store commodity management system is the core business system, involving goods on and off the shelf, promotion, inventory adjustment and other operations. In terms of test cases, for the combination test of multiple variables such as stores, goods and operations, the traditional method is low in efficiency, and the flexibility of adjusting to actual needs is not high. At the same time, the test case needs to follow the standardized output, including module name, case number, preconditions, operation steps, expected results and other contents, and manual writing has the problems of low efficiency and the risk of errors. Therefore, a test case generation method is needed, which can quickly generate standardized test cases for store commodity systems and meet the specific needs of specific business conditions, that is, to improve the efficiency and effectiveness of test case generation. SUMMARY

[0003] The purpose of the present application is to at least solve one of the above technical defects, in particular the technical defect that the test case generation efficiency and effectiveness are not high in the prior art.

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

[0005] determining a target variable and a test case template;

[0006] The test case template includes a plurality of placeholders, and the placeholder is used to indicate the preset position of the target variable in the test case.

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

[0008] performing Cartesian product on each target parameter array to obtain a plurality of target parameter combinations;

[0009] filling each target parameter in the target parameter combination into the test case template to output a target test case.

[0010] As an optional implementation, the target variable includes a store, a good and an operation.

[0011] The determination of the test case template and the target variable comprises:

[0012] determining the home module, the case number, the preconditions, and generating the operation steps and the expected results according to the target variable;

[0013] The home module is used to indicate the function of each test case, the case number is used to indicate the unique identification of each test case, the precondition is used to indicate the condition for triggering the execution of each test case, and the expected result is used to indicate the expected output of the operation step corresponding to each test case.

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

[0015] According to the expected input parameter of the target variable, determine the parameter combination condition.

[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, before the step of determining the parameter combination condition according to the expected input parameter of the target variable, the method further comprises:

[0018] Determine the store business scenario indicated by each target variable.

[0019] According to the store business scenario, determine the association rule of each target variable, and determine the expected input parameter of each target variable according to the association rule.

[0020] As an optional implementation, the step of determining the association rule of each target variable according to the store business scenario comprises:

[0021] According to the execution result of the historical test case, adjust the association rule of each target variable;

[0022] The method further comprises:

[0023] According to the adjusted association rule, adjust the expected input parameter of each target variable;

[0024] According to the adjusted expected input parameter, modify the parameter combination condition.

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

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

[0027] Convert the target list into a target file and output it to a preset terminal.

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

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

[0030] perform data analysis on the test case set according to a preset procedure, and generate a visual chart.

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

[0032] a determination module configured to determine a target variable and a test case template;

[0033] The test case template comprises a plurality of placeholders, and the placeholders are used to indicate preset positions of the target variable in the test case.

[0034] The determination module is further configured to determine a target parameter array corresponding to the target variable.

[0035] A processing module is 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 configured to fill each target parameter in the target parameter combination into the test case template, and output a 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 the computer readable instructions are executed by the one or more processors to perform the steps of the method according to the first aspect.

[0038] In a fourth aspect, the present application provides a storage medium, wherein the storage medium stores computer readable instructions, and the computer readable instructions are executed by one or more processors to cause the one or more processors to perform the steps of the method according to the first aspect.

[0039] From the above technical solutions, the embodiments of the present application have the following advantages:

[0040] Based on any of the above embodiments, the method provided in the present application can automatically combine the input parameters in a Cartesian product manner to generate test cases in batches, thereby improving the test case generation efficiency and automation level. Specifically, by determining the target variables and the test case template, the test case template 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 the test case, the Cartesian product of each target parameter array is performed to obtain a plurality of target parameter combinations, and each target parameter in the target parameter combination is filled into the pre-generated test case template to output the target test case. In this way, the effect of automatically combining the input parameters in a Cartesian product manner to generate test cases in batches is achieved, and the test cases are automatically generated in batches, thereby improving the test case generation efficiency and effectiveness. BRIEF DESCRIPTION OF DRAWINGS

[0041] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the drawings needed in the embodiments or prior art description will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.

[0042] Figure 1 The flowchart of the test case generation method provided by an embodiment of the present application is shown in the figure.

[0043] Figure 2 The flowchart of the test case generation method provided by an embodiment of the present application is shown in the figure.

[0044] Figure 3 The internal structure diagram of the computer device provided by the embodiment of the present application is shown in the figure. DETAILED DESCRIPTION

[0045] The technical solutions in the embodiments of the present application will be described clearly and completely in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only some of the embodiments of the present application, not all. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor are within the scope of protection of the present application.

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

[0047] The present application mainly aims at the test requirements of store merchandise management system, and provides a test case generation method based on Cartesian product, which supports fast generation of large-scale combination test cases and can realize the constraint of specific store and goods operation through custom rules. In addition, some embodiments of the present application can also export the generated test cases to a preset data format to adapt to the actual test execution requirements. Compared with some feasible implementations, the present application has the following characteristics:

[0048] Template test case generation method:

[0049] Through template definition, users can quickly configure the core fields of test cases in the form of placeholders (such as variable name ) including module, case number, preconditions, operation steps and expected results.

[0050] Especially for the test requirements of store merchandise management system, it supports defining test case templates in natural language form.

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

[0052] Using Cartesian product algorithm, all possible combinations of variables are automatically generated to generate large-scale test cases.

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

[0054] Support for customized test scenarios of store merchandise management system:

[0055] Support the combination generation of multi-dimensional variables (such as store, goods and operation) in store merchandise system.

[0056] Design special rules and templates for specific operations in retail scenarios (such as goods on and off the shelf, promotion activity configuration) to improve generation efficiency and accuracy.

[0057] The present application can achieve the following technical effects, which can be seen from the related embodiments:

[0058] Efficient generation: through extended template definition and variable combination, standardized test case content is quickly generated.

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

[0060] Flexibility: users can customize rules to adapt to complex business scenarios.

[0061] Improve accuracy: reduce manual input steps and avoid format errors or omissions.

[0062] In summary, the technical concept of the present application is that the method provided by the present application can automatically combine input parameters in a Cartesian product manner to generate test cases in batches, improving test case generation efficiency and automation level. Specifically, by determining the target variables and test case templates, the test case templates can be used as the 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 the test case, Cartesian product is performed on each target parameter array to obtain multiple target parameter combinations, and each target parameter in the target parameter combination is filled into the pre-generated test case template to output the target test case. Thus, the effect of automatically combining input parameters in a Cartesian product manner to generate test cases in batches is achieved, which realizes automatic batch generation of test cases and improves test case generation efficiency and effectiveness.

[0063] The method provided by the present application will be described in detail below according to the corresponding embodiments in some practical application scenarios.

[0064] Please refer to Figure 1 , Figure 1 The flowchart of the test case generation method provided by an embodiment of the present application is shown in Figure 1 , which includes the following steps:

[0065] S101, determine target variables and test case templates;

[0066] The test case template includes a plurality of placeholders, and the placeholder is used to indicate the preset position of the target variable in the test case.

[0067] The target variable and the test case template are related to a specific application scenario, for example, the embodiments provided in the present application can be applied to a store commodity management system, and the corresponding target variable and test case template are related to a specific business, 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 subsequent batch automatic generation of test cases.

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

[0069] The target parameter array in the present application can be a group of candidate values based on the target variable, presented in the form of an array. For details, see the related embodiments.

[0070] S103, perform Cartesian product on each target parameter array 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 a plurality of groups of data, thereby realizing batch generation of data based on a specific application scenario. 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 the preset requirements can be pre-screened, or each combination can be automatically sorted, and the importance or feasibility of each combination can be indicated in advance. For details, see the related descriptions in some embodiments.

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

[0073] After outputting the test case, visual analysis of the test case effect or generation or pushing based on a specific file format can also be realized. For details, see the following flow corresponding to a plurality of implementation modes:

[0074] Please refer to Figure 2 , Figure 2 The flowchart of the test case generation method provided by an embodiment of the present application is shown in Figure 2 As an optional implementation mode, the method further includes:

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

[0076] Convert the target list into a target file and output it to a preset terminal.

[0077] After the batch generation of the test cases is completed, the embodiment can further output the target list corresponding to each generated target test case to push to a preset terminal or convert the target list into a target file and output to the preset terminal for the user to check, thereby improving the user experience, allowing the user to check and manually modify the specific test case in real time, and improving the practicability of the test case generation.

[0078] As an optional embodiment, after the filling of each target parameter in the target parameter combination into the test case template and the output of the target test case, the method further comprises:

[0079] determining the data validity of each target test case and filtering the invalid target test cases to obtain a test case set;

[0080] performing data analysis on the test case set according to a preset process and generating a visual chart.

[0081] After the output of the target test case, the embodiment further automatically performs data validity testing on the target test case according to the business logic and each limitation condition, automatically filters out the invalid target test cases, obtains a set of valid target test cases, and then performs data analysis on each target test case in the test case set according to a preset process to generate and push a corresponding visual chart, thereby improving the effectiveness and practicability of the test case generation.

[0082] The method provided in the application automatically combines the input parameters in the form of Cartesian product to batch generate test cases, thereby improving the test case generation efficiency and automation level. Specifically, by determining the target variable and the test case template, the test case template can be used as the fixed part of the test case. After the input of 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 the test case, Cartesian product is performed on each target parameter array to obtain a plurality of target parameter combinations, and each target parameter in the target parameter combination is filled into the test case template generated in advance to output the target test case, thereby realizing the effect of automatically combining the input parameters in the form of Cartesian product to batch generate test cases, automatically batch generating test cases, and improving the test case generation efficiency and effectiveness.

[0083] As an optional embodiment, the target variable includes a store, a commodity, and an operation.

[0084] The determination of the test case template and the target variable comprises:

[0085] determining a belonging module, a case number, and a precondition, and generating an operation step and an expected result according to the target variable;

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

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

[0088] Attribution module: store product management

[0089] Use 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 related 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 embodiments provided by the present application can be applied to a store commodity management system, and the specific target variables include stores, commodities, and operations. Further, the determination process of the test case template can include the following parts: an attribution module, a case number, a precondition, an operation step, and an expected result. The logical flow and specific functions of the test case are formed according to the functions of the parts, and then the corresponding test case template is generated, so as to complete the generation process of the fixed part of the test case. Subsequently, the test case can be automatically filled and batch generated. The corresponding test case has the logical interpretability in the specific application scenario, thereby improving the test case generation efficiency and effectiveness.

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

[0105] According to the expected input parameters of the target variables, a parameter combination condition is determined.

[0106] The parameter combination condition is used to indicate a restriction condition for combination between different target parameters in the target parameter arrays.

[0107] As described above, the parameter combination condition can include that store A only supports operations on commodity 1 and commodity 2, and store C only supports operation 1 “on shelf”.

[0108] In addition, as shown in the following table, the method further includes the following implementation details: Figure 2 Test case generation: generate all possible combinations based on the Cartesian product, and filter invalid combinations according to rules.

[0109] Excel file export: output test cases according to the normalized field structure, and each row corresponds to a complete case.

[0110] Automatic numbering rule: support generating case numbers with a fixed prefix and an incremental number, such as CASE-001 and CASE-002. The numbering rule can be configured.

[0111] Therefore, according to the condition restriction, the feasible parameter combinations can be determined, the target parameters in the target parameter combinations are filled into the test case template, and the flow of outputting the target test case is performed. A feasible execution effect is shown in Table 1:

[0112] Table 1

[0113] Table 1

[0114]

[0115] The embodiment can further determine the restriction conditions of combination or prohibition of combination between parameters in the target parameter array according to the expected input parameters corresponding to the target variables or the business logic and specific business requirements corresponding to the target variables in the specific application scenario before performing the Cartesian product on each target parameter array to obtain a plurality of target parameter combinations to batch generate test cases, thereby improving the explainability of the test cases and further improving the test case generation efficiency and effectiveness.

[0116] As an optional embodiment, before determining the parameter combination conditions according to the expected input parameters of the target variables, the method further comprises:

[0117] determining the store business scenarios indicated by each of the target variables;

[0118] determining the association rules of each of the target variables according to the store business scenarios, and determining the expected input parameters of each of the target variables according to the association rules.

[0119] In the embodiment, before determining the parameter combination conditions according to the expected parameters, the store business scenarios indicated by each of the target variables and corresponding to the combination of each of the target variables are first determined, and then the association rules of each of the target variables are determined according to the store business scenarios, and further the reasonable expected input parameters of each of the target variables under the association rules are determined, thereby improving the effectiveness and explainability of the test cases under the corresponding business scenarios.

[0120] As an optional embodiment, the determining of the association rules of each of the target variables according to the store business scenarios comprises:

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

[0122] The method further comprises:

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

[0124] modifying the parameter combination conditions according to the adjusted expected input parameters.

[0125] In the process of determining the association rules of each of the target variables, the association rules of each of the target variables can be adjusted according to the execution results of the historical test cases and the corresponding parameters generated under each of the association rules, and the corresponding adjustment and generation processes are performed according to the adjusted association rules in the subsequent steps, thereby further improving the effectiveness and explainability of the test cases under the corresponding business scenarios.

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

[0127] The first aspect is to combine business semantics with Cartesian product applications:

[0128] Incorporate retail business logic to analyze variable relationships in depth;

[0129] Data-driven business rule mining establishes a dedicated business data analysis module that regularly (such as once a week) extracts information from the massive transaction data, inventory change data, user purchase behavior data, and marketing activity data of the store merchandise management system. Use data mining algorithms (such as the Apriori algorithm for association rule mining, the FP-Growth algorithm) to deeply analyze the potential relationships between different variables. For example, analyze the sales combination of different types of stores (classified by size, location, and operating category characteristics) and various goods (subdivided into brands, categories, and price ranges) over the past year, and find that "small fashion stores located on commercial pedestrian streets" frequently appear in strong association sales patterns with "mid-to-high-end fashion women's clothing brands and price ranges between 300-800 yuan." This strong association rule is used as an important constraint condition for generating variable combinations in Cartesian product.

[0130] Combine machine learning classification algorithms (such as decision trees, random forests) to model and train the operation types of goods (such as 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, etc.), the model learns what store-goods combination is suitable for what operation strategy, so that when generating Cartesian products, it can accurately generate variable combinations according to business goals (such as improving the inventory turnover rate of a certain type of goods or increasing the sales of a specific store). For example, the model learns that in tourist area stores, large-scale listing and promotion configuration operations on special souvenir goods near holidays can significantly improve sales, so when generating test cases in related time periods, it focuses on these combinations.

[0131] Dynamic business semantic adaptation mechanism Develop sensor-like functional components that monitor business dynamics in real time, which can capture market trends, seasonal changes, unexpected events, and other factors that have an immediate impact on store merchandise business and convert them into dynamic variable labels. For example, when social media detects that a certain viral fashion item has suddenly become popular, the system quickly labels related fashion category goods with the "viral hit potential" label; when the weather forecast predicts that a certain area will experience a significant temperature drop, the winter clothing category goods in that area are labeled with the "expected demand surge" label.

[0132] The Cartesian product generation engine acquires these dynamic tags in real time and fuses them with static variables such as stores, goods, and operations to generate combinations. For example, a good with the "potential for a viral hit" tag will be combined with stores that are good at trend marketing and aggressive promotion operations (such as limited-time super-low discounts, buy-one-get-one-free, etc.) to generate test cases, ensuring that the system can adapt to the rapidly changing retail market and test the effectiveness of business processes in response to emerging business opportunities.

[0133] Based on the retail scenario, dynamically adjust the variable range;

[0134] The variable update driven by season and promotion cycle builds a retail calendar module, which contains key time information such as seasonal division, statutory holidays, e-commerce shopping festivals, and brand-owned promotion nodes throughout the year. As the calendar progresses, the system automatically identifies the current season or promotion cycle, such as summer, Double Eleven shopping festival, etc.

[0135] According to different time periods, dynamically adjust the variable range of goods participating in the Cartesian product. In summer, summer hot goods such as swimwear, cold drinks, and sunscreen are included in the key variable set; during Double Eleven, all goods suitable for participating in the big promotion (such as high-profit, high-inventory, hot bestsellers, etc.) are used as core variables. At the same time, operation variables are adapted to the characteristics of different promotion cycles, such as 618 e-commerce festival, which may focus on complex promotion rule configuration operations such as cross-store discount, red envelope rain, etc., while routine weekend promotions focus on simple discount, full gift, etc. combination of operations and goods, stores.

[0136] Store operation state triggers variable adjustment and real-time data collection system to obtain real-time operation state information of the store, including customer flow, sales, inventory level, employee scheduling, etc. When the customer flow of a store is below the threshold (such as less than 50 people per hour) for 2 consecutive hours, it is determined to be a slow business period, at which time the store is combined with clearance, low-cost traffic goods, and simplified operation processes (such as quickly removing unsold goods, temporarily adjusting the layout of goods) to generate test cases, aiming to test the system's ability to assist stores in dealing with business difficulties.

[0137] If a store is newly opened, around the characteristics of the new store, select the novice guide type onboarding process, opening big discount promotion configuration, new employee training related operations, etc. variables, combined with new stores and basic goods, to test the system's support functions for new store opening preparation and early operation, ensuring that the system can flexibly match the needs of different operation stages of each store.

[0138] In the second aspect, the optimization of rule configuration can include intelligent learning and adaptive rule optimization.

[0139] Rule evolution model based on reinforcement learning Design a rule optimization system based on reinforcement learning framework (such as Q-learning, deep Q network, etc.). After each test case is executed, a reward or punishment signal is given to the current Cartesian product generated rule according to the test results (such as the severity of the system defects found, the number of business process interruptions, repair costs, etc. Quantitative feedback indicators). If the generated test case successfully discovers a serious system vulnerability, causing the business to suspend for more than 1 hour, give the rule a larger penalty to encourage it to adjust to avoid generating similar ineffective or low-value combinations in the future; on the contrary, if the test case efficiently verifies that the key business path is normal, give a reward to strengthen the rule strategy.

[0140] The model is iterated and gradually learns to generate the optimal variable combination rule in different business scenarios (such as new product launch promotion, store inventory inventory season, etc.). For example, after many times of reinforcement learning, the model learns that when a new product is launched, it should prioritize combining the new product with stores with experience in promoting new products, full-channel promotion operations, and strict inventory monitoring operations to maximize the successful launch of new products and improve the success rate of new products. Index, realize the automatic evolution of rules with business experience.

[0141] Collaborative filtering assisted rule customization Introduce collaborative filtering algorithm, collect the operation preferences and evaluation feedback data of different project teams (development, testing, business operation, etc.) in the process of generating test cases using Cartesian product. For example, the development team may pay more attention to the variable combination corresponding to the high-risk module at the code level.

[0142] Third, the fusion of data-driven and Cartesian product optimization:

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

[0144] Multi-dimensional data integration and index construction Integrate the internal database, data warehouse of the store commodity management system and external market research reports, industry information and other multi-source data. Internal data covers transaction flow details (including product details of each order, purchase time, store location, payment method, etc.), inventory full life cycle data (storage time, batch, shelf life, inventory change track), user behavior logs (browsing, searching, collecting, adding to cart, etc. Behavior associated with goods and stores); external data involves the price trend of the same product of the competitor, the change of market share, consumer preference research report, etc.

[0145] Key indicators are extracted from data for weight calculation, such as the profit contribution of a product (the net profit of a product in a specific store in the past quarter, calculated by (selling price - cost) * sales, accounting for 30% of the weight), sales volatility (measured by standard deviation of sales in the past half year, high volatility means both risks and opportunities, accounting for 20% of the weight), inventory health (inventory days or inventory turnover rate, reflecting inventory management difficulty, accounting for 15% of the weight), market heat (external search index, social media discussion value, accounting for 10% of the weight), and user loyalty correlation (old customer repeat purchase rate, weighted score of recommendation rate, accounting for 5% of the weight), etc. A comprehensive evaluation system is established to comprehensively consider the importance of variables.

[0146] A dynamic weight updating mechanism is established, which combines regular updates (such as every month at 2-5 am during system low peak period) and event triggers (such as new product launch, end of major promotional activities, market sudden major public opinion). Each month, based on the complete business data of the previous month, the values of each indicator are recalculated, and the weight coefficients are adjusted. When a new product is launched, due to the lack of historical sales data, it is initially given a higher weight (such as 40%) for market heat and potential user demand matching. As sales data accumulates, it gradually transitions to the regular weight system. After the end of a promotional activity, the performance of each product and store during the activity is immediately analyzed, and the weight of variables with abnormal performance is adjusted to quickly respond to market changes and ensure that the Cartesian product generation always focuses on key business scenarios.

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

[0148] Advanced application of deep association rule mining uses improved Eclat algorithm or association rule mining technology based on graph database to break through the limitation of traditional two-variable relationship mining and mine complex associations of multiple variables (three or more). For example, it is found that "new community stores in a specific area + emerging national trend sportswear + social media influencer cooperation + back-to-school season promotion period" have a strong association, i.e. such community stores can achieve a sales boom by promoting emerging national trend sportswear with the help of influencer promotion during the back-to-school season. The mining results are visualized as a multi-level association network graph, with variables as nodes and line thickness proportional to association strength, making it easy to intuitively understand complex business logic.

[0149] Convert the mined multi-variable association rules into Cartesian product generation constraints or guidance strategies, prioritize generating strong association pattern combinations, and occasionally generate combinations that deviate from strong associations but have potential innovative value, balancing stability and innovation testing needs, to help discover hidden business growth opportunities and potential system risk points.

[0150] Sequence pattern mining mines dynamic correlations using sequence pattern mining algorithms (such as PrefixSpan) to analyze the dynamic correlations of commodity operations, store operation states, and market environment changes over time sequences. For example, a typical sequence pattern is mined, “Store A has accumulated inventory of a certain product category for two consecutive months -> headquarters issues a clearance instruction -> store executes a combination of promotion (buy one get one free + cross-category discount) and employee sales incentive operations -> inventory recovers to a healthy level”, which means that the system needs to focus on testing the response capability of this combination of dynamic operations in the context of inventory accumulation.

[0151] Based on sequence patterns, dynamic Cartesian product rules are generated to adjust the priority of variable combinations according to the evolution stage of business processes. When the system detects an inventory accumulation warning signal, it automatically increases the weight of corresponding clearance operations, promotion configurations, and other variable combinations to generate targeted test cases, ensuring that the system can adapt to the dynamic and orderly flow of business, resolve potential operational crises in advance, and ensure business continuity and stability.

[0152] In the fourth aspect, the Cartesian product optimization from the perspective of cross-system interaction can consider expanding the variable set associated with upstream and downstream systems:

[0153] Supply chain full-link variable integration deeply interfaces and interacts data between the store commodity management system and upstream supplier management system (covering variables such as supplier qualifications, production capacity, supply cycle, and raw material quality control), downstream sales terminal system (such as variables such as cash register efficiency, customer queue length, mobile APP interaction smoothness, and real-time update accuracy of electronic shelf labels), and logistics distribution system (variables such as logistics carrier service quality score, delivery time efficiency compliance rate, goods damage and loss rate, and distribution route planning rationality).

[0154] A unified data model is constructed to include cross-system key variables in the Cartesian product core variable pool. For example, when generating test cases, in combination with the risk of supplier raw material supply delay and store inventory warning of a certain product, the system can test the emergency response capability of the system in the context of supply chain disruption by combining urgent logistics delivery options and store emergency restocking operation combinations. Alternatively, by correlating sales terminal user payment lag and product promotion rule complexity, the system can test the ability to ensure smooth business and data consistency under high-concurrency transaction pressure, achieving expansion from single-store commodity management to full-supply chain ecosystem testing.

[0155] Business process breakpoint connection variable reinforcement Through business process analysis and data analysis, the breakpoints, bottlenecks and risk points in the cross-system interaction process are accurately located, and the Cartesian product coverage is introduced in a targeted manner. For example, in the store merchandise return process, it is found that "customer initiates return application at sales terminal -> store audit -> merchandise returns to warehouse -> supplier confirms receipt -> financial settlement of refund" loop, "store and supplier return merchandise information check" often fails, the detailed level of check information (accurate to single product batch, quality defect marking, etc.), check method (manual comparison, system automatic verification, third party quality inspection intervention) and communication frequency (real-time synchronization, daily summary.

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

[0157] Variable combination generation based on user portrait;

[0158] Dynamic user portrait label system construction Integrates transaction data, member information, marketing interaction records in the store merchandise management system, and external social media monitoring data, market research data to build a dynamic, multi-dimensional user portrait label system. The label covers basic attributes (age, gender, region), consumption preferences (category preference, brand loyalty, price sensitivity), purchasing power (income range, consumption frequency, average transaction value), social behavior (social media activity, word-of-mouth influence, social group participation), and life cycle stage (new customers, growing customers, mature customers, and loss warning customers) and other categories, and each label is updated regularly (weekly or monthly) according to real-time data. Weight and value range.

[0159] For example, for the beauty category, by analyzing user purchase records and social media discussion hotspots, young female users who are interested in natural ingredient beauty products, frequently participate in online beauty tutorial sharing, and have multiple purchase behaviors in recent times are labeled with "young beauty expert - natural skincare preference - high consumption frequency - strong social communication power" composite label, accurately outlining user characteristics, providing detailed portrait basis for Cartesian product generation, and ensuring that variable combination fits real user micro needs.

[0160] Image-driven accurate variable screening and combination design is based on the variable screening algorithm of user image tags, and preferentially selects stores, goods and operation variables strongly associated with target user images. For example, for stores targeting young fashion groups, in combination with the preference for popular fashion brands and high impulsive consumption tendency in their audience image, variables such as hot fashion brand new products, limited-time purchase, and personalized recommendation configuration are screened and combined; for stores with high net worth mature customers, variables such as high-end customized goods, exclusive member service upgrade operations (such as one-on-one private shopping appointment, exclusive lounge use permission configuration) and store high-end display adjustment are selected and combined, simulating real consumption experience of users at different levels, accurately positioning the short board of system service capability, and improving user satisfaction targeted test.

[0161] Random factors are introduced to simulate real use uncertainty;

[0162] The probability of misoperation is set according to the real user behavior research data. For example, in the product search scenario, the probability of no result or error result caused by ambiguous or spelling errors in the input keyword is set to 5%; in the add shopping cart operation, the probability of abnormal increase caused by multiple mis-clicks is about 3%; in the settlement and payment link, the probability of payment failure retry caused by network fluctuation or operation interruption is set to 7%.

[0163] When generating combinations involving operation variables in Cartesian product, misoperation variables are randomly injected according to probability, such as occasionally adding "upload picture format error" and "price input exceeds reasonable range" to the product listing process, to ensure system stability and fault tolerance capability test coverage of unexpected situations in daily use, making the test scene more realistic and resolving potential user complaint risk points in advance.

[0164] Random environmental interference factors consider real store operation environment interference, such as network signal fluctuation (simulating different area network strength, randomly switching scenes from weak signal 2G to strong signal 5G, network delay fluctuating between 100 milliseconds and 5 seconds), system peak period response delay (setting specific time periods such as 8-10 pm order volume surge to cause system processing slow), and device failure (such as occasional freezing of store cash register, scanning gun recognition error, fault probability set according to historical failure rate) and other factors, which are quantified as environmental variables and combined with regular business variables. For example, generate test cases to simulate customers buying promotional goods in a store with poor network using a faulty cash register during peak hours, observe the system's response throughout the process, and refine the system's reliability in complex and changing real-world scenarios to ensure uninterrupted business and uninterrupted service, and improve the overall user shopping experience.

[0165] Embodiments of the present application also provide a test case generation device, which comprises:

[0166] determining a target variable and a test case template;

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

[0168] The determining module is further configured to determine a target parameter array corresponding to the target variable.

[0169] The processing module is configured to perform Cartesian product on each target parameter array to obtain a plurality of target parameter combinations.

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

[0171] The embodiment automatically combines input parameters in the form of Cartesian product to batch generate test cases, and improves the test case generation efficiency and the automation level. Specifically, by determining the target variable and the test case template, the test case template 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 the test case, Cartesian product is performed on each target parameter array to obtain a plurality of target parameter combinations. Each target parameter in the target parameter combination is filled into the test case template generated in advance to output a target test case. Thus, the effect of automatically combining input parameters in the form of Cartesian product to batch generate test cases is achieved, and the test cases are automatically batch generated, and the test case generation efficiency and effectiveness are improved.

[0172] As an optional implementation manner, the target variable includes a store, a commodity, and an operation.

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

[0174] determining a belonging module, a case number, a precondition, and generating an operation step and an expected result according to the target variable.

[0175] The belonging module is used to indicate a function of each test case, the case number is used to indicate a unique identifier of each test case, the precondition is used to indicate a condition for triggering execution of each test case, and the expected result is used to indicate an expected output of the operation step corresponding to each test case.

[0176] The embodiments provided in the application can be applied to a store commodity management system, and the specific target variables include stores, commodities and operations. Further, the determination process of the test case template can include the following parts: an attribution module, a case number, a precondition, an operation step and an expected result. The logical flow and specific function of the test case are formed according to the functions of the parts, and then the corresponding test case template is generated, so as to complete the generation process of the fixed part of the test case. Subsequently, the test case can be automatically filled and batch generated. The corresponding test case has the logical interpretability in the specific application scenario, so as to improve the test case generation efficiency and effectiveness.

[0177] As an optional implementation manner, before the processing module performs the Cartesian product on each target parameter array to obtain a plurality of target parameter combinations,

[0178] According to the expected input parameter of the target variable, a parameter combination condition is determined.

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

[0180] Before the Cartesian product is performed on each target parameter array to obtain a plurality of target parameter combinations to batch generate test cases, the restriction condition of combination or prohibition of combination between parameters in the target parameter array can be determined according to the expected input parameter corresponding to the target variable or according to the business logic and specific business demand of the target variable in the specific application scenario, so as to improve the interpretability of the test case and further improve the test case generation efficiency and effectiveness.

[0181] As an optional implementation manner, before the processing module performs the Cartesian product on each target parameter array to obtain a plurality of target parameter combinations,

[0182] The store business scenario indicated by each target variable is determined.

[0183] According to the store business scenario, the association rule of each target variable is determined, and the expected input parameter of each target variable is determined according to the association rule.

[0184] In the embodiment, before the parameter combination condition is determined according to the expected parameter, the store business scenario indicated by each target variable and the combination corresponding to each target variable is first determined, and then the association rule of each target variable is determined according to the store business scenario, and the reasonable expected input parameter of each target variable under the association rule is further determined, so as to improve the effectiveness and interpretability of the test case in the corresponding business scenario.

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

[0186] According to the execution result of the historical test case, the association rule of each target variable is adjusted;

[0187] The processing module is further configured to:

[0188] According to the adjusted association rule, the expected input parameter of each target variable is adjusted;

[0189] According to the adjusted expected input parameter, the parameter combination condition is modified.

[0190] In the process of determining the association rule of each target variable, in addition to the influence of the business logic itself, the historical test case execution result and the corresponding parameters generated under each association rule are also considered to adjust the association rule of each target variable, and the corresponding adjustment and generation process are performed according to the adjusted association rule in the subsequent step, thereby further improving the effectiveness and interpretability of the test case under the corresponding business scenario.

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

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

[0193] Convert the target list into a target file and output it to a preset terminal.

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

[0195] As an optional implementation, the processing module is further configured 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 target test case, filter the invalid target test cases, and obtain a test case set;

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

[0198] The embodiment further automatically performs data validity testing on the target test cases according to the business logic and each limit condition after outputting the target test cases, and automatically filters out invalid target test cases, obtains a set of valid target test cases, and further performs data analysis on each target test case in the test case set according to a preset process to generate and push corresponding visual charts, thereby improving the effectiveness and practicality of test case generation.

[0199] It should be noted that the division of each module of the above device is only a logical division of functions, and all or part of the modules can be integrated into one physical entity or physically separated when actually implemented. The modules can all be implemented in the form of software called by a processing element, all in the form of hardware, or part of the modules in the form of software called by a processing element and part of the modules in the form of hardware. For example, the processing module can be a separately established processing element, or can be integrated in a chip of the above device, and in addition, the processing module can be in the form of program code stored in the memory of the above device and called and executed by a processing element of the above device. The implementation of other modules is similar. In addition, all or part of the modules can be integrated together or independently implemented. The processing element herein can be an integrated circuit having a signal processing capability. In the implementation process, each step of the above method or each module can be completed by the integrated logic circuit of the hardware or the instruction of the software in the processor element.

[0200] As shown in Figure 3 , Figure 3 An internal structure schematic diagram of a computer device provided by an embodiment of the present application is shown in FIG. 3. The computer device 300 can be provided as a server. As shown in 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 executable by the processing component 302, such as an application program. The application program stored in the memory 301 can include one or more than one module each corresponding to a set of instructions. In addition, the processing component 302 is configured to execute the instructions to perform the method of any of the above embodiments.

[0201] The computer device 300 can 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 can 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 can understand that, Figure 3 The structure shown in the figure is only a block diagram of part of the structure related to the scheme of the present application, and does not constitute a limitation on the computer device to which the scheme of the present application is applied. A specific computer device can include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0203] The embodiment of the present application provides a storage medium, the storage medium stores computer readable instructions, and the computer readable instructions are executed by one or more processors to make the one or more processors execute the method provided in any embodiment.

[0204] Finally, it should be noted that in this document, relational terms such as first and second and the like can only be used to distinguish one entity or action from another entity or action, and do not necessarily require or imply that there is any such actual relationship or order between these entities or actions. Moreover, the terms "comprises", "comprising" or any other variant thereof are intended to cover non-exclusive inclusions, so that a process, method, article or apparatus that includes a list of elements does not only include those elements, but also includes other elements not explicitly listed or other elements inherent to such a process, method, article or apparatus. Without more limitations, an element defined by the statement "comprising a" does not exclude the presence of additional identical elements in the process, method, article or apparatus that includes the element.

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

[0206] The foregoing description of the disclosed embodiments enables a person skilled in the art to make or use the application. Modifications of these embodiments will occur to persons of skill in the art, and that the generic principles defined herein can be applied to other embodiments without departing from the spirit or scope of the application. Therefore, the present application is not intended to be limited to the embodiments shown herein but is to be accorded 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; Determine the data validity of each target test case, filter out invalid target test cases, and obtain a test case set; According to the preset process, perform data analysis on the test case set and generate visual charts; Wherein, the target variables include stores, products and operations; Determining the test case template and target variables includes: Determine the module, use case number, and preconditions, and generate the operation steps and expected results based on the target variables; Among them, the attribution module is used to indicate the function of each test case, the case number is used to indicate the unique identifier of each test case, the precondition is used to indicate the condition for triggering the execution of each test case, and the expected result is used to indicate the expected output of the operation step corresponding to each test case.

2. The method according to claim 1, characterized in that Before performing Cartesian products on the target parameter arrays to obtain a plurality of target parameter combinations, the method further includes: Determining parameter combination conditions based on 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.

3. The method according to claim 2, characterized in that Before determining the parameter combination conditions according to the expected input parameters of the target variable, the method further includes: Determining 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.

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

5. The method according to any one of claims 1 to 4, 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.

6. 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 configured to determine a 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 configured to fill each target parameter in the target parameter combination into the test case template and output a target test case; The processing module is further configured to determine the data validity of each target test case, filter out invalid target test cases, and obtain a test case set; The processing module is further configured to perform data analysis on the test case set according to a preset process and generate a visual chart; Wherein, the target variables include stores, products and operations; The specific manner in which the determination module determines the test case template and the target variable includes: Determine the module, use case number, and preconditions, and generate the operation steps and expected results based on the target variables; Among them, the attribution module is used to indicate the function of each test case, the case number is used to indicate the unique identifier of each test case, the precondition is used to indicate the condition for triggering the execution of each test case, and the expected result is used to indicate the expected output of the operation step corresponding to each test case.

7. 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 5 are performed.

8. A storage medium, characterized in that: The storage medium stores computer-readable instructions, which, when executed by one or more processors, enable the one or more processors to perform the steps of the method according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • Implementation method and device for telecommunication charging service automatic testing

    CN111240983A

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

    CN118484375A