Method and device for automatically generating test case and medium

Automated test case generation using NLP and computer vision technologies addresses manual intervention issues, enhancing test case quality and efficiency by accurately extracting and integrating necessary information.

CN119088673APending Publication Date: 2024-12-06SHUI YOU INFORMATION TECH CO LTD
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202411001201.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-24
Publication Date
2024-12-06

AI Technical Summary

Technical Problem

Existing test case generation methods rely heavily on manual intervention, leading to poor quality and low efficiency due to human errors and inefficiencies.

Method used

Automatically generate test cases using natural language processing and computer vision technologies to extract requirement information, user interface layout, and interface function information, integrating these with a test case generation model to produce high-quality test cases.

Benefits of technology

Reduces human error and improves test case quality by accurately extracting complex content, ensuring efficient and accurate test case generation without manual intervention.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119088673A_ABST
    Figure CN119088673A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a method and device for automatically generating a test case and a medium, which are used for improving the quality of the test case, and the method comprises the following steps: extracting demand information from a demand document according to a natural language processing technology; analyzing the user interface according to a computer vision technology to obtain user interface layout information; extracting interface function information from the application programming interface document and the traffic data; and inputting the demand information, the user interface layout information and the interface information into a preset test case generation model to obtain a test case.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of automation, and in particular to a method, device and medium for automatically generating test cases. Background Art

[0002] Test cases are used to perform test tasks on specific software products to determine whether the product can normally implement the required functions. In the prior art, test cases are usually created by manual writing, and the quality of the generated test cases is low. Therefore, how to improve the quality of test cases has become a technical problem that needs to be solved. Summary of the invention

[0003] In view of the above problems, the purpose of this application is to provide a method, device and medium for automatically generating test cases to improve the quality of test cases. The specific scheme is as follows:

[0004] In a first aspect, an embodiment of the present application provides a method for automatically generating a test case, the method comprising:

[0005] Extract requirement information from requirement documents based on natural language processing technology;

[0006] Analyze the user interface according to computer vision technology to obtain user interface layout information;

[0007] Extract interface function information from application programming interface documents and traffic data;

[0008] The requirement information, the user interface layout information and the interface function information are input into a preset test case generation model to obtain a test case.

[0009] Optionally, extracting requirement information from the requirement document according to natural language processing technology includes:

[0010] Obtaining a requirements document; the requirements document includes user stories, scenario descriptions, and functional descriptions;

[0011] The requirement document is analyzed according to natural language processing technology to obtain the requirement information; the requirement information includes user story content, function description content and application scenarios of test cases.

[0012] Optionally, analyzing the requirement document according to natural language processing technology to obtain the requirement information includes:

[0013] Performing part-of-speech analysis on the content in the demand document to obtain a preprocessed document;

[0014] The pre-processed document is analyzed according to the natural language processing technology to obtain the demand information.

[0015] Optionally, analyzing the user interface according to computer vision technology to obtain user interface layout information includes:

[0016] Acquire a user interface image; the user interface image includes an interface layout and interactive elements;

[0017] Identify, based on computer vision technology, properties of components contained in the user interface image, layout of the components, and interaction rules of the components;

[0018] User interface layout information is generated based on the attributes of the components, the layout of the components and the interaction rules of the components; the user interface information includes the layout structure and interaction path of the components.

[0019] Optionally, extracting interface information from the application programming interface document and traffic data includes:

[0020] Obtaining the application programming interface document and the traffic data;

[0021] Extracting interface function information from the application programming interface document; the interface function information includes a function description of the interface, parameters of the interface, a type of the interface, and a response format of the interface;

[0022] Analyze the traffic data and interface usage information;

[0023] The interface function information and the interface usage information are aggregated to obtain the interface information.

[0024] Optionally, after inputting the requirement information, the user interface layout information and the interface information into a preset test case generation model to obtain a test case, the method further includes:

[0025] Monitor the requirement document and system code to obtain monitoring results;

[0026] If the monitoring result is that at least one of the requirement document and the system code has changed, a test case for testing the affected function is generated.

[0027] In a second aspect, an embodiment of the present application provides a device for automatically generating test cases, the device comprising:

[0028] A requirement information acquisition module is used to extract requirement information from requirement documents based on natural language processing technology;

[0029] A user interface layout information acquisition module is used to analyze the user interface based on computer vision technology to obtain user interface layout information;

[0030] An interface information acquisition module is used to extract interface information from application programming interface documents and traffic data;

[0031] The test case generation module is used to input the requirement information, the user interface layout information and the interface information into a preset test case generation model to obtain a test case.

[0032] Optionally, the demand information acquisition module is specifically used to:

[0033] Obtaining a requirements document; the requirements document includes user stories, scenario descriptions, and functional descriptions;

[0034] The requirement document is analyzed according to natural language processing technology to obtain the requirement information; the requirement information includes user story content, function description content and application scenarios of test cases.

[0035] Optionally, the device further comprises: a monitoring module;

[0036] The monitoring module is used to monitor the requirement document and system code to obtain monitoring results;

[0037] The test case generation module is further used to generate a test case for testing the affected function if the monitoring result is that at least one of the requirement document and the system code has changed.

[0038] In a third aspect, an embodiment of the present application provides a computer storage medium for storing a computer program, which, when executed, is used to implement any of the methods for automatically generating test cases described above.

[0039] Compared with the prior art, this application has the following beneficial effects:

[0040] By extracting requirement information from the requirement document according to natural language processing technology, and analyzing the user interface according to computer vision technology, the user interface layout information is obtained. The interface function information is extracted from the application programming interface document and the traffic data. The requirement information, the user interface layout information and the interface information are input into the preset test case generation model to obtain the test case, thereby realizing the automatic generation of the test case without human participation, reducing the quality reduction of the test case due to human factors. In addition, since the embodiment of the present application uses natural language processing technology to extract the requirement information, and computer vision technology to obtain the user interface layout information, the recognition and extraction of complex content are realized, so that the extracted requirement information and user interface layout information are more accurate, and the quality of the generated test cases is further improved. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0042] Figure 1 A flowchart of a method for automatically generating test cases provided in an embodiment of the present application;

[0043] Figure 2 A schematic diagram of a possible user interface provided in an embodiment of the present application;

[0044] Figure 3 A schematic diagram of a possible layout tree structure diagram provided in an embodiment of the present application;

[0045] Figure 4 A schematic diagram of the structure of a device for automatically generating test cases provided in an embodiment of the present application. DETAILED DESCRIPTION

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

[0047] The terms "including" and "having" and any variations thereof in the specification and claims of the present application and the above-mentioned drawings are intended to cover non-exclusive inclusions. For example, a process, method 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 these processes, methods, products or apparatuses.

[0048] The inventor analyzed the background technology and found that the automated testing tools in the prior art can only automate part of the process of generating test cases. That is to say, whether the prior art adopts the method of manual writing or the method of using automated testing tools, a large amount of manual intervention is required to generate the corresponding test cases. However, when manual intervention is performed, problems such as omissions and redundancy are prone to occur, resulting in poor quality of the generated test cases and low generation efficiency. In order to solve this technical problem, the technical solution adopted by this application is as follows.

[0049] like Figure 1As shown, the embodiment of the present application provides a method for automatically generating test cases, the method comprising:

[0050] S101: Extract requirement information from the requirement document according to natural language processing technology.

[0051] The embodiment of the present application is based on natural language processing (Natural Language Processing, NLP) technology, and extracts demand information from the demand document, so that when complex language is included in the demand document, the content contained in the demand document can still be accurately extracted, and a reliable basis is provided for the generation of subsequent test cases. It should be noted that the embodiment of the present application does not limit the specific use of NLP technology, such as rules or models generated based on NLP technology, extracting demand information. The embodiment of the present application uses a text deep learning model trained based on NLP technology to extract demand information as an example for subsequent description. In addition, the embodiment of the present application can be used to generate test cases for software or systems.

[0052] For example, text deep learning models trained based on NLP technology, such as the Bidirectional Encoder Representations from Transformers (BERT) and Generative Pre-Trained (GPT), are used to perform semantic analysis on requirement documents to achieve understanding of complex natural language descriptions and ensure the accuracy and comprehensiveness of the extracted requirement information.

[0053] In an optional embodiment, extracting requirement information from the requirement document according to natural language processing technology includes:

[0054] Obtain requirements documents; requirements documents include user stories, scenario descriptions, and functional descriptions;

[0055] The requirement document is analyzed according to natural language processing technology to obtain requirement information; the requirement information includes user story content, functional description content and application scenarios of test cases.

[0056] A requirements document is a document that clearly describes the functions that the software must have, and includes at least functional descriptions, user stories, and scenario descriptions.

[0057] Specifically, the demand document is analyzed based on natural language processing technology to obtain demand information, including:

[0058] Perform part-of-speech analysis on the content in the requirement document to obtain a preprocessed document;

[0059] The pre-processed documents are analyzed according to natural language processing technology to obtain demand information.

[0060] Before performing part-of-speech analysis on the content in the requirements document, it is necessary to first perform word segmentation on the content contained in the requirements document to obtain independent words or phrases. Remove stop words from the obtained words and phrases. Stop words are common words that do not contain actual meaning, such as, of, is, etc. Perform part-of-speech analysis on the remaining words and phrases in the requirements document to obtain the part-of-speech of each word and phrase, and mark the part-of-speech corresponding to the word or phrase in the requirements document to obtain a preprocessed document. For example, when the content in the requirements document is to search in a database based on user input content, the word segmentation result is based on, user, of, input content, in, database, in, conduct, search. The words obtained after removing stop words are user, input content, database, search. Mark the parts of speech corresponding to the words to obtain user-noun, input content-noun, database-noun, and search-verb.

[0061] The preprocessed documents, predefined functional keywords and user story templates are input into the text deep learning model, so that the text deep learning model outputs the requirement information of the application scenario containing at least the user story content, functional description content and test cases. Among them, the predefined functional keywords are keywords related to the functions contained in the functional description, so as to help the text deep learning model to more accurately identify and extract the functional description. For example, when the function contained in the functional description is query, the functional keywords can be keywords similar to the query function, such as query, search, and retrieval. The user story template is a format or framework for describing how users use the system or software to achieve user purposes, including information such as user roles, user goals, functions required to achieve goals, and the role played in achieving goals. For example, as a user role A, if you want to achieve user goal B, you need to adopt function C to play role D.

[0062] S102: Analyze the user interface according to computer vision technology to obtain user interface layout information.

[0063] By using computer vision technology to analyze the user interface, even when there are relatively complex layouts and interactive elements in the user interface (UI), the user interface layout information can still be accurately extracted from the UI.

[0064] Specifically, you can choose to use an image deep learning model trained based on computer vision technology, such as the YOLO (You Only Look Once, YOLO) model in the real-time target detection algorithm, the Faster R-CNN (Faster Region-based Convolutional Neural Network, Faster R-CNN) model in the region-based target detection algorithm, etc.

[0065] It should be noted that in addition to the use of computer vision technology to analyze the user interface in the embodiment of the present application, it is also possible to combine natural language processing technology on the basis of computer vision technology to obtain a multimodal deep learning model, and use the multimodal deep learning model to analyze the user interface. In addition, the multimodal deep learning model in the embodiment of the present application can also be continuously optimized, specifically including: verifying and parsing the results obtained by the analysis through automated tools, and automatically correcting them, and then using a manual review mechanism to manually review and adjust the automatically corrected results to ensure the accuracy of the results output by the multimodal deep learning model. Regularly collect actual usage feedback, and feed back the parsed error content and correction information to the multimodal deep learning model through a feedback loop to enhance the learning and adaptability of the model.

[0066] In an optional embodiment, the user interface is analyzed according to computer vision technology to obtain user interface layout information, including:

[0067] Acquire a user interface image; the user interface image includes an interface layout and interactive elements;

[0068] Using computer vision technology, identify the properties of components contained in the user interface image, the layout of components, and the interaction rules of components;

[0069] Based on the properties of the components, the layout of the components and the interaction rules of the components, the user interface layout information is generated; the user interface information includes the layout structure and the interaction path of the components.

[0070] Specifically, the user interface image is an image including a complete user interface layout and all interactive elements contained in the user interface, and can be a user interface in the form of an image such as a user interface screenshot or a user interface photo. The user interface image is grayed to reduce the complexity of image processing. A denoising algorithm is used to remove noise and interference in the grayed user interface image, and an edge detection technology is used to identify the denoised user interface image to highlight the outlines of each component in the user interface image, thereby obtaining a preprocessed user interface image.

[0071] The preprocessed user interface image is input into the image deep learning model to output the properties of each component contained in the user interface image, the layout of each component, and the interaction rules of each component. The properties of the component include the configured behavior, appearance, and content of the component.

[0072] Further, based on the properties of the components, the layout of the components and the interaction rules of the components, generating the user interface layout information includes constructing a layout tree structure diagram based on the properties of the components and the layout of the components. Based on the interaction rules of the components, the layout of the components and the properties of the components, an interaction path is generated, and the interaction path is combined with the layout tree structure diagram to obtain the user interface layout information. Thus, the user interface layout information can reflect the positional relationship between the components and the possible interaction behaviors of the user with the components.

[0073] Specifically, based on the layout of the components, nodes in the layout tree structure diagram are generated. For example, each component corresponds to a node in the layout tree structure diagram, and the attributes of the component are used as the attributes of the node corresponding to the component. If there is a nested relationship between components, the node corresponding to the nested component is used as a child node under the node corresponding to the component.

[0074] To facilitate understanding, the following example is given:

[0075] like Figure 2 As shown in the figure, when the user interface image includes a search area, a search content input box, a search button and a search content display area, the layout of the component is that the search area is nested with a search content input box and a search button, and the search content display area is independent of the search area. Therefore, the generated layout tree structure diagram is as follows Figure 3 As shown, the first-level node in the layout tree structure diagram includes a search area and a search content display area. The nodes corresponding to the search content input box and the search button are second-level nodes under the node corresponding to the search area, that is, the nodes corresponding to the search content input box and the search button are child nodes of the node corresponding to the search area.

[0076] Interaction rules include the operations that users need to perform when interacting with components, as well as the responses of components during the interaction process. Interaction rules can specifically include: input rules, output rules, state transition rules, validation rules, and error handling rules.

[0077] The input rules include: the type of data that the user is allowed to input into the component, and the format that the data needs to be in. For example, the input rule of a text box may be to allow only Chinese characters to be input.

[0078] Output rules include: what a component needs to display or output after receiving input or a specific event occurs. For example, an output rule can be to display a message box or jump to another page when a user clicks a button.

[0079] State transition rules include: conditions that trigger the transition of components between different states. For example, a state transition rule can be that a button changes from the "enabled" state to the "unenabled" state after being clicked.

[0080] The validation rules include: the requirements or formats that the user input must meet when validating the user input. For example, the validation rule may be to verify whether the content entered by the user is a valid email address.

[0081] Error handling rules include the response that a component needs to take when a user enters invalid data or performs an illegal operation. For example, an error handling rule might display an error message when a user attempts to submit an empty form.

[0082] Based on the layout, properties and interaction rules of the components, a path through which the user may interact with the components is generated, and the path through which the user may interact with the components is used as the user interaction path. For example, when the user interface includes a username input box, a password input box and a submit button, the user interaction path includes two user interaction paths, namely, first clicking the username input box, then clicking the password input box, and finally clicking the submit button, and first clicking the password input box, then clicking the username input box, and finally clicking the submit button.

[0083] It should be noted that after obtaining the user interface layout information, the embodiment of the present application can also use a manual method to verify and adjust the user interface layout information to ensure the accuracy of the user interface layout information.

[0084] S103: Extracting interface information from the application programming interface document and the traffic data.

[0085] Application Programming Interface (API) documents contain detailed information such as functions, parameters, response formats, etc. of the API in the software system. The embodiment of the present application can combine the visual model with the language model to analyze the API document in a multimodal learning technology.

[0086] In an optional embodiment, extracting interface information from the application programming interface document and the traffic data includes:

[0087] Obtain API documentation and traffic data;

[0088] Extracting interface function information from the application programming interface document; the interface function information includes interface function description, interface parameters, interface type and interface response format;

[0089] Analyze traffic data and interface usage information;

[0090] The interface function information and the interface usage information are summarized to obtain the interface information.

[0091] Use rules or models created based on multimodal learning technology to extract interface function information including interface function description, interface parameters, interface type and interface response format from API documents

[0092] Monitor the calls of the interface, collect the actual requests received by the interface and the response data returned, and obtain the interface traffic data. Analyze the traffic data to determine the common usage patterns of the system or software, such as frequently called interfaces, the time period with the highest interface call frequency, etc. The traffic data can also be further analyzed to discover potential problems related to the interface, such as the response time process of the interface, high error rate, and potential safety hazards. Common usage patterns and potential problems are used as interface usage information.

[0093] S104: Input the requirement information, user interface layout information and interface information into a preset test case generation model to obtain a test case.

[0094] The requirement information, user interface layout information and interface information are integrated to obtain integrated information, and the integrated information is input into the test case generation model to obtain a test case for the system or software. The test case includes key data such as the test case objective, preconditions, test steps, input data and expected results.

[0095] It should be noted that the test case generation model in the embodiment of the present application also introduces an adaptive learning mechanism, which optimizes the test case generation model according to historical test data to avoid redundancy and insufficient coverage. In addition, the generated test cases are adjusted and screened using an optimization algorithm to improve the test efficiency and coverage of the test cases. Among them, the test case generation model is optimized according to historical test data, specifically including: regularly analyzing the test results and coverage of the test cases, and identifying the deficiencies and redundancies of the test cases. Based on the deficiencies and redundancies of the test cases, the test case generation model is dynamically adjusted to optimize the coverage and quantity of the generated test cases. Combined with artificial intelligence and expert optimization feedback, the test cases are secondary optimized to adjust the test case generation model in only one step to ensure that the test cases generated by the test case generation model have the characteristics of high quality and high coverage.

[0096] By extracting requirement information from the requirement document according to natural language processing technology, and analyzing the user interface according to computer vision technology, the user interface layout information is obtained. The interface function information is extracted from the application programming interface document and the traffic data. The requirement information, the user interface layout information and the interface information are input into the preset test case generation model to obtain the test case, thereby realizing the automatic generation of the test case without human participation, reducing the quality reduction of the test case due to human factors. In addition, since the embodiment of the present application uses natural language processing technology to extract the requirement information, and computer vision technology to obtain the user interface layout information, the recognition and extraction of complex content are realized, so that the extracted requirement information and user interface layout information are more accurate, and the quality of the generated test cases is further improved.

[0097] In an optional embodiment, after inputting the requirement information, the user interface layout information and the interface information into a preset test case generation model to obtain the test case, the method further includes:

[0098] Monitor requirement documents and system codes to obtain monitoring results;

[0099] If the monitoring result is that at least one of the requirement document and the system code has changed, a test case is generated to test the affected functions.

[0100] Monitor the requirements document and system code in real time to obtain monitoring results. If the monitoring result shows that at least one of the requirements document and system code has changed, the generation of new test cases is automatically triggered. Among them, the new test cases are test cases used to test the affected functions, thereby reducing the number of test cases required to be generated when the system or software version is updated, and being able to generate test cases for the changed content in a timely manner, so as to promptly discover whether the changed content is stable, and improve the quality and stability of the software and system.

[0101] It should be noted that each time a test case is generated, the embodiment of the present application will save the test case and the system or software version corresponding to the test case to achieve archiving of historical data, which is convenient for operation and maintenance personnel to maintain. In addition, the embodiment of the present application can also backtrack and compare the test case and the system or software version to ensure that the test case is consistent with the requirements of the system or software.

[0102] like Figure 4 As shown, an embodiment of the present application provides a device for automatically generating test cases, the device comprising:

[0103] The demand information acquisition module 401 is used to extract demand information from the demand document according to natural language processing technology;

[0104] A user interface layout information acquisition module 402 is used to analyze the user interface according to computer vision technology to obtain user interface layout information;

[0105] The interface information acquisition module 403 is used to extract interface function information from the application programming interface document and the flow data;

[0106] The test case generation module 404 is used to input the requirement information, the user interface layout information and the interface function information into a preset test case generation model to obtain a test case.

[0107] In an optional embodiment, the demand information acquisition module 401 is specifically used to:

[0108] Obtain requirements documents; requirements documents include user stories, scenario descriptions, and functional descriptions;

[0109] The requirement document is analyzed according to natural language processing technology to obtain requirement information; the requirement information includes user story content, functional description content and application scenarios of test cases.

[0110] In an optional embodiment, the demand information acquisition module 401 is specifically used to:

[0111] Perform part-of-speech analysis on the content in the requirement document to obtain a preprocessed document;

[0112] The pre-processed documents are analyzed according to natural language processing technology to obtain demand information.

[0113] In an optional embodiment, the user interface layout information acquisition module 402 is specifically used to:

[0114] Acquire a user interface image; the user interface image includes an interface layout and interactive elements;

[0115] Using computer vision technology, identify the properties of components contained in the user interface image, the layout of components, and the interaction rules of components;

[0116] Based on the properties of the components, the layout of the components and the interaction rules of the components, the user interface layout information is generated; the user interface information includes the layout structure and the interaction path of the components.

[0117] In an optional embodiment, the interface information acquisition module 403 is specifically used to:

[0118] Obtain API documentation and traffic data;

[0119] Extracting interface function information from the application programming interface document; the interface function information includes interface function description, interface parameters, interface type and interface response format;

[0120] Analyze traffic data and interface usage information;

[0121] The interface function information and the interface usage information are summarized to obtain the interface information.

[0122] In an optional embodiment, the above-mentioned device further includes: a monitoring module;

[0123] Monitoring module, used to monitor requirement documents and system codes and obtain monitoring results;

[0124] The test case generation module 404 is further configured to generate a test case for testing the affected function if the monitoring result indicates that at least one of the requirement document and the system code has changed.

[0125] By extracting requirement information from the requirement document according to natural language processing technology, and analyzing the user interface according to computer vision technology, the user interface layout information is obtained. The interface function information is extracted from the application programming interface document and the traffic data. The requirement information, the user interface layout information and the interface information are input into the preset test case generation model to obtain the test case, thereby realizing the automatic generation of the test case without human participation, reducing the quality reduction of the test case due to human factors. In addition, since the embodiment of the present application uses natural language processing technology to extract the requirement information, and computer vision technology to obtain the user interface layout information, the recognition and extraction of complex content are realized, so that the extracted requirement information and user interface layout information are more accurate, and the quality of the generated test cases is further improved.

[0126] An embodiment of the present application provides a computer storage medium for storing a computer program. When the computer program is executed, it is used to implement any of the above-mentioned methods for automatically generating test cases.

[0127] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.

[0128] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.

[0129] The technical content provided by the present invention is introduced in detail above. Specific examples are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. At the same time, for general technical personnel in the field, according to the idea of ​​the present invention, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.

Claims

1. A method for automatically generating test cases, It is characterized in that The method comprises: Extract requirement information from requirement documents based on natural language processing technology; Analyze the user interface according to computer vision technology to obtain user interface layout information; Extract interface function information from application programming interface documents and traffic data; The requirement information, the user interface layout information and the interface information are input into a preset test case generation model to obtain a test case.

2. The method according to claim 1, It is characterized in that The extracting requirement information from the requirement document according to the natural language processing technology includes: Obtaining a requirements document; the requirements document includes user stories, scenario descriptions, and functional descriptions; The requirement document is analyzed according to natural language processing technology to obtain the requirement information; the requirement information includes user story content, function description content and application scenarios of test cases.

3. The method according to claim 2, It is characterized in that The step of analyzing the demand document according to the natural language processing technology to obtain the demand information includes: Performing part-of-speech analysis on the content in the demand document to obtain a preprocessed document; The pre-processed document is analyzed according to the natural language processing technology to obtain the demand information.

4. The method according to claim 1, It is characterized in that The step of analyzing the user interface according to computer vision technology to obtain user interface layout information includes: Acquire a user interface image; the user interface image includes an interface layout and interactive elements; Identify, based on computer vision technology, properties of components contained in the user interface image, layout of the components, and interaction rules of the components; User interface layout information is generated based on the attributes of the components, the layout of the components and the interaction rules of the components; the user interface information includes the layout structure and interaction path of the components.

5. The method according to claim 1, It is characterized in that Extracting interface information from the application programming interface document and traffic data includes: Obtaining the application programming interface document and the traffic data; Extracting interface function information from the application programming interface document; the interface function information includes a function description of the interface, parameters of the interface, a type of the interface, and a response format of the interface; Analyze the traffic data and interface usage information; The interface function information and the interface usage information are aggregated to obtain the interface information.

6. The method according to claim 1, It is characterized in that After inputting the requirement information, the user interface layout information and the interface information into a preset test case generation model to obtain a test case, the method further includes: Monitor the requirement document and system code to obtain monitoring results; If the monitoring result is that at least one of the requirement document and the system code has changed, a test case for testing the affected function is generated.

7. A device for automatically generating test cases, It is characterized in that The device comprises: A requirement information acquisition module is used to extract requirement information from requirement documents based on natural language processing technology; A user interface layout information acquisition module is used to analyze the user interface based on computer vision technology to obtain user interface layout information; An interface information acquisition module is used to extract interface information from application programming interface documents and traffic data; The test case generation module is used to input the requirement information, the user interface layout information and the interface information into a preset test case generation model to obtain a test case.

8. The device according to claim 7, It is characterized in that The demand information acquisition module is specifically used for: Obtaining a requirements document; the requirements document includes user stories, scenario descriptions, and functional descriptions; The requirement document is analyzed according to natural language processing technology to obtain the requirement information; the requirement information includes user story content, function description content and application scenarios of test cases.

9. The device according to claim 7, It is characterized in that The device also includes: a monitoring module; The monitoring module is used to monitor the requirement document and system code to obtain monitoring results; The test case generation module is further used to generate a test case for testing the affected function if the monitoring result is that at least one of the requirement document and the system code has changed.

10. A computer storage medium, It is characterized in that Used to store a computer program, which, when executed, is used to implement the method for automatically generating test cases as described in any one of claims 1 to 6 above.

Citation Information

Cited By

  • UI (User Interface) test and API (Application Program Interface) test collaborative test method based on business logic chain atlas

    CN121326775A

  • A ui test and api test collaborative test method based on a service logic chain graph

    CN121326775B