Test case generation method and device and readable storage medium

By converting the basic use cases described in natural language into standard execution steps and generating automated test cases, the problems of low production efficiency and high maintenance costs in the existing technology are solved, and efficient and flexible test case generation is achieved.

CN120540970APending Publication Date: 2025-08-26SHENZHEN BINCENT TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510433995.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-08
Publication Date
2025-08-26

AI Technical Summary

Technical Problem

In the prior art, manual test cases are inefficient and time-consuming, automated script writing takes a long time and high maintenance costs, making it difficult to adapt to the rapid iteration of software and interface changes.

Method used

By obtaining the basic use cases described by natural language, using the step conversion model to convert it into standard execution steps, combining the text understanding model to generate execution search conditions, and searching for knowledge statements in the preset knowledge base, and finally generating automated test cases.

Benefits of technology

Significantly improve the speed of test case production, reduce maintenance costs, enhance test flexibility and coverage, and adapt to software changes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120540970A_ABST
    Figure CN120540970A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses a test case generation method, which comprises the following steps of: obtaining a basic case which is a case described by adopting a natural language; converting the basic use case into a plurality of standard execution steps based on a step conversion model; transmitting a plurality of standard execution steps to the text understanding model to obtain an execution search condition; searching in a preset knowledge base based on the search execution condition to obtain a knowledge statement; and outputting the plurality of standard execution steps, the execution search conditions and the knowledge statements to a test case generation model to generate an automatic test case. According to the method, the basic use case of the natural language is automatically converted into the standard execution steps through the step conversion model, and manual operation is reduced. According to the method, the text understanding model is used for generating search conditions, knowledge statements are searched in the knowledge base, and then the automatic test case is generated, so that the test efficiency is remarkably improved, the maintenance cost is reduced, the method can better adapt to software changes, and the test flexibility is enhanced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the field of software testing technology, and in particular relates to a test case generation method, device and readable storage medium. Background Art

[0002] In today's rapidly evolving digital landscape, software systems are becoming increasingly complex and frequently updated. To meet the demands of the times, the software testing industry is moving towards intelligence, automation, and specialization. Technologies like AI and cloud computing are driving this transformation, bringing new opportunities for software testing. This is particularly true for test case processing, where all parties are exploring more efficient solutions.

[0003] In existing software testing, manual test cases rely primarily on manual analysis of test requirements, design of test steps, and manual execution and recording of results. Automated test script writing relies on manual element location and code creation.

[0004] However, existing technologies have numerous shortcomings. Manual testing is extremely inefficient, consuming significant manpower and time, and struggling to keep pace with the rapid pace of software iteration. Test coverage is also limited, making it easy to overlook complex business logic and exceptions. Automated scripting is not only time-consuming but also expensive to maintain. When software requirements change or interface functionality is adjusted, it's difficult to quickly adapt, requiring significant manpower for modification and revalidation, and easily introducing new errors. Summary of the Invention

[0005] The purpose of the present invention is to provide an automated test case generation method to solve the problem that the existing manual test case writing is relatively complex and has low work efficiency. The test case generation method provided in this application includes:

[0006] Obtaining a basic use case, where the basic use case is a use case described in natural language;

[0007] Based on the step conversion model, the basic use case is converted into multiple standard execution steps;

[0008] transmitting the plurality of execution steps of the standard to a text understanding model for processing to obtain execution search conditions;

[0009] Searching in a preset knowledge base based on the execution search condition to obtain a knowledge statement;

[0010] The plurality of execution steps of the standard, the execution search conditions and the knowledge statements are output to a test case generation model to generate an automated test case.

[0011] Based on the test case generation method of the first aspect of the embodiment of the present application, optionally,

[0012] Outputting the plurality of execution steps of the standard, the execution search conditions, and the knowledge statements to a test case generation model to generate an automated test case includes:

[0013] The plurality of execution steps of the standard, the element positioning expression, the execution search condition and the knowledge statement are output to a test case generation model to generate an automated test case.

[0014] Based on the test case generation method of the first aspect of the embodiment of the present application, optionally,

[0015] The step conversion model is based on which the basic use case is converted into a plurality of standard execution steps by a step formatting agent.

[0016] Based on the test case generation method of the first aspect of the embodiment of the present application, optionally, the multiple execution steps of the standard are transferred to the text understanding model to obtain execution search conditions; based on the execution search conditions, a search is performed in a preset knowledge base to obtain knowledge statements; the multiple execution steps of the standard, the execution search conditions and the execution statements are output to the test case generation model, and the generated automated test case steps are executed by the use case automation conversion agent.

[0017] Based on the test case generation method of the first aspect of the embodiment of the present application, optionally, the automated test case is used to test the decoration network service platform.

[0018] Based on the test case generation method of the first aspect of the embodiment of the present application, optionally, the method further includes:

[0019] Storing the automated test cases;

[0020] The automated test case execution is triggered based on manual operations or specific conditions.

[0021] Based on the test case generation method of the first aspect of the embodiment of the present application, optionally, searching in a preset knowledge base based on the execution search condition to obtain a knowledge statement includes:

[0022] Perform semantic search and matching in a preset knowledge base based on the execution search condition;

[0023] All results with a matching degree greater than a preset value are obtained as the knowledge statements.

[0024] A second aspect of an embodiment of the present application provides a test case generation device, comprising:

[0025] An acquisition unit, configured to acquire a basic use case, wherein the basic use case is a use case described in a natural language;

[0026] A conversion unit, configured to convert the basic use case into a plurality of standard execution steps based on a step conversion model;

[0027] a processing unit, configured to transmit the plurality of execution steps of the standard to a text understanding model, and process the plurality of execution steps to obtain execution search conditions;

[0028] A search unit, configured to search a preset knowledge base based on the execution search condition to obtain a knowledge statement;

[0029] The generating unit is used to output the plurality of execution steps of the standard, the execution search conditions and the knowledge statements to a test case generation model to generate an automated test case.

[0030] Based on a test case generating device provided in the second aspect of the application embodiment, optionally,

[0031] The generating unit is specifically configured to:

[0032] The plurality of execution steps of the standard, the element positioning expression, the execution search condition and the knowledge statement are output to a test case generation model to generate an automated test case.

[0033] Based on a test case generation device provided in the second aspect of the application embodiment, optionally, the automated test case is used to test the decoration network service platform.

[0034] Based on a test case generating device provided in the second aspect of the application embodiment, optionally,

[0035] The device further includes an execution unit configured to:

[0036] Storing the automated test cases;

[0037] The automated test case execution is triggered based on manual operations or specific conditions.

[0038] Based on a test case generating device provided in the second aspect of the application embodiment, optionally, the search unit is specifically configured to:

[0039] Perform semantic search and matching in a preset knowledge base based on the execution search condition;

[0040] All results with a matching degree greater than a preset value are obtained as the knowledge statements.

[0041] A third aspect of an embodiment of the present application provides a test case generation device, including:

[0042] CPU, memory, input and output interfaces, wired or wireless network interfaces, and power supply;

[0043] The memory is a transient storage memory or a persistent storage memory;

[0044] The central processing unit is configured to communicate with the memory and execute instruction operations in the memory on the device to perform the method described in any one of the first aspects of the embodiments of the present application.

[0045] A fourth aspect of the embodiments of the present application provides a computer-readable storage medium, comprising instructions, which, when executed on a computer, enable the computer to execute the method described in any one of the first aspects of the embodiments of the present application.

[0046] A fifth aspect of the embodiments of the present application provides a computer program product comprising instructions, which, when executed on a computer, enables the computer to execute any one of the methods described in the first aspect of the embodiments of the present application.

[0047] It can be seen from the above technical solutions that the embodiments of the present application have the following advantages: the embodiments of the present application provide a test case generation method, comprising: obtaining a basic use case, wherein the basic use case is a use case described in natural language; based on a step conversion model, converting the basic use case into a plurality of standard execution steps; transmitting the plurality of standard execution steps to a text understanding model to obtain an execution search condition; searching in a preset knowledge base based on the execution search condition to obtain a knowledge statement; outputting the plurality of standard execution steps, the execution search condition and the knowledge statement to a test case generation model to generate an automated test case. This method automatically converts the basic use case in natural language into standard execution steps through a step conversion model, reduces manual operations, and greatly improves the speed of test case production. Moreover, manual testing is difficult to cover all functions and scenarios of complex software. This method uses a text understanding model to generate search conditions, searches for knowledge statements in a knowledge base, and then generates automated test cases, which significantly improves test efficiency, reduces maintenance costs, and can better adapt to software changes and enhance test flexibility. BRIEF DESCRIPTION OF THE DRAWINGS

[0048] To more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are merely embodiments of the present application. A person of ordinary skill in the art can also derive other drawings based on the provided drawings without inventive effort. It should be understood that the drawings provided in this section are only used to better understand the present solution and do not constitute a limitation of the present application.

[0049] Figure 1 A flow chart of an embodiment of the test case generation method provided in this application;

[0050] Figure 2 Another flowchart of an embodiment of the test case generation method provided by this application;

[0051] Figure 3 This is an overall flow chart of an embodiment of the test case generation method provided by this application;

[0052] Figure 4 A schematic diagram of the test case user interface provided by this application;

[0053] Figure 5 A schematic diagram of the test case storage and execution interface provided by this application;

[0054] Figure 6 A schematic diagram of a test case generation device embodiment provided in this application;

[0055] Figure 7 This is another structural diagram of an embodiment of the test case generation device provided in this application. DETAILED DESCRIPTION

[0056] In order to enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application are clearly and completely described below. 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 making creative work should fall within the scope of protection of this application. At the same time, for the sake of clarity and conciseness, the description of well-known functions and structures is omitted in the following description.

[0057] The terms "first," "second," "third," "fourth," and the like (if any) in the specification and claims of this application and in the accompanying drawings are used to distinguish similar objects and are not necessarily used to describe a particular order or precedence. It should be understood that the terms used in this manner are interchangeable where appropriate so that the embodiments described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "including" and "having," and any variations thereof, are intended to cover non-exclusive inclusions, e.g., a process, method, product, or apparatus comprising a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such process, method, product, or apparatus.

[0058] In today's rapidly evolving digital landscape, software systems are becoming increasingly complex and frequently updated. To meet the demands of the times, the software testing industry is moving towards intelligence, automation, and specialization. Technologies like AI and cloud computing are driving this transformation, bringing new opportunities for software testing. This is particularly true for test case processing, where all parties are exploring more efficient solutions.

[0059] In existing software testing, manual test cases rely primarily on manual analysis of test requirements, design of test steps, and manual execution and recording of results. Automated test script writing relies on manual element location and code creation.

[0060] However, existing technologies have numerous shortcomings. Manual testing is extremely inefficient, consuming significant manpower and time, and struggling to keep pace with the rapid pace of software iteration. Test coverage is also limited, making it easy to overlook complex business logic and exceptions. Automated scripting is not only time-consuming but also expensive to maintain. When software requirements change or interface functionality is adjusted, it's difficult to quickly adapt, requiring significant manpower for modification and revalidation, and easily introducing new errors.

[0061] To solve the above problems, this application provides a test case generation method, please refer to Figure 1 An embodiment of the test case generation method provided in this application includes: steps 101 to 105.

[0062] 101. Obtain basic use cases.

[0063] Specifically, this solution targets testers with little programming experience and aims to capture basic use cases described in natural language. Natural language, as used in everyday communication, is used to describe the specific content of the test. For example, a basic use case might be something like "enter a keyword in the search box and click the search button." Or, "search for a specific brand of product on the platform, filter for in-stock products within a certain price range, view product details, and add them to the shopping cart."

[0064] 102. Based on a step conversion model, convert the basic use case into multiple standard execution steps.

[0065] The step conversion model is pre-trained and used to execute the conversion process. It converts basic use cases described in natural language into standard execution steps. The model must understand the semantics of natural language descriptions and identify key operations, operation objects, and operation conditions. The step conversion model uses a deep learning-based architecture, typically based on the Transformer architecture. Training the step conversion model requires a large amount of annotated data consisting of basic use cases described in natural language and the corresponding standard execution steps. The training process typically utilizes supervised learning.

[0066] The step conversion model breaks down complex operations described in natural language into multiple simple, standard execution steps. The model needs to rationally divide the operation steps based on semantic information and domain knowledge, ensuring that each step has a clear operation goal and operation method. Generally, one operation is considered a step, such as:

[0067] 1. Enter [specific content]

[0068] 2. Click [Specific Object]

[0069] 3. Perform [specific operations]

[0070] In the actual implementation process, the form and transformation conditions of the step transformation model can be determined according to the actual situation and are not limited here.

[0071] 103. The plurality of execution steps of the standard are transmitted to a text understanding model, and processed to obtain execution search conditions.

[0072] Specifically, the text understanding model is pre-trained, and the standard execution steps obtained in the previous step are transferred to the pre-trained text understanding model. The text understanding model uses natural language processing technology to understand the meaning of each standard step, thereby extracting the key background knowledge required to execute the step, namely the execution search criteria. Taking the step of "clicking button A" as an example, the model analyzes the specific requirements of the "click" operation and the characteristic information of the "A button" to generate execution search criteria such as "find the location information of clickable elements on the page whose names contain 'A'" and "obtain the code statement corresponding to the 'click' operation in the current test environment."

[0073] 104. Search in a preset knowledge base based on the execution search condition to obtain knowledge statements.

[0074] Specifically, the preset knowledge base is based on the specific environment in which the test case is applied. For example, if it is applied to a home renovation network service platform, the knowledge base will record the location of each element of the platform, the calling method, and other information. Executing the search criteria in the preset base will generate knowledge statements. Based on the generated execution search criteria, the preset knowledge base is searched. The preset knowledge base is constructed based on different test scenarios and software environments, and its specific content is not limited. The knowledge base content can include technical documentation provided by developers, historical test data, software code comments, etc. The structure of the knowledge base is also not fixed and can be a relational database structure, a document database structure, or other structures suitable for storing and retrieving information. When the test case is applied to software in different fields, the knowledge base will specifically store element information, operation rules, and other information related to the software in that field. Furthermore, the search process is not limited to a single search method; a combination of semantic search and keyword search can be used to ensure that knowledge statements matching the execution search criteria are accurately obtained.

[0075] 105. Output the plurality of standard execution steps, the execution search conditions, and the knowledge statements to a test case generation model to generate an automated test case.

[0076] Specifically, the test case generation model is pre-trained, using a large amount of labeled input information (standard execution steps, execution search conditions, knowledge statements) and its corresponding complete automated test cases as training data. The model learns the mapping relationship from input to output, minimizing the difference between the predicted results and the actual test cases, such as using the cross-entropy loss function to measure the difference, and updating the model parameters through the backpropagation algorithm. During the reinforcement learning phase, the generated test cases are executed in a simulated test environment. Based on the reward signals fed back by the execution results (such as test case accuracy, coverage, execution efficiency, and other indicators), the model generation strategy is adjusted to gradually generate better test cases.

[0077] The trained test case generation model can rationally stitch and integrate this information based on pre-set rules and algorithms. It generates automated test cases that conform to machine language specifications based on different operation types, element positioning methods, and execution statements. The generated automated test cases can be directly executed as programs in the corresponding test environment, and their performance is completely consistent with the basic use cases originally described in natural language. For example, for the test scenarios of the e-commerce platform and the home improvement online service platform mentioned above, the generated automated test cases accurately simulate user operations and automatically complete various test tasks, greatly improving test efficiency and accuracy.

[0078] It can be seen from the above technical solutions that the embodiments of the present application have the following advantages: the embodiments of the present application provide a test case generation method, comprising: obtaining a basic use case, wherein the basic use case is a use case described in natural language; based on a step conversion model, converting the basic use case into a plurality of standard execution steps; transmitting the plurality of standard execution steps to a text understanding model to obtain an execution search condition; searching in a preset knowledge base based on the execution search condition to obtain a knowledge statement; outputting the plurality of standard execution steps, the execution search condition and the knowledge statement to a test case generation model to generate an automated test case. This method automatically converts the basic use case in natural language into standard execution steps through a step conversion model, reduces manual operations, and greatly improves the speed of test case production. Moreover, manual testing is difficult to cover all functions and scenarios of complex software. This method uses a text understanding model to generate search conditions, searches for knowledge statements in a knowledge base, and then generates automated test cases, which significantly improves test efficiency, reduces maintenance costs, and can better adapt to software changes and enhance test flexibility.

[0079] In order to facilitate the use of this method in actual implementation, this application also provides a more detailed embodiment that can be optionally implemented, please refer to Figure 2 Another embodiment of the test case generation method provided by the present application includes: Step 201 to Step 208. Specifically, the overall flow chart of the implementation of this solution can be referred to Figure 3 .

[0080] 201. Obtain basic use cases.

[0081] Specifically, obtain the basic use case, which is a use case described in natural language. This step is consistent with step 101 and will not be repeated here. This solution is applied to the basic use case of the decoration network service platform test, which is described in natural language. Natural language is close to the way humans communicate in daily life and is not limited to specific formats or professional terms. Testers can freely express their test intentions. For example, expressions such as "enter keywords in the search box to view search results" and "check whether the page jump is correct after clicking the button" can be used as basic use cases.

[0082] In the actual implementation process, basic test cases can be obtained through various means. For example, a dedicated test case submission interface can be built, where testers can input test cases described in natural language. For the specific input interface, please refer to Figure 4 ; or extract relevant natural language test descriptions from existing documents or emails, which are not limited here.

[0083] This solution uses the basic use case as follows: "1. Click the Decoration Company Management menu on the left, click the Company List secondary menu on the left 2. Enter 1719887 as the decoration company ID, click Query, check the first data checkbox, and click View at the top" for explanation.

[0084] 202. Based on a step conversion model, convert the basic use case into multiple standard execution steps.

[0085] This step is executed by the Step Formatting Agent, which is responsible for executing this step. The agent converts steps according to preset standards and rules. Its internal step conversion model is pre-trained. This model analyzes the semantics of natural language and breaks down basic use cases into standard execution steps. Each step clearly defines the operation type (such as click, input, checkbox, etc.) and the operation object (such as a menu, input box, button, etc.). After execution, an echo is displayed to facilitate testers to confirm whether the conversion results meet expectations. The model can use natural language processing techniques such as part-of-speech tagging and syntactic analysis to understand the semantics of the basic use case. For the example basic use case, the agent converts it into: 1. Click <Left Menu> [Decoration Company Management] 2. Click <Left Second Menu> [Company List] 3. Enter <Input Box> [Decoration Company ID], which contains [1719887] 4. Click <Button> [Query] 5. Check <Checkbox> [First Data Checkbox] 6. Click <Button> [View]

[0086] As you can see, each standard execution step is assigned a unique number, and each step clearly distinguishes the operation type and operation object. Specifically, angle brackets <> are used to identify the operation object type, and square brackets [] are used to identify the specific operation object name. It is understood that in actual implementation, the processing method of the agent can be determined based on the actual situation and is not limited here.

[0087] The converted result can be displayed to the user (such as Figure 4 The user can check whether the conversion result is correct and make adjustments after confirmation.

[0088] 203. Transmit the plurality of execution steps of the standard to a text understanding model, and process the model to obtain execution search conditions.

[0089] Specifically, steps 201 through 206 are performed by the Use Case Automation Conversion Agent. This agent can flexibly adapt to different renovation network service platform testing scenarios by adjusting its internal models and algorithms, and can also adapt to updates and changes to the knowledge base, demonstrating its high flexibility and scalability. Furthermore, the Use Case Automation Conversion Agent can be easily integrated with other testing tools and systems, seamlessly collaborating with step formatting agents and other agents to automate and integrate the testing process, reduce manual intervention, and improve overall testing efficiency.

[0090] This text understanding model is typically based on a deep learning architecture, with Transformer being a common foundation. The model uses a self-attention mechanism to analyze the relationships between terms in a standard execution step and understand the semantics of the entire step. For example, for the phrase "click <button> [query]," the model identifies "click" as the action type, "button" as the action object type, and "query" as the specific action object, thereby grasping the core semantics of the step. This allows it to extract the key background knowledge required to execute the step, namely, the search criteria.

[0091] During text comprehension model training, a large number of standard execution steps and their corresponding search conditions are collected as training data and annotated. These annotated data include the operation type, operation object, and key information. A cross-entropy loss function is used to measure the difference between the model's predicted search conditions and the actual annotations. Stochastic Gradient Descent (SGD) and its variants (such as Adam and Adagrad) are used as optimization algorithms to continuously adjust model parameters to minimize the loss function, thereby improving model performance.

[0092] 204. Perform semantic search and matching in a preset knowledge base based on the execution search condition.

[0093] Specifically, the preset knowledge base is constructed based on the characteristics of the decoration network service platform, and contains information on various elements of the platform, codes corresponding to operations, and other knowledge. Semantic retrieval matching refers to finding knowledge items in the knowledge base that are semantically similar to the execution search conditions, rather than just simple matching based on keywords. Semantic retrieval algorithms can be used, such as similarity calculation methods based on vector space models. Both the execution search conditions and the knowledge items in the knowledge base are converted into vector representations, and then the similarity between them is calculated. For example, word embedding technology is used to convert text into vectors, and then the cosine similarity is used to measure the similarity between the two vectors.

[0094] 205. All results with a matching degree greater than a preset value are obtained as the knowledge statements.

[0095] Specifically, to ensure the accuracy and relevance of search results, a preset value is set as the match threshold. Only knowledge items with a match greater than this threshold are selected as knowledge statements. These knowledge statements contain the specific information required to execute the standard steps. After semantic search matching, the degree of match between each matching result and the search criteria is calculated. The match is then compared with the preset value, and results with a match greater than the preset value are selected as knowledge statements. The preset value can be adjusted based on actual conditions to balance the accuracy and completeness of the search results.

[0096] 206. Output the plurality of execution steps of the standard, the execution search conditions and the knowledge statements to the test case generation model to generate an automated test case.

[0097] Specifically, the test case generation model integrates information on standard execution steps, execution search conditions, element location expressions, and knowledge statements, and the model processes and generates automated test cases. The generated use cases are written in machine language and can be executed directly in the form of a program. Each statement of the generated use case is displayed corresponding to the execution steps, making it convenient for users to adjust according to actual conditions. During the training process of the test case generation model, a large amount of standard execution steps and their corresponding execution search conditions are collected as training data and annotated. The annotation content includes operation type, operation object, key information, etc. The cross-entropy loss function is used to measure the difference between the execution search conditions predicted by the model and the actual annotations. Stochastic gradient descent is used as the optimization algorithm to continuously adjust the parameters of the model to minimize the value of the loss function, thereby improving the performance of the model.

[0098] Element location expressions refer to the syntax or methods used to identify and access specific elements in the user interface (UI) during automated testing. Different automated testing tools use different methods to define and parse these expressions. This technical solution uses the Selenium testing framework.

[0099] It should be noted that if no result that meets the threshold is matched in step 205, the element positioning expression and the execution results of other steps including the generation rule prompt words are directly sent to the large model to generate a general automated test case step.

[0100] Furthermore, the program statements corresponding to the execution steps generated in step 202 and the statements of the use cases generated in this step can be displayed accordingly for user adjustment. Figure 4 Lower part.

[0101] 207. Storing the automated test cases

[0102] The generated automated test cases are stored for subsequent use and management. The storage method needs to consider the security, accessibility, and maintainability of the data.

[0103] 208. Execution of the automated test case based on manual operation or specific conditions

[0104] Specifically, two methods are provided for triggering the execution of automated test cases. Manual triggering means that the tester manually starts the execution of the test case; specific condition triggering means that the test case execution is automatically started according to preset conditions, such as scheduled tasks, system events, etc.

[0105] For manual operation triggering, an execution button can be provided in the test management interface, and the tester can start the test case by clicking the button. For specific condition triggering, a timed task scheduling tool or event monitoring mechanism can be used to automatically call the test case execution program when the preset conditions are met. For specific storage and execution processes, please refer to Figure 5 , Figure 5 It is a schematic diagram of the stored test case execution interface.

[0106] It can be seen from the above technical solutions that the embodiments of the present application have the following advantages: the embodiments of the present application provide a test case generation method, comprising: obtaining a basic use case, wherein the basic use case is a use case described in natural language; based on a step conversion model, converting the basic use case into a plurality of standard execution steps; transmitting the plurality of standard execution steps to a text understanding model to obtain an execution search condition; searching in a preset knowledge base based on the execution search condition to obtain a knowledge statement; outputting the plurality of standard execution steps, the execution search condition and the knowledge statement to a test case generation model to generate an automated test case. This method automatically converts the basic use case in natural language into standard execution steps through a step conversion model, reduces manual operations, and greatly improves the speed of test case production. Moreover, manual testing is difficult to cover all functions and scenarios of complex software. This method uses a text understanding model to generate search conditions, searches for knowledge statements in a knowledge base, and then generates automated test cases, which significantly improves test efficiency, reduces maintenance costs, and can better adapt to software changes and enhance test flexibility.

[0107] This solution combines software testing automation with artificial intelligence, featuring several key innovations. The "Step Formatting Agent" converts manual test cases described in natural language into unified formatting operations, resolving the low efficiency and error-prone nature of traditional manual parsing and writing, improving efficiency, achieving standardized operations, and reducing error rates. The "Automated Use Case Conversion Agent" combined with a knowledge base converts formatting steps into automated test scripts, avoiding the time-consuming and high maintenance costs of manual element location searches, enabling automated script generation, and improving maintainability and test coverage. The text understanding model dynamically optimizes search conditions based on a large language model, overcoming the shortcomings of traditional search methods in coping with complex scenarios and dynamic changes, enabling intelligent retrieval, adapting to complex scenarios, and improving query efficiency. The retrieved element location methods are combined into complete automated test steps and stored, resolving the problem of traditional scripts being unable to reuse historical steps, improving reusability, supporting dynamic updates, and enhancing execution efficiency. The stored automated test steps can directly drive fully automated browser execution, resolving the low efficiency and error-prone nature of traditional manual execution startups, while also supporting multiple browsers, real-time monitoring, and error reporting.

[0108] The above content describes the test case generation method provided by this application. To support the implementation of the above embodiment, this application also provides a test case generation device, please refer to Figure 6 , an embodiment of the test case generation device of the present application includes:

[0109] An acquiring unit 601 is configured to acquire a basic use case, where the basic use case is a use case described in a natural language;

[0110] A conversion unit 602 is configured to convert the basic use case into a plurality of standard execution steps based on a step conversion model;

[0111] A processing unit 603 is configured to transmit the plurality of execution steps of the standard to a text understanding model for processing to obtain an execution search condition;

[0112] A search unit 604 is configured to search a preset knowledge base based on the execution search condition to obtain a knowledge statement;

[0113] The generating unit 605 is configured to output the plurality of execution steps of the standard, the execution search conditions and the knowledge statements to a test case generation model to generate an automated test case.

[0114] Optionally, the generating unit 605 is specifically configured to:

[0115] The plurality of execution steps of the standard, the element positioning expression, the execution search condition and the knowledge statement are output to a test case generation model to generate an automated test case.

[0116] Based on a test case generation device provided in the second aspect of the application embodiment, optionally, the automated test case is used to test the decoration network service platform.

[0117] Optionally,

[0118] The device further includes an execution unit configured to:

[0119] Storing the automated test cases;

[0120] The automated test case execution is triggered based on manual operation or specific conditions.

[0121] Optionally, the search unit is specifically configured to:

[0122] Perform semantic search and matching in a preset knowledge base based on the execution search condition;

[0123] All results with a matching degree greater than a preset value are obtained as the knowledge statements.

[0124] In this embodiment, the processes performed by each unit in the device are the same as those described above. Figure 1 The method processes described in the corresponding embodiments are similar and will not be repeated here.

[0125] The figure is a structural diagram of a test case generation device 700 provided in an embodiment of the present application. The test case generation device 700 may include one or more central processing units (CPU) 701 and a memory 705, in which one or more applications or data are stored.

[0126] In this embodiment, the specific functional module division in the central processing unit 701 can be the same as the above Figure 6 The functional module division method of each unit described in is similar and will not be repeated here.

[0127] Memory 705 can be volatile or persistent storage. The program stored in memory 705 can include one or more modules, each of which can include a series of instruction operations on the server. Furthermore, central processing unit 701 can be configured to communicate with memory 705 and execute the series of instruction operations in memory 705 on test case generation device 700.

[0128] The test case generating device 700 may further include one or more power supplies 702 , one or more wired or wireless network interfaces 703 , and one or more input and output interfaces 707 .

[0129] The CPU 701 can execute the aforementioned Figure 1The operations performed by the test case generation method in the illustrated embodiment will not be described in detail here.

[0130] An embodiment of the present application also provides a computer storage medium for storing computer software instructions used for the above-mentioned test case generation method, which includes a program designed for executing the test case generation method.

[0131] The test case generation method may be the test case generation method described in the aforementioned figures.

[0132] An embodiment of the present application also provides a computer program product, which includes computer software instructions, and the computer software instructions can be loaded by a processor to implement the process of the test case generation method of any one of the above figures.

[0133] In the several embodiments provided in this application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are merely schematic. For example, the equivalent transformation of circuits and the division of units are only a kind of logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.

[0134] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

[0135] In addition, the functional units in the various embodiments of the present application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.

[0136] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions or improvements made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.

Claims

1. A test case generation method, characterized in that: include: Obtaining a basic use case, where the basic use case is a use case described in natural language; Based on the step conversion model, the basic use case is converted into multiple standard execution steps; transmitting the plurality of execution steps of the standard to a text understanding model for processing to obtain execution search conditions; Searching in a preset knowledge base based on the execution search condition to obtain a knowledge statement; The plurality of execution steps of the standard, the execution search conditions and the knowledge statements are output to a test case generation model to generate an automated test case.

2. The test case generation method according to claim 1, characterized in that: Outputting the plurality of execution steps of the standard, the execution search conditions, and the knowledge statements to a test case generation model to generate an automated test case includes: The plurality of execution steps of the standard, the element positioning expression, the execution search condition and the knowledge statement are output to a test case generation model to generate an automated test case.

3. The test case generation method according to claim 1, wherein: The step conversion model based on which the basic use case is converted into a plurality of standard execution steps is executed by a step formatting agent.

4. The test case generation method according to claim 1, wherein: The multiple execution steps of the standard are transferred to the text understanding model to obtain execution search conditions; based on the execution search conditions, a search is performed in a preset knowledge base to obtain knowledge statements; the multiple execution steps of the standard, the execution search conditions and the execution statements are output to the test case generation model to generate automated test case steps to be executed by the use case automation conversion intelligent agent.

5. The test case generation method according to claim 1, wherein: The automated test cases are used to test the decoration network service platform.

6. The test case generation method according to claim 1, wherein: The method further comprises: Storing the automated test cases; The automated test case execution is triggered based on manual operations or specific conditions.

7. The test case generation method according to claim 1, characterized in that: Searching in a preset knowledge base based on the execution search condition to obtain knowledge statements includes: Perform semantic search and matching in a preset knowledge base based on the execution search condition; All results with a matching degree greater than a preset value are obtained as the knowledge statements.

8. A test case generation device, characterized in that: include: An acquisition unit, configured to acquire a basic use case, wherein the basic use case is a use case described in a natural language; A conversion unit, configured to convert the basic use case into a plurality of standard execution steps based on a step conversion model; a processing unit, configured to transmit the plurality of execution steps of the standard to a text understanding model, and process the plurality of execution steps to obtain execution search conditions; A search unit, configured to search a preset knowledge base based on the execution search condition to obtain a knowledge statement; The generating unit is used to output the plurality of execution steps of the standard, the execution search conditions and the knowledge statements to a test case generation model to generate an automated test case.

9. A test case generation device, characterized in that: include: CPU, memory, input and output interfaces, wired or wireless network interfaces, and power supply; The memory is a transient storage memory or a persistent storage memory; The central processing unit is configured to communicate with the memory and execute instructions in the memory on the device to perform the method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that The method comprises instructions, which, when executed on a computer, cause the computer to perform the method according to any one of claims 1 to 7.