Software requirement document analysis and test case automatic generation method and system based on large language model

Through the method based on the large language model, the software requirement documents are parsed and tested cases are generated, which solves the problems of low efficiency and poor accuracy in writing traditional test cases, and achieves more efficient and accurate test case generation and coverage.

CN119512959APending Publication Date: 2025-02-25SHANGHAI FOREIGN SERVICE ABROAD EMPLOYEE SERVICE CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411651263.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-19
Publication Date
2025-02-25

AI Technical Summary

Technical Problem

Traditional test case writing methods are inefficient and inaccurate, making it difficult to ensure comprehensiveness and accuracy, especially when software requirements are complex and rapidly changing.

Method used

The software requirements document analysis and automatic generation of test cases based on the large language model are adopted. By analyzing, chunking and generating prompt words on the software requirements document, the large language model is called to generate test cases and display them.

Benefits of technology

It significantly improves the efficiency and accuracy of test case writing, expands the test coverage, flexibly adapts to changes in demand, and optimizes the software testing process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119512959A_ABST
    Figure CN119512959A_ABST
Patent Text Reader

Abstract

The invention provides a software demand document analysis and test case automatic generation method and system based on a large language model, and the method comprises the following steps: obtaining a software demand document, and analyzing the software demand document to obtain analysis information; carrying out blocking on the analysis information to obtain blocking information; generating a corresponding cue word based on the block information and a test case design method specified by a user to call a large language model, and generating a test case corresponding to the block information based on the cue word; summarizing and formatting the test cases and then displaying the test cases; according to the method, the efficiency and accuracy of test case writing are remarkably improved, the test coverage range is expanded, and the method flexibly adapts to demand changes, so that the software test process is optimized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of software technology, and in particular relates to software testing, and specifically to a method and system for automatically generating software requirement documents and test cases based on a large language model. Background Art

[0002] In modern software development, test case writing is key to ensuring that software quality and functionality meet requirements. However, as the complexity of software systems increases, traditional test case writing methods face many challenges. These challenges are particularly prominent when dealing with complex requirement documents and frequent requirement changes.

[0003] Traditional test case writing relies on manual operations. Testers need to carefully read the requirements document, understand the functional points and design test cases. This process is not only cumbersome and time-consuming, but also susceptible to personal understanding bias. For example, key test scenarios may be missed or accurate test cases may not be designed due to vague requirements. In addition, when the requirements document changes, the process of manually updating the test cases is cumbersome and easily leads to inconsistencies between the test cases and the actual requirements.

[0004] As software requirements become more complex, traditional methods have difficulty ensuring the comprehensiveness and accuracy of test cases. Test cases may not cover all edge cases or complex interaction scenarios, resulting in the omission of potential defects. At the same time, the shortening of development cycles has increased the urgency of test case writing and updating, and the inefficiency of traditional methods has become more prominent. Summary of the invention

[0005] The purpose of the present invention is to provide a method and system for automatically generating software requirement documents and test cases based on a large language model, so as to solve the problems of low efficiency and inaccuracy in test case writing in the prior art.

[0006] In a first aspect, the present invention provides a method for automatically generating software requirement documents and test cases based on a large language model, comprising the following steps: obtaining a software requirement document, and parsing the software requirement document to obtain parsed information; dividing the parsed information into blocks to obtain block information; generating corresponding prompt words based on the block information and a test case design method specified by a user, so as to call a large language model and generate test cases corresponding to the block information based on the prompt words; and displaying the test cases after summarizing and formatting them.

[0007] In the present invention, by parsing the software requirement document, parsing information can be obtained, and by dividing the parsing information into blocks to obtain block information, then based on the block information and the test case design method specified by the user, a large language model is used to generate corresponding test cases, and the test cases are displayed to facilitate user acquisition, thereby significantly improving the efficiency and accuracy of test case writing, expanding the test coverage, and flexibly adapting to changes in requirements, thereby optimizing the software testing process.

[0008] In an implementation of the first aspect, parsing the software requirement document to obtain parsing information includes: extracting information from the software requirement document according to a user-specified requirement analysis model to obtain description information; integrating the description information into a Markdown document as the parsing information; and the order in which the content of the parsing information is included is consistent with the order in which the content of the software requirement document is included.

[0009] In an implementation of the first aspect, extracting information from the software requirement document to obtain descriptive information according to a requirement analysis pattern specified by a user includes: extracting information from content in the software requirement document to obtain descriptive information according to the requirement analysis pattern; wherein the content in the software requirement document includes at least any one of the following or a combination of two or more: text, table, image; the requirement analysis pattern is used to determine which content in the software requirement document to extract information from; when the requirement analysis pattern includes extracting information from text, and the content in the software requirement document contains text, extracting information from the content in the software requirement document according to the requirement analysis pattern includes: extracting information from the text information extraction to obtain text content corresponding to the text; when the requirement analysis mode includes extracting information from tables, and the content in the software requirement document includes tables, extracting information from the content in the software requirement document according to the requirement analysis mode includes: extracting information from the table to obtain table data in the table; when the requirement analysis mode includes extracting information from images, and the content in the software requirement document includes images, extracting information from the content in the software requirement document according to the requirement analysis mode includes: generating a description text of the image; the description information includes at least any one of the following or a combination of two or more: the text content, the table data, and the description text.

[0010] In an implementation of the first aspect, segmenting the parsed information to obtain segmented information includes: when there is a page identifier in the parsed information, segmenting the parsed information according to the page identifier to obtain the segmented information; when there is no page identifier in the parsed information, segmenting the parsed information according to a preset length to obtain the segmented information; wherein each segmented information includes preceding information having a first preset number of characters and / or following information having a second preset number of characters.

[0011] In an implementation of the first aspect, when the parsed information is divided into blocks according to the page identifier, the block information located on the homepage includes the following information whose number of characters at the head of the block information of the next page is a second preset number; the block information located between the first and last pages includes the previous information whose number of characters at the tail of the block information of the adjacent previous page is a first preset number, and the following information whose number of characters at the head of the block information of the next page is a second preset number; the block information located on the last page includes the previous information whose number of characters at the tail of the block information of the adjacent previous page is a first preset number The number of preceding information; when the parsed information is divided into blocks according to a preset length, the first block information includes the following information whose number of characters at the head in the next block information is the second preset number; the block information between the first and the last includes the preceding information whose number of characters at the tail in the adjacent previous block information is the first preset number, and the following information whose number of characters at the head in the next block information is the second preset number; the last block information includes the preceding information whose number of characters at the tail in the previous block information is the first preset number.

[0012] In an implementation of the first aspect, generating corresponding prompt words based on the block information and a test case design method specified by a user to call a large language model and generate a test case corresponding to the block information based on the prompt words includes: matching a prompt word template according to the block information and the test case design method to generate a prompt word; and inputting the block information and the prompt word into the large language model so that the large language model outputs the test case.

[0013] In an implementation of the first aspect, the display includes at least any one of the following display methods or a combination of two or more of them: format display, use case view display, download sharing display; wherein, the format display includes at least any one of the following or a combination of two or more of them: text file, Markdown file, CSV file; the use case view display displays the use case name, test steps, expected results and prerequisites of each test case in the form of a mind map; the download sharing display includes a download link corresponding to the test case in each format.

[0014] In a second aspect, the present invention provides a software requirement document parsing and test case automatic generation system based on a large language model, the system comprising: a document parsing module, used to obtain a software requirement document, and parse the software requirement document to obtain parsed information; an intelligent blocking module, used to block the parsed information to obtain block information; a use case generation module, used to generate corresponding prompt words based on the block information and a user-specified test case design method, so as to call the large language model and generate test cases corresponding to the block information based on the prompt words; a use case display module, used to summarize and format the test cases for display.

[0015] As described above, the method and system for automatically generating software requirement documents and test cases based on a large language model according to the present invention can significantly improve the efficiency and accuracy of software testing, and has the following beneficial effects:

[0016] (1) Compared with the prior art, the present invention uses a large language model to automatically parse software requirement documents, which reduces the time for manually writing test cases and significantly improves the speed and efficiency of test case generation.

[0017] (2) In the present invention, the automated parsing and generation process reduces misunderstandings and errors in manual operations, making the generated test cases more accurate and ensuring comprehensive coverage of each functional point and boundary condition in the software requirement document.

[0018] (3) The present invention intelligently identifies various functional scenarios and test conditions in the software requirement document, and the generated test cases can cover more test scenarios and boundary conditions, thereby improving the comprehensiveness and depth of the test.

[0019] (4) The present invention can flexibly adapt to changes in requirements, automatically update test cases, and ensure the consistency of test cases with actual requirements, thereby improving the timeliness and effectiveness of the test.

[0020] (5) The present invention not only improves the automation level of the test process, but also improves the management and display methods of test cases, provides display options in multiple formats, and displays test cases in a user-friendly interface, thereby improving the convenience and efficiency of the test process.

[0021] In summary, the present invention effectively solves the problems of low efficiency, poor accuracy and insufficient coverage in traditional test case writing methods, significantly improves the automation level and quality assurance capability of software testing, and provides strong support for testing work in the software development process. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] Figure 1Shown is a flowchart of the working principle of the method for automatically generating software requirement documents and test cases based on a large language model according to an embodiment of the present invention.

[0023] Figure 2 Shown is a flowchart of the working principle of parsing a software requirement document according to an embodiment of the present invention.

[0024] Figure 3 Shown is a flow chart of the working principle of dividing parsed information into blocks and generating test cases according to an embodiment of the present invention.

[0025] Figure 4 Shown is a flowchart of the method for automatically generating software requirement documents and test cases based on a large language model according to an embodiment of the present invention.

[0026] Figure 5 Shown is a flowchart of parsing the software requirement document to obtain parsing information according to an embodiment of the present invention.

[0027] Figure 6 A flowchart of the test case design method based on the block information and user-specified according to an embodiment of the present invention is shown, which generates corresponding prompt words to call a large language model and generate test cases corresponding to the block information based on the prompt words.

[0028] Figure 7 Shown is a structural block diagram of the software requirement document parsing and test case automatic generation system based on a large language model according to an embodiment of the present invention. DETAILED DESCRIPTION

[0029] The following describes the embodiments of the present invention by specific examples, and those skilled in the art can easily understand other advantages and effects of the present invention from the contents disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present invention. It should be noted that the following embodiments and features in the embodiments can be combined with each other without conflict.

[0030] It should be noted that the illustrations provided in the following embodiments are only schematic illustrations of the basic concept of the present invention. The illustrations only show components related to the present invention rather than being drawn according to the number, shape and size of components in actual implementation. In actual implementation, the type, quantity and proportion of each component may be changed arbitrarily, and the component layout may also be more complicated.

[0031] In recent years, large language models (such as Ollama, GLM-4, and GPT-4) have made significant progress in the field of natural language processing. These models have strong language understanding and generation capabilities and can process complex natural language texts. By using large language models to parse requirement documents, the efficiency and accuracy of test case generation can be significantly improved. These models can not only automatically parse requirement documents, but also generate comprehensive test cases covering various functional scenarios and boundary conditions, thereby improving test coverage and effectiveness.

[0032] It should be noted that a large language model (LLM) refers to a deep learning model trained with a large amount of text data that can generate natural language text or understand the meaning of language text. Large language models can handle a variety of natural language tasks, such as text classification, question answering, and dialogue, and are an important path to artificial intelligence [1]. Currently, large language models use a Transformer architecture and pre-training objectives (such as Language Modeling) similar to small models. The difference from small models is that they increase model size, training data, and computing resources.

[0033] Ollama is a tool designed for easily deploying and running large language models on a local machine.

[0034] GLM-4 is a large base model released by Zhipu AI.

[0035] GPT-4 is a language model released by OpenAI for the chatbot ChatGPT.

[0036] See also Figures 1 to 7 The following embodiments of the present invention provide a method and system for software requirement document parsing and test case automatic generation based on a large language model, which utilizes an advanced large language model to parse the software requirement document and automatically generates corresponding test cases. This technology significantly improves the efficiency and accuracy of test case writing, expands the test coverage, and flexibly adapts to changes in requirements, thereby optimizing the test process.

[0037] The technical solutions in the embodiments of the present invention will be described in detail below in conjunction with the accompanying drawings in the embodiments of the present invention.

[0038] like Figure 1As shown, in one embodiment, in order to realize automatic generation of test cases, after the user uploads the software requirement document, the document parsing module 101 extracts valid information from the software requirement document (PDF or Word document) and converts the information into a Markdown format that is friendly to the large language model; then, the intelligent segmentation module 102 intelligently segments the requirement content; then, the use case generation module 103 matches the appropriate prompt word template and uses the prompt word engineering technology to generate appropriate prompt words, so that the large language model can correctly generate test cases; the use case display module 104 is responsible for formatting the test cases generated by the large language model, and displaying and managing them in different formats for users to view, manage and use.

[0039] like Figure 1 and Figure 2 As shown, in one embodiment, the document parsing module 101 is responsible for extracting and processing text, tables or images from a PDF or Word document. The following is a specific description:

[0040] For a PDF document, the document parsing module 101 first extracts the text content of each page. This includes identifying and extracting all text information on the page (corresponding to Figure 2 In the "Extract text information" in the document), and organize it into Markdown format to maintain a clear structure. In addition, the document parsing module 101 also identifies and extracts tables in the document (corresponding to Figure 2 The table data is formatted as a Markdown table to ensure the structure and data integrity of the table. If image extraction is enabled, the document parsing module 101 will identify all images from the PDF page and generate image description text (corresponding to the image description text) using image description technology. Figure 2 These descriptions will be integrated into the Markdown document along with the text and table content.

[0041] For a Word document, the document parsing module 101 extracts the text of each paragraph and organizes it in Markdown format, thereby maintaining the structure and format of the paragraph. The document parsing module 101 also identifies and extracts tables in the document and converts them into Markdown tables, ensuring that the structure and content of the table are clear and readable. If image extraction is enabled, the document parsing module 101 extracts all images from the Word document and generates description text, which will be used to supplement the image part in the Markdown document.

[0042] All extracted content, including text, tables, and image descriptions, will be integrated into a structured Markdown document (corresponding to the "parsed information" described below). This document format makes subsequent processing and analysis more efficient, ensures the integrity and readability of the information, and provides a detailed description of requirements for automatically generating test cases.

[0043] like Figure 1 As shown, after receiving the software requirement document uploaded by the user, the document parsing module 101 processes the document according to the requirement analysis mode specified by the user.

[0044] It should be noted that the requirement analysis model is used to determine what content in the software requirement document to extract information from.

[0045] For example, the requirement analysis mode parses all the contents in the software requirement document. When the content in the software requirement document only includes text, the document parsing module 101 only extracts the text content in the software requirement document, excluding tables and images; when the content in the software requirement document includes text and tables, the document parsing module 101 extracts the text content and table data in the software requirement document, but does not process the images; when the content in the software requirement document includes text, tables and images, the document parsing module 101 extracts all the contents in the software requirement document, including text content, tables and images; images will be converted into descriptive text to help understand the image content; other situations are the same as this principle, so they will not be repeated here.

[0046] For another example, the requirement analysis mode is to parse the text in the software requirement document, and the content in the software requirement document includes text and images, then the document parsing module 101 will only extract the text content corresponding to the text, excluding the description text of the image; other situations are the same as this principle, so they will not be described in detail here.

[0047] like Figure 1 and Figure 3 As shown, the information extracted by the document parsing module 101 (i.e. Figure 3 Chunking of Markdown documents in .

[0048] In this embodiment, the extracted requirements document content (Markdown format) is processed in blocks according to the input limit of the large language model to ensure that the size of each block is suitable for the processing capacity of the large language model. This process not only takes into account the maximum number of characters per block (such as 4096 characters), but also retains contextual information to improve the accuracy of generation.

[0049] Specifically, intelligent segmentation is performed based on context information. The document is first segmented according to page identifiers (such as "Page X"). If there is no page identifier in the document, it is segmented according to a fixed length.

[0050] It should be noted that when chunking, each chunk of text (corresponding to the "chunking information" described below) retains a certain context (such as 100 characters before and after) to ensure that the large language model can understand the complete content when generating test cases. This method avoids segmentation in the middle of paragraphs or important information, thereby improving the coherence and relevance of the generated test cases.

[0051] like Figure 3 As shown, test cases are generated according to the large language model selected by the user; specifically, the generation process includes:

[0052] Model call: Based on the document content of the block and the test case design method specified by the user (such as equivalence class division, boundary value analysis), call the corresponding large language model. Note that different test case design methods will correspond to different prompt word templates. Each block will be used as the input of the large language model, and the large language model will generate test cases related to the block content.

[0053] Results collation: The generated test case text will be collated and formatted to ensure its clarity and consistency. This includes removing redundant tags and symbols, adjusting the format to meet the requirements of standard test case documents, and summarizing the generated test cases into the final test document.

[0054] The use case display module 104 is responsible for displaying and managing the generated test cases in different formats to facilitate user viewing, management and use. The following is a specific implementation of the use case display module:

[0055] Multi-format display: Test cases can be displayed in multiple formats to meet different needs of users. These formats include but are not limited to:

[0056] Text file: Displays test cases in a simple text format, suitable for quick viewing and simple text processing.

[0057] Markdown file: presents test cases in Markdown format, suitable for document editing and compatibility with other tools (such as XMind).

[0058] CSV file: Displays test cases in comma-separated value format for further analysis and processing in spreadsheet software such as Excel.

[0059] Use Case View: Displays detailed information of test cases in the form of a mind map. Each test case includes:

[0060] Test case name: The identification name of the test case.

[0061] Test steps: Detailed instructions for execution.

[0062] Expected results: A description of the expected results to help testers verify whether the test passes.

[0063] Preconditions: Conditions that need to be met before executing test cases, including system status, environment configuration, etc.

[0064] File download and sharing:

[0065] Generate download link: For each display format, the system generates a corresponding download link, and users can download the test case file by clicking the link. The download link includes text files, Markdown files, and CSV files.

[0066] File management: The system will temporarily store test case files generated by users and regularly clear expired test case files.

[0067] like Figure 4 As shown, in one embodiment, the present invention provides a method for automatically generating software requirement documents and test cases based on a large language model, comprising the following steps:

[0068] Step S1: Obtain a software requirement document, and parse the software requirement document to obtain parsing information.

[0069] like Figure 5 As shown, in one embodiment, parsing the software requirement document to obtain parsing information includes:

[0070] Step S101: extract information from the software requirement document according to a requirement analysis model specified by a user to obtain description information.

[0071] In one embodiment, extracting information from the software requirement document according to a requirement analysis pattern specified by a user to obtain description information includes: extracting information from content in the software requirement document according to the requirement analysis pattern to obtain description information.

[0072] In one embodiment, the content in the software requirement document includes at least but is not limited to any one or a combination of two or more of the following: text, table, image.

[0073] In this embodiment, the requirement analysis mode is used to determine what content in the software requirement document is to be used for information extraction.

[0074] In one embodiment, the requirement analysis mode is used to determine information extraction from any one or a combination of two or more of text, table and image in the software requirement document.

[0075] Specifically,

[0076] When the demand analysis mode includes extracting information from text, and the content of the software requirement document contains text

[0077] When the software requirement document contains characters, extracting information from the content in the software requirement document according to the requirement analysis mode includes: extracting information from the characters to obtain text content corresponding to the characters.

[0078] It should be noted that natural language processing technology is used to extract text content from software requirement documents, including functional requirements, performance requirements and business rules.

[0079] When the demand analysis mode includes extracting information from a table, and the content of the software requirement document includes a table

[0080] When the software requirement document is in the form, extracting information from the content in the software requirement document according to the requirement analysis mode includes: extracting information from the table to obtain table data in the table.

[0081] It should be noted that the table structure, data and description information are extracted by automatically identifying and parsing the tables in the software requirement document.

[0082] When the demand analysis mode includes extracting information from images, and the content of the software requirement document contains images

[0083] When the image is generated, extracting information from the content in the software requirement document according to the requirement analysis mode includes: generating a description text of the image.

[0084] In one embodiment, a multimodal large model is used to generate a natural language description of the image content, ie, a description text.

[0085] It should be noted that a multimodal large model refers to a model that combines multimodal information such as text, images, videos, and audio for training.

[0086] In this embodiment, the description information includes at least but is not limited to any one or a combination of two or more of the following: the text content, the table data, and the description text.

[0087] Step S102: Integrate the description information into a Markdown document as the parsing information.

[0088] Specifically, the description information is converted into Markdown format and then integrated into a structured Markdown document. This document format makes subsequent processing and analysis more efficient, ensures the integrity and readability of the information, and provides a detailed requirement description for the automatic generation of test cases.

[0089] In one embodiment, the order in which the parsed information includes contents is consistent with the order in which the software requirement document includes contents.

[0090] Specifically, after information extraction from text, tables or images, the corresponding text content, table data or description text, after conversion into Markdown format, will remain consistent with the original order of the corresponding content in the software requirements document (text content corresponds to text, table data corresponds to table, description text corresponds to image), and the relative position relationship will not change.

[0091] It should be noted that step S1 processes the text, tables and images in the software requirement document by combining a large language model and image recognition technology, and structures the parsing results in Markdown format to make the requirement content clearer and facilitate subsequent processing.

[0092] Step S2: Divide the parsed information into blocks to obtain block information.

[0093] In one embodiment, dividing the parsed information into blocks to obtain block information includes:

[0094] When there is a page identifier in the parsed information, the parsed information is divided into blocks according to the page identifier to obtain

[0095] The block information.

[0096] When there is no page identifier in the parsed information, the parsed information is divided into blocks according to a preset length to obtain the

[0097] Describe the block information.

[0098] It should be noted that the specific preset length is not a condition to limit the present invention, and in practical applications, it can be set according to specific application scenarios; for example, it is 4096 characters.

[0099] In this embodiment, each of the block information includes previous information having a first preset number of characters and / or following information having a second preset number of characters.

[0100] In one embodiment, when the parsed information is divided into blocks according to the page identifier, the block information located on the homepage includes the following information whose number of characters at the head is the second preset number in the block information of the next page; the block information located between the first and the last includes the previous information whose number of characters at the tail is the first preset number in the block information of the adjacent previous page, and the following information whose number of characters at the head is the second preset number in the block information of the next page; the block information located on the last page includes the previous information whose number of characters at the tail is the first preset number in the block information of the previous page.

[0101] In one embodiment, when the parsed information is divided into blocks according to a preset length, the first block information includes the following information whose number of characters at the head is the second preset number in the next block information; the block information between the first and the last includes the previous information whose number of characters at the tail is the first preset number in the adjacent previous block information, and the following information whose number of characters at the head is the second preset number in the next block information; the last block information includes the previous information whose number of characters at the tail is the first preset number in the previous block information.

[0102] It should be noted that the specific values ​​of the first preset number and the second preset number are not used as conditions to limit the present invention; in practical applications, the first preset number may be equal to or different from the second preset number.

[0103] In one embodiment, the first preset number is equal to the second preset number.

[0104] Take the example that the first preset number and the second preset number are both 100; specifically, when there is a page identifier in the parsed information, the parsed information is divided into blocks according to the page identifier to obtain the block information, for example, the entire parsed information is 10 pages, each page is a block, the first block information includes the information of the first page and the first 100 characters of the second page; the second block information includes the information of the second page, the last 100 characters of the first page, the first 100 characters of the third page...; the tenth block information includes the information of the tenth page and the last 100 characters of the ninth page.

[0105] Taking the preset length of 1000 characters as an example, when there is no page identifier in the parsed information, the parsed information is divided into blocks according to the preset length to obtain the block information. For example, the entire parsed information contains 10000 characters, then the first block information includes information of the 1st to 1100th characters, the second block information includes information of the 900th to 2100th characters; the third block information includes information of the 1900th to 3100th characters...; the tenth block information includes information of the 8900th to 10000th characters.

[0106] Step S3: Generate corresponding prompt words based on the block information and the test case design method specified by the user, so as to call the large language model and generate test cases corresponding to the block information based on the prompt words.

[0107] It should be noted that the test case design method is an existing technology, such as equivalence class partitioning and boundary value analysis; in the present invention, the user specifies a test case design method according to the block information, and calls the corresponding large language model based on the block information and the specified test case design method to generate the corresponding test case.

[0108] In one embodiment, step S3 includes:

[0109] Scenario identification: Identify the functional scenarios and test conditions in the software requirements document, and determine the functional scenarios and key

[0110] Key point.

[0111] Precondition generation: Generate the preconditions that need to be met before each test case is executed, including system status, environment configuration, etc.

[0112] Configuration and dependencies.

[0113] ·Generate steps and expected results: Design detailed steps for test cases and define expected results to ensure that the test cases are complete.

[0114] Surface and effectiveness.

[0115] Test data generation: Provides test data required for generated test cases, including input data, environment configuration, etc.

[0116] like Figure 6 As shown, in one embodiment, generating corresponding prompt words based on the block information and the test case design method specified by the user, so as to call the large language model and generate the test case corresponding to the block information based on the prompt words includes:

[0117] Step S301: matching a prompt word template according to the block information and the test case design method to generate a prompt word.

[0118] Step S302: input the block information and the prompt word into the large language model, so that the large language model outputs the test case.

[0119] Step S4: Summarize and format the test cases for display.

[0120] Specifically, the generated test cases are first summarized into test documents, which are then formatted and displayed for easy viewing, management and use by users.

[0121] It should be noted that the test cases are formatted to ensure clarity and consistency.

[0122] In one embodiment, formatting the test case includes removing redundant marks and symbols in the test case and adjusting the format of the test case to conform to the requirements of a standard test case document.

[0123] In one embodiment, the display includes at least any one of the following display modes or a combination of two or more of them: format display, use case view display, download sharing display, so as to meet the needs of different users.

[0124] in,

[0125] The format display includes at least but is not limited to any one or a combination of two or more of the following: text file, Markdown file, and CSV file.

[0126] The use case view display is to display the use case name, test steps, expected results and preconditions of each test case in the form of a mind map, thereby providing a user-friendly interface.

[0127] The download sharing display includes a download link corresponding to the test case in each format.

[0128] The present invention can convert text, tables or images in the software requirement document into parsed information in Markdown format by parsing the software requirement document, and divide the parsed information into blocks to obtain block information. Then, based on the block information and the test case design method specified by the user, the large language model is used to generate corresponding test cases, and the test cases are displayed to facilitate user access, thereby significantly improving the efficiency and accuracy of test case writing, expanding the test coverage, and flexibly adapting to changes in requirements, thereby optimizing the software testing process.

[0129] The protection scope of the method for automatically generating software requirement documents and test cases based on a large language model described in the embodiment of the present invention is not limited to the execution order of the steps listed in this embodiment. All solutions implemented by adding, reducing or replacing steps in the prior art based on the principles of the present invention are included in the protection scope of the present invention.

[0130] An embodiment of the present invention also provides a software requirement document parsing and test case automatic generation system based on a large language model. The software requirement document parsing and test case automatic generation system based on a large language model can implement the software requirement document parsing and test case automatic generation method based on a large language model described in the present invention. However, the implementation device of the software requirement document parsing and test case automatic generation method based on a large language model described in the present invention includes but is not limited to the structure of the software requirement document parsing and test case automatic generation system based on a large language model listed in this embodiment. All structural deformations and replacements of the prior art made according to the principles of the present invention are included in the protection scope of the present invention.

[0131] like Figure 7 As shown, in one embodiment, the present invention provides a software requirement document parsing and test case automatic generation system based on a large language model, the system comprising:

[0132] The document parsing module 701 is used to obtain a software requirement document and parse the software requirement document to obtain parsing information.

[0133] The intelligent block module 702 is used to block the parsed information to obtain block information.

[0134] The use case generation module 703 is used to generate corresponding prompt words based on the block information and the test case design method specified by the user, so as to call the large language model and generate test cases corresponding to the block information based on the prompt words.

[0135] The use case display module 704 is used to summarize and format the test cases for display.

[0136] It should be noted that the structures and principles of the document parsing module 701, the intelligent segmentation module 702, the use case generation module 703 and the use case display module 704 correspond one to one with the steps (steps S1 to S4) in the above-mentioned method for software requirement document parsing and automatic test case generation based on a large language model. The specific working principle can also be referred to the introduction of the method for software requirement document parsing and automatic test case generation based on a large language model in the aforementioned embodiment, so it will not be repeated here.

[0137] In the several embodiments provided by the present invention, it should be understood that the disclosed system, device or method can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of modules / units is only a logical function division, and there may be other division methods in actual implementation, such as multiple modules or units 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 through some interfaces, indirect coupling or communication connection of devices or modules or units, which can be electrical, mechanical or other forms.

[0138] The modules / units described as separate components may or may not be physically separated, and the components displayed as modules / units may or may not be physical modules, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules / units may be selected according to actual needs to achieve the purpose of the embodiments of the present invention. For example, the functional modules / units in the various embodiments of the present invention may be integrated into one processing module, or each module / unit may exist physically separately, or two or more modules / units may be integrated into one module / unit.

[0139] Those of ordinary skill in the art should 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 terms of function in the above description. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can 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.

[0140] The descriptions of the processes or structures corresponding to the above-mentioned figures have different emphases. For parts that are not described in detail in a certain process or structure, please refer to the relevant descriptions of other processes or structures.

[0141] The above embodiments are merely illustrative of the principles and effects of the present invention, and are not intended to limit the present invention. Anyone familiar with the art may modify or alter the above embodiments without departing from the spirit and scope of the present invention. Therefore, all equivalent modifications or alterations made by a person of ordinary skill in the art without departing from the spirit and technical concept disclosed by the present invention shall still be covered by the claims of the present invention.

Claims

1. A method for automatically generating software requirement documents and test cases based on a large language model, characterized in that: The method comprises the following steps: Obtaining a software requirement document, and parsing the software requirement document to obtain parsing information; Blocking the parsed information to obtain block information; Generate corresponding prompt words based on the block information and a test case design method specified by a user, so as to call a large language model and generate a test case corresponding to the block information based on the prompt words; The test cases are summarized and formatted for presentation.

2. The method for automatically generating software requirement documents and test cases based on a large language model according to claim 1, characterized in that: Parsing the software requirement document to obtain parsing information includes: Extracting information from the software requirement document according to a requirement analysis model specified by a user to obtain description information; The description information is integrated into a Markdown document as the parsing information; the order in which the parsing information includes the contents is consistent with the order in which the software requirement document includes the contents.

3. The method for automatically generating software requirement documents and test cases based on a large language model according to claim 2, characterized in that: Extracting information from the software requirement document according to the requirement analysis mode specified by the user to obtain description information includes: extracting information from the content in the software requirement document according to the requirement analysis mode to obtain description information; wherein the content in the software requirement document includes at least any one of the following or a combination of two or more: text, table, image; The requirement analysis mode is used to determine what content in the software requirement document is to be extracted; When the demand analysis mode includes extracting information from text, and the content in the software demand document includes text, extracting information from the content in the software demand document according to the demand analysis mode includes: extracting information from the text to obtain text content corresponding to the text; When the demand analysis mode includes extracting information from a table, and the content in the software demand document includes a table, extracting information from the content in the software demand document according to the demand analysis mode includes: extracting information from the table to obtain table data in the table; When the demand analysis mode includes extracting information from an image, and the content in the software demand document includes an image, extracting information from the content in the software demand document according to the demand analysis mode includes: generating a description text of the image; The description information includes at least any one of the following or a combination of two or more: the text content, the table data, and the description text.

4. The method for automatically generating software requirement documents and test cases based on a large language model according to claim 1, characterized in that: Blocking the parsed information to obtain block information includes: When the parsed information contains a page identifier, the parsed information is divided into blocks according to the page identifier to obtain the block information; When there is no page identifier in the parsed information, the parsed information is divided into blocks according to a preset length to obtain the block information; wherein each block information includes previous information with a first preset number of characters and / or following information with a second preset number of characters.

5. The method for automatically generating software requirement documents and test cases based on a large language model according to claim 4, characterized in that: When the parsed information is divided into blocks according to the page identifier, the block information located on the homepage includes the following information whose number of characters at the head of the block information on the next page is the second preset number; the block information located between the head and the end includes the previous information whose number of characters at the tail of the block information on the adjacent previous page is the first preset number, and the following information whose number of characters at the head of the block information on the next page is the second preset number; The block information located on the last page includes the previous information of the block information on the previous page, the number of characters at the tail of which is a first preset number; When the parsed information is divided into blocks according to a preset length, the first block information includes the following information whose number of characters at the head is the second preset number in the next block information; the block information between the first and the last includes the previous information whose number of characters at the tail is the first preset number in the adjacent previous block information, and the following information whose number of characters at the head is the second preset number in the next block information; the last block information includes the previous information whose number of characters at the tail is the first preset number in the previous block information.

6. The method for automatically generating software requirement documents and test cases based on a large language model according to claim 1, characterized in that: Generating corresponding prompt words based on the block information and a test case design method specified by a user, so as to call a large language model and generate a test case corresponding to the block information based on the prompt words includes: Matching a prompt word template according to the block information and the test case design method to generate a prompt word; The block information and the prompt word are input into the large language model so that the large language model outputs the test case.

7. The method for automatically generating software requirement documents and test cases based on a large language model according to claim 1, characterized in that: The display includes at least one of the following display modes or a combination of two or more: format display, use case view display, download sharing display; wherein, The format display includes at least one of the following or a combination of two or more: text file, Markdown file, CSV file; The use case view display is to display the use case name, test steps, expected results and preconditions of each test case in the form of a mind map; The download sharing display includes a download link corresponding to the test case in each format.

8. A software requirement document parsing and test case automatic generation system based on a large language model, characterized in that: The system comprises: A document parsing module, used to obtain a software requirement document and parse the software requirement document to obtain parsing information; An intelligent block module, used for dividing the parsed information into blocks to obtain block information; A test case generation module, used to generate corresponding prompt words based on the block information and a test case design method specified by a user, so as to call a large language model and generate a test case corresponding to the block information based on the prompt words; The use case display module is used to summarize and format the test cases for display.

Citation Information

Cited By

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

    CN120277002A