A test case generation method, electronic equipment and readable storage medium
By combining requirements documents and specification document sets, and using a large language model to parse and associate test cases, the problems of low efficiency and insufficient accuracy in test case generation in existing technologies are solved, achieving more comprehensive test case coverage and accuracy.
Patent Information
- Application Number
- CN202611462242.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-18
- Publication Date
- 2026-11-27
AI Technical Summary
Existing test case generation methods are inefficient and inaccurate. In particular, the quality of manually written test cases varies, and methods based on the code of the function under test cannot understand the business rules and expected behavior of the software function, which affects the accuracy of test cases.
By acquiring the requirements document and specification document set, using a large language model to parse and associate the attribute information in each document, and combining it with test auxiliary information, test cases are generated, including function triggering conditions, test specifications, abnormal scenarios and operation steps, etc., to generate comprehensive and accurate test cases.
This improves the coverage, completeness, and accuracy of test cases, ensuring that test cases contain multi-dimensional business function descriptions and avoiding missing test cases due to incomplete information in a single document.
Smart Images

Figure CN123178274A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to a test case generation method, an electronic device, and a readable storage medium. Background Technology
[0002] Test cases are a set of operational steps and expected results designed to verify whether software functions correctly. They are the core component of software testing activities. Currently, test cases are typically written manually, automatically generated based on large language models, or automatically generated based on the source code of the function under test.
[0003] However, the above methods have the following problems: manual coding is inefficient and produces inconsistent quality. The method based on the code of the function under test can only analyze the logical branches at the code level, and cannot understand the business rules and expected behaviors that the software function should possess. If the code itself misunderstands the requirements, it will affect the accuracy of the test cases.
[0004] Therefore, improving the coverage completeness and accuracy of test cases has become an urgent technical problem to be solved. Summary of the Invention
[0005] To address the aforementioned issues, this application provides a test case generation method, an electronic device, and a readable storage medium.
[0006] Firstly, a test case generation method is provided, applied to electronic devices. The method includes: obtaining a set of requirements documents and a set of specification documents, wherein the set of specification documents includes at least one of proposal documents, functional specification documents, design documents, and task documents; determining a set of attribute information for at least one business function based on the requirements documents and the set of specification documents; obtaining test auxiliary information corresponding to each business function according to the name of the at least one business function; and generating at least one test case corresponding to each business function based on the set of attribute information for each business function and the test auxiliary information corresponding to each business function.
[0007] It should be noted that the aforementioned requirements document and specification document set are used to provide descriptive information of business functions, while the test auxiliary information is used to supplement the test information corresponding to the business functions. Together, they serve as the basis for generating test cases.
[0008] Based on this, electronic devices do not need to rely solely on a single document to generate test cases. Instead, they can combine requirements documents, specification document sets, and test auxiliary information to generate test cases. This ensures that the generated test cases include both the business function descriptions recorded in the documents and the test information supplemented by the test auxiliary information, thereby avoiding the loss of test cases due to incomplete information in a single document.
[0009] Compared to traditional solutions, this application obtains the set of requirements documents and specification documents to determine the set of attribute information for business functions, and obtains the corresponding test auxiliary information based on the name of the business function, so that the information on which the generated test cases are based is more comprehensive, thereby improving the coverage, completeness and accuracy of the test cases.
[0010] In one possible implementation of the first aspect above, determining the attribute information set of at least one business function based on the requirements document and the specification document set includes: parsing the requirements document and the specification document set using a large language model to obtain the attribute information corresponding to each specification document in the requirements document and the specification document set respectively; identifying multiple business functions from the requirements document and each specification document using the large language model respectively; and associating the attribute information of the same business function in different documents to obtain the attribute information set of each business function in different documents.
[0011] It should be noted that the documents in the requirements document and specification document set can describe the same business function from different perspectives. By parsing each document to obtain the corresponding attribute information and identifying the business function in each document, the attribute information of the same business function scattered in different documents can be associated.
[0012] In this way, by using a large language model to complete parsing, recognition and association, there is no need for manual comparison of each document, which can improve the efficiency of extracting business functions and their attribute information, and thus provide more complete input data for the generation of subsequent test cases.
[0013] In one possible implementation of the first aspect above, the test assistance information includes at least one of the following: function triggering conditions, test specifications, abnormal scenarios, function constraints, and operation steps corresponding to each business function.
[0014] It should be noted that the aforementioned test support information is independent of the requirements document and specification document set, and is used to supplement information not recorded in the documents but necessary for generating test cases. Among them, functional trigger conditions are used to determine the preconditions of test cases, test specifications and functional constraints are used to determine the expected results of test cases, abnormal scenarios are used to generate supplementary test cases, and operation steps are used to determine the test steps of test cases.
[0015] In this way, by introducing at least one of the following: functional trigger conditions, test specifications, abnormal scenarios, functional constraints, and operation steps, we can supplement the test information not recorded in the requirements document and specification document set, making the information on which the generated test cases are based more comprehensive.
[0016] In one possible implementation of the first aspect above, the attribute information of the functional specification document includes at least one of functional description, interface address, request parameters, and return results; the attribute information of the proposal document includes at least one of business background, business objectives, usage scenarios, and target value; the attribute information of the design document includes at least one of implementation method and constraints; the attribute information of the task document includes at least one of task number and acceptance criteria; and the attribute information of the requirements document includes at least one of functional description and rule constraints.
[0017] It should be noted that the attribute information of the above-mentioned documents describes the same business function from different dimensions.
[0018] In this embodiment of the application, the attribute information of the functional specification document may include functional description, interface address, request parameters and return results; the attribute information of the proposal document may include business background, business objectives, usage scenarios and target value; the attribute information of the design document may include implementation method and constraints; the attribute information of the task document may include task number and acceptance criteria; and the attribute information of the requirements document may include functional description and rule constraints.
[0019] In this way, the attribute information corresponding to each of the above documents can be used to describe the same business function from multiple dimensions, making the information on which subsequent cross-document association and test case generation are based more comprehensive.
[0020] In one possible implementation of the first aspect above, multiple business functions are identified from the requirements document and each specification document using a large language model, including: extracting multiple candidate business functions corresponding to each document from each document based on preset business function extraction rules; wherein, the preset business function extraction rules are related to the document type, and different document types correspond to different preset business function extraction rules.
[0021] It should be noted that the above-mentioned preset business function extraction rules are related to the document type, and different document types correspond to different preset business function extraction rules.
[0022] In this embodiment, for proposal documents, candidate business functions can be extracted by chapters such as user stories and usage scenarios. For functional specification documents, candidate business functions can be extracted by interface definitions. For design documents, candidate business functions can be extracted by chapters such as functional boundaries and exception handling. For task documents, candidate business functions can be extracted by acceptance criteria and task items.
[0023] In this way, by using different preset business function extraction rules according to document type, candidate business functions can be accurately extracted from different types of documents, avoiding omissions or mis-extractions of business functions due to differences in document structure.
[0024] In one possible implementation of the first aspect above, the attribute information belonging to the same business function in different documents is associated to obtain the attribute information set of each business function in different documents, including: using a large language model to perform semantic matching on the matching identifiers of candidate business functions in documents of different specifications; determining the candidate business functions with semantic similarity greater than or equal to a first threshold as the same business function, and obtaining the attribute information set of each business function in documents of different specifications; wherein, the candidate business functions extracted from each specification document carry matching identifiers, the matching identifiers include a first type of matching identifier and a second type of matching identifier, the first type of matching identifier includes the interface address and task number, and the second type of matching identifier includes verb-noun pairs in the function description.
[0025] It should be noted that the first type of matching identifier is used for direct matching between documents of different specifications through a common interface address or task number, while the second type of matching identifier is used for matching between documents of different specifications through semantic similarity. When the semantic similarity of the second type of matching identifiers of two candidate business functions is greater than or equal to the first threshold, or when the first type of matching identifiers of two candidate business functions are the same, it can be determined that the two candidate business functions point to the same business function.
[0026] In this embodiment, the large language model can perform semantic matching on the matching identifiers of each candidate business function, and determine the candidate business functions with semantic similarity greater than or equal to the first threshold as the same business function, thereby associating the attribute information of the same business function scattered in different specification documents.
[0027] In this way, by matching the semantics of the identifiers, it is possible to identify candidate business functions that point to the same business function in documents of different specifications, and obtain the set of attribute information of each business function in documents of different specifications.
[0028] In one possible implementation of the first aspect mentioned above, the method further includes: merging the attribute information of the requirements document with the attribute information set of each business function in different specification documents to obtain the merged attribute information of each business function.
[0029] It should be noted that the descriptions of the same business function in the above-mentioned requirements documents and various specification documents may overlap or conflict. Through fusion processing, the attribute information of the requirements documents can be integrated with the attribute information sets of each business function in different specification documents to obtain the fused attribute information of each business function.
[0030] In this embodiment of the application, the electronic device can perform fusion processing on attribute information belonging to the same business function in the requirement document and various specification documents according to a preset priority. When the attribute information of the same business function overlaps or conflicts in different documents, the attribute information to be retained is determined according to the preset priority.
[0031] In this way, through fusion processing, attribute information belonging to the same business function in the requirements document and various specification documents can be integrated into fused attribute information, avoiding the impact of inconsistent descriptions between documents on the generation of subsequent test cases.
[0032] In one possible implementation of the first aspect mentioned above, the attribute information of the requirements document is merged with the attribute information sets of each business function in different specification documents to obtain the merged attribute information of each business function. This includes: performing similarity matching on the same attribute fields belonging to the same business function in the requirements document and each specification document; when the similarity is greater than or equal to a second threshold, retaining the attribute information in the document with the highest preset priority, wherein the preset priority from high to low is: requirements document, functional specification document, design document, proposal document, task document; when the similarity is less than the second threshold, merging the attribute information in the requirements document and each specification document and marking the source document; merging the attribute information of the same business function to obtain the merged attribute information of each business function.
[0033] It should be noted that a similarity score greater than or equal to the second threshold indicates that fields in different documents point to the same attribute; a similarity score less than the second threshold indicates that fields in different documents point to different attributes. For fields pointing to the same attribute, the attribute information from the document with the highest priority is retained according to a preset priority; for fields pointing to different attributes, the attribute information from different documents is merged and the source document is labeled.
[0034] In this embodiment, the preset priorities, from highest to lowest, are: requirements document, functional specification document, design document, proposal document, and task document. The requirements document defines the business function; the functional specification document defines how the interface should be designed; the design document defines how the interface should be implemented; the proposal document describes the business background and value; and the task document describes the implementation breakdown and acceptance conditions. Therefore, the priorities are determined according to the above order.
[0035] In this way, through the above fusion process, the overlap or conflict of attribute information between different documents can be resolved according to the preset priority, and the fused attribute information of each business function can be obtained.
[0036] In one possible implementation of the first aspect above, obtaining test assistance information corresponding to each business function based on the name of at least one business function includes: combining the name of each business function with keywords in a first preset keyword set to generate multiple first query texts, wherein the first preset keyword set includes at least one of function triggering conditions, test specifications, abnormal scenarios, and function constraints; retrieving the function triggering conditions, test specifications, abnormal scenarios, and function constraints corresponding to each business function from a preset knowledge base based on the first query texts; generating second query text by combining the name of each business function with keywords in a second preset keyword set, wherein the second preset keyword set includes operation steps; and retrieving the operation steps corresponding to each business function from a preset knowledge base based on the second query texts.
[0037] It should be noted that the aforementioned pre-set knowledge base refers to a knowledge base that pre-stores test auxiliary information corresponding to each business function. It can be independent of the requirements document and specification document set and is used to supplement information that is not recorded in the documents but is necessary for generating test cases.
[0038] It should be noted that the first and second preset keyword sets mentioned above correspond to different types of test auxiliary information. The first preset keyword set is used to retrieve function triggering conditions, test specifications, abnormal scenarios, and functional constraints, while the second preset keyword set is used to retrieve operation steps.
[0039] In this embodiment of the application, the electronic device can combine the name of the business function with the keywords in the first preset keyword set to generate multiple first query texts, and combine the name of the business function with the keywords in the second preset keyword set to generate second query texts, and retrieve corresponding test assistance information from the preset knowledge base based on the first query texts and the second query texts respectively.
[0040] In this way, by combining the name of the business function with a preset set of keywords to generate query text, the test assistance information corresponding to each business function can be retrieved from the preset knowledge base.
[0041] In one possible implementation of the first aspect above, based on the attribute information set of each business function and the test auxiliary information corresponding to each business function, at least one test case corresponding to each business function is generated, including: obtaining a preset test case template, which includes a precondition field, a test step field, and an expected result field; generating test cases for the business function through a large language model based on the attribute information set, function triggering conditions, operation steps, test specifications, and function constraints of the business function; and generating at least one first supplementary test case for the business function through the large language model based on the abnormal scenarios of the business function.
[0042] It should be noted that the precondition field in the above-mentioned preset test case template is used to fill in the function triggering conditions, the test step field is used to fill in the operation steps, and the expected result field is used to fill in the test specifications and functional constraints. The first supplementary test case mentioned above is a supplementary test case generated based on the abnormal scenarios of the business function, used to verify the abnormal scenarios of the business function.
[0043] In this embodiment, the electronic device can fill in the function triggering conditions into the precondition field, the operation steps into the test step field, and the test specifications and functional constraints into the expected result field, and generate test cases for the business function through the large language model; and generate at least one first supplementary test case for the business function through the large language model according to the abnormal scenarios of the business function.
[0044] In this way, by pre-setting test case templates and test auxiliary information, test cases covering normal processes and abnormal scenarios can be generated.
[0045] In one possible implementation of the first aspect above, the method further includes: after generating at least one test case corresponding to each business function, retrieving the test scenario set and boundary conditions corresponding to each business function from a preset knowledge base according to the name of each business function; wherein, the boundary conditions represent the critical values of the input parameters or running states corresponding to each business function; comparing at least one test case with the test scenario set to determine the uncovered test scenarios; and generating corresponding second supplementary test cases based on the uncovered test scenarios and boundary conditions.
[0046] It should be noted that the aforementioned test scenario set is used to represent the test scenarios corresponding to the business functions, and the boundary conditions are used to represent the critical values of the input parameters or operating states corresponding to the business functions. By comparing the generated test cases with the test scenario set, uncovered test scenarios can be identified. Based on the uncovered test scenarios and boundary conditions, corresponding second supplementary test cases are generated. These second supplementary test cases are used to supplement the scenarios not covered by the generated test cases.
[0047] In this embodiment of the application, the electronic device can combine the name of the business function with "all test scenarios" and "boundary conditions" respectively to generate query text, retrieve the test scenario set and boundary conditions corresponding to the business function from the preset knowledge base, and compare the generated test cases with the test scenario set to determine the uncovered test scenarios.
[0048] Thus, by performing a validation retrieval after generating test cases, missing test scenarios can be identified and a second supplementary test case can be generated, further improving the coverage and completeness of the test cases.
[0049] Secondly, a test case generation system is provided, comprising: a document scanning and parsing module for obtaining a set of requirements documents and specification documents, wherein the specification document set includes at least one of a proposal document, a functional specification document, a design document, and a task document; a business function extraction module for determining a set of attribute information for at least one business function based on the requirements document and the specification document set; a knowledge base retrieval module for obtaining test auxiliary information corresponding to each business function based on the name of at least one business function; and a test case generation module for generating at least one test case corresponding to each business function based on the set of attribute information for each business function and the test auxiliary information corresponding to each business function.
[0050] Thirdly, embodiments of this application provide an electronic device including at least one memory and at least one processor, the memory being coupled to the processor; the memory is used to store computer program code / instructions; when the computer program code / instructions are executed by the processor, the electronic device enables the methods provided by the first aspect and various possible implementations of the first aspect.
[0051] Fourthly, embodiments of this application provide a readable storage medium storing instructions that, when executed on an electronic device, cause the electronic device to implement the methods provided in the first aspect and various possible implementations of the first aspect.
[0052] Fifthly, embodiments of this application provide a computer program product, including: computer instructions, which, when executed on an electronic device, cause the electronic device to implement the methods provided in the first aspect and various possible implementations of the first aspect.
[0053] The beneficial effects of the second to fifth aspects mentioned above can be referred to the relevant descriptions in the first aspect and any possible implementation of the first aspect, which will not be repeated here. Attached Figure Description
[0054] Figure 1 According to the embodiments provided in this application, a flowchart of a test case generation method is shown;
[0055] Figure 2 According to the embodiments provided in this application, a schematic diagram of the architecture of a test case generation system is shown;
[0056] Figure 3 According to the embodiments provided in this application, a schematic diagram of cross-document association analysis results is shown;
[0057] Figure 4 According to the embodiments provided in this application, a schematic diagram of a three-stage knowledge base retrieval process is shown;
[0058] Figure 5 According to an embodiment provided in this application, a schematic diagram of the structure of another test case generation system is shown;
[0059] Figure 6 According to the embodiments provided in this application, a schematic diagram of the structure of an electronic device is shown. Detailed Implementation
[0060] The illustrative embodiments of this application include, but are not limited to, a test case generation method, an electronic device, and a readable storage medium.
[0061] It is understood that the electronic device in the embodiments of this application can be a terminal. The terminal can be a user terminal, mobile terminal, user equipment (UE), terminal device, mobile station (MS), mobile terminal (MT), etc. Terminal devices can be mobile phones, smart TVs, wearable devices, tablets, computers with wireless transceiver capabilities, virtual reality (VR) terminal devices, augmented reality (AR) terminal devices, wireless terminals in industrial control, wireless terminals in self-driving vehicles, wireless terminals in smart grids, wireless terminals in transportation safety, wireless terminals in smart cities, wireless terminals in smart homes, etc.
[0062] The technical solution of this application is described below with reference to the accompanying drawings.
[0063] As mentioned earlier, test cases are currently typically generated manually or automatically based on requirements documents. However, these methods suffer from incomplete coverage and insufficient accuracy.
[0064] To address the aforementioned technical problems, this application provides a test case generation method. In this method, an electronic device first acquires a set of requirements documents and specification documents, whereby the specification document set may include proposal documents, functional specification documents, design documents, and task documents. The electronic device extracts multiple business functions from the requirements and specification document sets and determines the attribute information set for each business function in different documents. Then, based on the name of each business function, it retrieves corresponding test assistance information from a knowledge base. This test assistance information may include function triggering conditions, test specifications, exception scenarios, functional constraints, and operation steps. Finally, the electronic device can generate at least one test case for each business function based on its attribute information set and the corresponding test assistance information.
[0065] In this way, by extracting business functions and their attribute information from multiple documents, and retrieving corresponding test auxiliary information from the knowledge base based on the business function name, business information that is not recorded in the documents but is necessary for test execution can be supplemented, thereby improving the coverage completeness and accuracy of test cases.
[0066] In the embodiments of this application, business functions can refer to independently executable and verifiable operational capabilities provided by the software system, such as "work card issuance," "user registration," and "order creation." The software system can be an enterprise office system, an e-commerce platform, a mobile application, etc., and this application does not limit it to any particular type.
[0067] This application uses user-perceptible business operations as the granularity (i.e., "what the user can do"), rather than data entities (such as "work cards" or "users") or code modules. Based on this granularity, attribute information of the same business function is extracted from different documents in the requirements and specifications documents, forming a set of attribute information for the business function. The name of the business function is used as the basis for subsequent retrieval. The business function is the core object of test case design.
[0068] In this embodiment, a business function involves descriptions in multiple specification documents. The proposal document may include business background and objectives, describing the business value of the function. The functional specification document may include interface addresses, request parameters, and return results, describing the interface definition of the business function. The design document may include implementation methods and constraints, describing the technical implementation scheme of the business function. The task document may include task numbers and acceptance criteria, describing the acceptance conditions of the business function. The requirements document may include functional descriptions and rule constraints, describing the user requirements and business scenarios of the business function. Different specification documents can describe the same business function from different perspectives; the information described in each document complements each other, collectively serving as the source of attribute information for the business function.
[0069] It should be noted that the aforementioned pre-set knowledge base stores test auxiliary information corresponding to each business function. This test auxiliary information can be independent of the requirements document and specification document set, and is used to supplement information not recorded in the documents but necessary for generating test cases. The requirements document and specification document set provide descriptive information about the function itself, while the pre-set knowledge base provides test auxiliary information corresponding to the business function. The two together serve as the basis for test case generation.
[0070] In some embodiments of this application, the electronic device can fuse the attribute information corresponding to each document in the requirements document and specification document set to obtain fused attribute information. The electronic device can then extract multiple business functions and their attribute information from the fused attribute information according to preset extraction rules. Next, the electronic device can use a large language model to associate attribute information belonging to the same business function in different documents, merging the attribute information belonging to the same business function to obtain a set of attribute information corresponding to each business function.
[0071] In this way, through cross-document semantic association, differences in descriptions of the same business function across different documents can be identified. Attribute information for the same business function, scattered across multiple documents, can be aggregated into an attribute information set, providing a functional information foundation for subsequent test case generation. Based on this, corresponding test auxiliary information is retrieved from a pre-defined knowledge base according to the business function name. Test auxiliary information not recorded in the documents is then added to the test case generation basis. This ensures that the generated test cases include both the functional description information recorded in the documents and the test auxiliary information stored in the knowledge base, thereby avoiding missing test cases due to incomplete information in a single document and effectively improving the coverage completeness and accuracy of the test cases.
[0072] For example, Figure 1 According to some embodiments of this application, a flowchart of a test case generation method is shown. Figure 1 The device that performs the method shown can be an electronic device.
[0073] S101: Obtain the requirements document and specification document set, which includes at least one of the following: proposal document, functional specification document, design document, and task document.
[0074] In this embodiment, the electronic device can obtain the requirements document through an interface. For example, the electronic device can call the document platform through the Model Context Protocol (MCP) interface to obtain the requirements document. It should be understood that this application does not limit the specific method by which the electronic device obtains the requirements document.
[0075] In this embodiment of the application, the electronic device can obtain the specification document set by scanning the document names in the project directory, matching the document names with preset keywords, and taking the successfully matched documents as documents in the specification document set.
[0076] Specifically, the electronic device can traverse multiple preset project directories, such as specs / , openspec / specs / , openspec / , docs / specs / , docs / , and the project root directory, to obtain the document names in each directory. Based on the preset correspondence between document names and document types, document names containing "proposal" are identified as proposal documents, those containing "spec" as functional specification documents, those containing "design" as design documents, and those containing "task" as task documents.
[0077] For example, document names such as spec.md and spec-v2.md can be identified as functional specification documents. Document names such as proposal.md and proposal-draft.md can be identified as proposal documents. Document names such as design.md and design-v2.md can be identified as design documents, and document names such as tasks.md and tasks-v2.md can be identified as task documents.
[0078] In this way, electronic devices can automatically locate and identify proposal documents, functional specification documents, design documents, and task documents in the project directory through keyword matching, without requiring users to manually specify the paths or names of various specification documents. For documents with irregular naming or multiple versions, electronic devices can still identify them as documents of the same type, improving the fault tolerance and flexibility of document retrieval.
[0079] In this embodiment, when multiple matching files of the same specification document type exist, the electronic device can determine the final selected specification document according to preset document selection rules. The preset document selection rules include, in order, priority based on standard filename, latest modification time, larger file size, and, when the above rules cannot distinguish between them, priority based on detail score.
[0080] First, standard filenames take precedence. A standard filename is one that exactly matches the default document name; for example, spec.md is a standard filename, while spec-v2.md and api-spec.md are non-standard filenames. When multiple matching files of the same specification document type exist with both standard and non-standard filenames, the electronic device prioritizes the file with the standard filename. For example, if both spec.md and spec-v2.md exist for the same specification document type, the electronic device will determine spec.md as the final specification document to be selected.
[0081] It should be understood that the above-mentioned standard filename priority rule applies to all types of specification documents. For example, for design specification documents, design.md takes precedence over design-v2.md; for proposal specification documents, proposal.md takes precedence over proposal-v2.md; and for task specification documents, tasks.md takes precedence over tasks-v2.md. This application does not impose any limitations on this.
[0082] Secondly, the file with the latest modification time takes priority. If multiple files have standard filenames or are all non-standard filenames, the electronic device will prioritize the file with the latest modification time. For example, for multiple standard filenames of the same specification document type, if one file was modified on August 10, 2026, and another file was modified on August 9, 2026, the electronic device will determine the specification document modified on August 10, 2026 as the final selected specification document.
[0083] Secondly, larger file sizes take precedence. If multiple files have the same modification time, the electronic device will prioritize the file with the larger file size. For example, if multiple files of the same specification document type have the same modification time, and one file is 8KB in size while another file is 4KB in size, the electronic device will determine the specification document with the 8KB size as the final selected specification document.
[0084] Finally, detail score takes precedence. When the above rules still cannot determine the final selected specification document from multiple matching files of the same specification document type, the electronic device determines the detail score of each matching file based on file size, number of chapters, and key chapter coverage. A larger file size, more chapters, and higher key chapter coverage result in a higher detail score, and the file with the higher score is prioritized as the final document for that specification document type. For example, for two matching files of the same specification document type, file A is 4KB in size, contains 5 second-level headings, and has a key chapter coverage of 60%; file B is 6KB in size, contains 8 second-level headings, and has a key chapter coverage of 90%. The electronic device determines that file B has a higher detail score than file A and selects file B as the final specification document for that specification document type.
[0085] It should be noted that the above-mentioned rules such as prioritizing filenames, newest modification times, and larger file sizes are merely illustrative examples. In actual applications, other preset document selection rules may also be included. This application does not limit the specific content and order of preset document selection rules.
[0086] Based on this, when there are multiple matching files of the same specification document type, the electronic device automatically determines the final specification document to be selected based on the above-mentioned preset document selection rules, without requiring the user to manually select or judge. It can prioritize the selection of specification documents with standardized naming, newer versions, and more detailed content, thereby improving the accuracy and automation of specification document acquisition.
[0087] In this application embodiment, the requirements document refers to a document describing user needs and business scenarios, including functional descriptions and rule constraints. For example, the requirements document states that "new employees need to obtain an employee card online after joining the company, limited to one card per person, and it becomes effective immediately upon issuance." Here, "new employees need to obtain an employee card online after joining the company" describes the user need and business scenario (new employees need to complete the employee card issuance process after joining the company), "limited to one card per person" describes the rule constraint (the same employee can only hold one valid employee card), and "becomes effective immediately upon issuance" describes the expected functionality (the employee card becomes effective and usable after issuance).
[0088] It should be noted that the functional descriptions and rule constraints in the aforementioned requirements document together constitute the original basis for subsequently extracting business functions and their attribute information. The functional descriptions are used to identify the existence of business functions and their core business behaviors, while the rule constraints are used to determine the restrictions that the business function must follow during execution. The aforementioned functional descriptions and rule constraints are merely illustrative examples; the requirements document may also include other content, and this application does not limit the specific content of the requirements document.
[0089] A proposal document is a document that describes the background and objectives of a business function, including the business background, business objectives, use cases, and target value. For example, a proposal document might state, "Implement the online employee ID card issuance function to reduce the administrative manual issuance process and improve the efficiency of new employee onboarding." Here, "Implement the online employee ID card issuance function" describes the business objective (the specific business function to be implemented), "reduce the administrative manual issuance process" describes the business background (the current problems), and "improve the efficiency of new employee onboarding" describes the target value (the expected effect after implementing this business function).
[0090] It should be noted that the business background, business objectives, use cases, and target value in the aforementioned proposal document collectively form the basis for subsequently extracting business function attribute information. The business background is used to understand why the function needs to be implemented; the business objectives are used to clarify the core purpose that the function needs to achieve; the use cases are used to determine in what business context the function is triggered; and the target value is used to assess the expected benefits after the function is implemented. It is understood that the proposal document may also include other content, such as project scope, stakeholders, and risk assessments; this application does not limit this.
[0091] A functional specification document is a document that describes the definition of a business function interface, including the interface address, request parameters, and return results. For example, the functional specification document might state that "the interface address is / api / card / claim, the request method is POST, the request parameters include user_id (user identifier) and location_id (receipt location identifier), and the return results include card_id (employee card identifier) and claim_time (receipt time)." Here, the interface address and request method define the network call entry point for this business function, the request parameters define the input information required to call the interface, and the return results define the output information returned by the system upon successful call.
[0092] It should be noted that the interface address, request parameters, and return results in the aforementioned functional specification document together constitute the basis for subsequently extracting business function attribute information. The interface address and request method are used to determine how the business function is invoked, the request parameters are used to determine the input data required to execute the business function, and the return results are used to determine the system's output data after the business function is successfully executed. It is understood that the functional specification document may also include other content, such as error codes, request header information, authentication methods, etc., and this application does not limit this.
[0093] A design document is a document that describes the technical implementation plan of a business function, including the implementation method and constraints. For example, a design document might state that "the QR code for redemption is generated using JSON Web Tokens and is valid for 30 minutes; a distributed lock is used to control concurrent redemption, and only one redemption request from the same user can be processed at a time." Here, "using JSON Web Tokens to generate the QR code" describes the implementation method (the specific technical means used for this business function), "validity period of 30 minutes" describes the constraint (the validity period of the QR code), and "only one redemption request from the same user can be processed at a time" also describes the constraint (concurrency control rules).
[0094] It should be noted that the implementation methods and constraints in the aforementioned design document together form the basis for subsequently extracting business function attribute information. The implementation methods are used to determine the technical implementation details of the business function, and the constraints are used to determine the limitations that the business function needs to meet during operation. It is understood that the design document may also include other content, such as architecture design, database design, caching strategies, exception handling schemes, etc., and this application does not limit this.
[0095] A task document is a document that describes the business function development tasks and acceptance criteria, including task numbers and acceptance standards. For example, a task document might state "T-001: Successful normal requisition; T-002: Duplicate requisition intercepted; T-003: QR code expired prompt refresh." Here, "T-001," "T-002," and "T-003" describe the task numbers, while "Successful normal requisition," "Duplicate requisition intercepted," and "QR code expired prompt refresh" describe the acceptance criteria (the completion conditions that each task needs to meet).
[0096] It should be noted that the task number and acceptance criteria in the aforementioned task document together form the basis for subsequently extracting business function attribute information. The task number is used to identify and trace specific development tasks, and the acceptance criteria are used to determine the expected behavior that the business function needs to meet in a specific scenario. It is understood that the task document may also include other content, such as task description, responsible person, priority, estimated working hours, etc., and this application does not limit this.
[0097] It should be understood that the proposal documents, functional specification documents, design documents, and task documents in the aforementioned requirements and specifications document sets are all illustrative examples. This application does not limit the specific number or type of documents, and more or fewer documents can be obtained as needed in practical applications. This application does not limit the specific content of each document.
[0098] Based on the above, the electronic device scans a preset directory by matching document names with preset keywords (i.e., fuzzy matching), automatically identifying and retrieving a set of specification documents. It then obtains the required documents via an interface, eliminating the need for users to manually specify the paths or names of each document. When multiple matching files exist for the same specification document type, the electronic device can further automatically determine the final selected specification document using multi-level priority rules such as standard filename priority, latest modification time priority, larger file size priority, and detail score. This ensures that the obtained document is a version with standardized naming, newer version, and more detailed content, providing an accurate and reliable document source for subsequent steps.
[0099] S102: Determine a set of attribute information for at least one business function based on the requirements document and specification document set.
[0100] In some embodiments of this application, after the electronic device obtains multiple specification documents from the requirement document and specification document set, it can parse and process these documents separately to obtain attribute information corresponding to each document. Then, it performs cross-document association on the four types of specification documents to obtain a set of attribute information for each business function in different specification documents. Furthermore, it fuses the attribute information from the requirement document with the attribute information sets of each business function in different specification documents to obtain fused attribute information for each business function, and extracts at least one set of attribute information for a business function from the fused attribute information.
[0101] First, the process by which electronic devices parse and process each document to obtain its attribute information is explained.
[0102] For requirement documents, electronic devices can extract functional descriptions and rule constraints as attribute information using a large language model. For example, if the requirement document states, "New employees need to obtain an employee card online after joining the company; each person is limited to one card, and it takes effect immediately upon issuance," the electronic device can extract "new employees need to obtain an employee card online after joining the company" as a functional description and "each person is limited to one card" as a rule constraint using a large language model. In this way, the attribute information of the requirement document includes both functional descriptions and rule constraints.
[0103] For the specification document set (including proposal documents, functional specification documents, design documents, and task documents), electronic devices use a two-stage parsing method to extract attribute information.
[0104] Specifically, the first stage can be lightweight rule scanning. Electronic devices perform rule-based extraction on all four types of specification documents, primarily using string scanning, keyword inclusion checks, and regular expression matching. Specifically, the electronic device can extract document titles from the four types of specification documents using a title parser, document feature tags from the four types of specification documents using a keyword parser, and interface addresses and request methods from the functional specification documents using an interface parser.
[0105] For example, for a proposal document, the electronic device can extract the document title "Work Card Issuance" using a title parser and the document feature tag "Business Background" using a keyword parser. For a functional specification document, the electronic device can extract the document title "Work Card Issuance" using a title parser, extract the interface address " / api / card / claim" and request method "POST" using an interface parser, and extract the feature tags "Boundary" and "Parameters" using a keyword parser. For a design document, the electronic device can extract the document title "Work Card Issuance" using a title parser and extract the feature tags "Exception" and "Performance" using a keyword parser. For a task document, the electronic device can extract the document title "Work Card Issuance" using a title parser and extract the feature tag "Acceptance" using a keyword parser.
[0106] It should be understood that the document title, feature tags, interface address and request method extracted in the above example are only illustrative examples, and this application does not limit the specific content extracted.
[0107] Based on this, the electronic device uses the aforementioned lightweight rule scanning to extract information such as document title, interface address, request method, and document feature tags from four types of documents. This information, along with the full document text, serves as the input context for the large language model, enabling it to perform semantic extraction within the located chapters without repeatedly reading the entire document, thus reducing input costs.
[0108] Meanwhile, the document type-driven extraction mode ensures consistent field names across document specifications, facilitating subsequent cross-document association and knowledge base retrieval. Content extracted at the rule layer can be traced back to specific chapters within the specification document, aiding in manual retrieval and error location. For well-formatted content such as interface addresses and status codes, the rule layer extracts directly, avoiding the instability issues of large language models and ensuring no key fields are missed.
[0109] The second stage is semantic understanding using a large language model. Electronic devices can input the information extracted in the first stage, along with the full text of documents of various specifications, into the large language model. The model then performs semantic parsing according to the extraction patterns corresponding to each document specification, extracting the attribute information corresponding to each document type.
[0110] For proposal documents, the large language model can extract business background, target value, use cases, and user stories according to the extraction mode corresponding to the proposal document. For example, if the proposal document states "to implement the online issuance function of employee work cards, reduce the administrative manual issuance process, and improve the efficiency of new employee onboarding," the large language model can extract the business background as "reducing the administrative manual issuance process," the target value as "improving the efficiency of new employee onboarding," and the use case as "new employee onboarding."
[0111] For functional specification documents, the large language model can extract functional descriptions, interface addresses, request parameters, return results, business rules, constraints, and exception handling information according to the extraction mode corresponding to the functional specification document. For example, if the functional specification document states "the request parameters include user_id and location_id, the return result includes card_id and claim_time, and each person is limited to one card", the large language model can extract the request parameters as user_id and location_id, the return result as card_id and claim_time, and the business rule as "each person is limited to one card".
[0112] For design documents, the large language model extracts the implementation method and constraints according to the extraction mode corresponding to the design document. For example, if the design document states that "the QR code for redemption is generated using JSON Web Token and is valid for 30 minutes; a distributed lock is used to control concurrent redemption, and only one redemption request from the same user can be processed at a time," the large language model extracts the implementation method as "the QR code is generated using JSON Web Token," and the constraints as "valid for 30 minutes" and "only one redemption request from the same user can be processed at a time."
[0113] For task documents, the large language model extracts the task number and acceptance criteria according to the extraction mode corresponding to the task document. For example, if the task document states "T-001: Successful normal requisition; T-002: Duplicate requisition intercepted; T-003: QR code expired prompt refresh", the large language model extracts the task numbers as T-001, T-002, and T-003, and the acceptance criteria as "successful normal requisition", "duplicate requisition intercepted", and "QR code expired prompt refresh".
[0114] Based on this, through the two-stage parsing method described above, electronic devices can extract their respective attribute information from the four types of specification documents. Specifically, the attribute information in the proposal document can include business background, business objectives, usage scenarios, and target value. The attribute information in the functional specification document can include function description, interface address, request parameters, and return results. The attribute information in the design document can include implementation methods and constraints. The attribute information in the task document can include task number and acceptance criteria. The attribute information in each specification document describes the business functions from different dimensions, providing input data for subsequent cross-document association.
[0115] For example, taking the "work card issuance" business function as an example, the attribute information corresponding to this business function in various documents can be output in JSON format, as exemplified below:
[0116] json
[0117] {
[0118] "module_name":"Work Card Issuance Function",
[0119] "documents":{
[0120] "spec.md":{
[0121] "function_desc":"Employees can collect their work cards online by scanning a QR code",
[0122] "interfaces": [{"method": "POST", "path": " / api / card / claim"}],
[0123] "request_params": [{"name": "user_id", "type": "string", "required":true}, {"name": "location_id", "type": "string", "required": true}],
[0124] "response_struct": [{"name": "card_id", "type": "string"}, {"name": "claim_time", "type": "timestamp"}],
[0125] "business_rules": ["One per person", "QR code valid for 30 minutes"],
[0126] "error_codes": [{"code": 400, "desc": "Parameter error"}, {"code": 409, "desc": "Already used"}]
[0127] },
[0128] "proposal.md": {
[0129] "business_background": "Reduce administrative manual distribution processes",
[0130] "target_value": "Improve new employee onboarding efficiency",
[0131] "usage_scenarios": ["New employee onboarding"]
[0132] },
[0133] "design.md": {
[0134] "implementation": "Generate QR code using JSON Web Token",
[0135] "constraints": ["Valid for 30 minutes", "Only one request from the same user can be processed at a time"]
[0136] },
[0137] "tasks.md": {
[0138] "task_ids": ["T-001", "T-002", "T-003"],
[0139] "acceptance_criteria": ["Successfully claimed normally", "Duplicate claims blocked", "QR code expired, prompt to refresh"]
[0140] }
[0141] },
[0142] "field_mapping": [
[0143] {"en": "user_id", "zh": "user identifier", "source": "spec.md"},
[0144] {"en": "location_id", "zh": "Identifier of the location for requisition", "source": "spec.md"},
[0145] {"en": "card_id", "zh": "work card identifier", "source": "spec.md"},
[0146] {"en": "claim_time", "zh": "claim time", "source": "spec.md"}
[0147] ],
[0148] "flags": {
[0149] "has_error": true,
[0150] "has_boundary": true,
[0151] "has_param": true
[0152] }
[0153] }
[0154] Here, `module_name` can represent the name of the business function, and `documents` can represent the attribute information extracted from each document. Specifically:
[0155] The `spec.md` file can represent the content extracted from the functional specification document, which may include the function description (`function_desc`), interface address (`interfaces`), request method (`method`), request parameters (`request_params`), return result (`response_struct`), business rules (`business_rules`), and error codes (`error_codes`). For example, the function description might be "Employees can claim their work cards online by scanning a QR code," the interface address might be " / api / card / claim," the request method might be "POST," the request parameters might include `user_id` and `location_id`, the return result might include `card_id` and `claim_time`, the business rules might include "one card per person" and "QR code valid for 30 minutes," and the error codes might include "400 Parameter Error" and "409 Already Claimed."
[0156] The proposal.md file can represent the attribute information extracted from the proposal document, which may include business background, target value, and usage scenarios. For example, the business background could be "reducing the administrative manual distribution process," the target value could be "improving the efficiency of new employee onboarding," and the usage scenario could be "new employee onboarding."
[0157] The design.md file can represent attribute information extracted from the design document, which can include implementation methods and constraints. For example, the implementation method is "generate a QR code using JSON Web Token", and the constraints include "valid for 30 minutes" and "only one request from the same user can be processed at a time".
[0158] The tasks.md file can represent the attribute information extracted from the task document, which may include task numbers (task_ids) and acceptance criteria (acceptance_criteria). For example, the task numbers are "T-001", "T-002", and "T-003", and the acceptance criteria are "successful normal use", "duplicate use blocked", and "QR code expired prompt refresh".
[0159] field_mapping can represent the mapping relationship between English field names and their Chinese meanings, as well as the source document. For example, user_id corresponds to "user identifier", and its source is spec.md.
[0160] Flags can represent document feature tags, used to mark whether the business function contains features such as error codes (has_error), boundary conditions (has_boundary), and parameter validation (has_param).
[0161] It should be noted that the JSON structure in the above example is only one possible output format provided by the embodiments of this application. The attribute information extracted in the two stages can also be output in other structured data formats, such as XML, YAML, etc., and this application does not limit this. The field names and hierarchical structure in the above JSON structure are only examples given to facilitate understanding of the technical solution of this application, and this application does not limit the specific content, field names, and extraction results in each document.
[0162] Secondly, the process of cross-document association for the four types of specification documents is explained.
[0163] In this embodiment, the electronic device extracts multiple candidate business functions corresponding to each specification document from each specification document based on preset business function extraction rules. Each candidate business function includes descriptive text and a source chapter locator. The preset business function extraction rules are related to the document type, with different document types corresponding to different preset business function extraction rules.
[0164] Specifically, for proposal documents, the preset business function extraction rules can include identifying keyword sections such as "user story," "use case," and "business function" in the proposal document, and treating each user story as a candidate business function. For example, if the proposal document states "User story: New employees need to obtain their work cards online after joining the company," the electronic device identifies "New employees need to obtain their work cards online after joining the company" as candidate business function 1, with the source section locator "§1.1". If the proposal document also states "Work card replacement due to loss," the electronic device identifies "Work card replacement due to loss" as candidate business function 2, with the source section locator "§1.2".
[0165] For functional specification documents, preset business function extraction rules may include identifying interface definitions in the functional specification document and treating each interface definition as a candidate business function. The electronic device identifies the endpoints of the interface definitions in the document (including the interface paths corresponding to request methods such as POST, GET, PUT, and DELETE), and treats the interface definition corresponding to each endpoint as a candidate business function. For example, if the functional specification document contains "POST / api / card / claim", the electronic device identifies "POST / api / card / claim" as candidate business function 3, with the source chapter locator "§2.1"; if the functional specification document also contains "POST / api / card / replace", the electronic device identifies "POST / api / card / replace" as candidate business function 4, with the source chapter locator "§2.2". When no interface definition is identified in the functional specification document, each second-level heading is treated as a candidate business function.
[0166] For design documents, preset business function extraction rules can include identifying key terms such as "functional boundaries" and "exception handling" in the design document, and treating each boundary condition as a candidate business function. For example, if the design document states "the QR code is valid for 30 minutes and needs to be re-acquired after the expiration time," the electronic device identifies "the QR code is valid for 30 minutes" as candidate business function 5, with the source chapter locator "§3.1"; if the design document also states "concurrently requisitioning distributed locks," the electronic device identifies "concurrently requisitioning distributed locks" as candidate business function 6, with the source chapter locator "§3.2"; and if the design document also states "re-approval process within 24 hours," the electronic device identifies "re-approval process within 24 hours" as candidate business function 7, with the source chapter locator "§3.3".
[0167] For task documents, the preset business function extraction rules can include identifying the "Acceptance Criteria" and "Task Breakdown" sections in the task document, and treating each "T-xxx" task as a candidate business function. For example, if the task document states "T-001: Successful normal requisition; T-002: Duplicate requisition interception; T-003: QR code expiration prompt refresh", the electronic device identifies "Successful normal requisition" as candidate business function 8, with the source section locator "T-001"; identifies "Duplicate requisition interception" as candidate business function 9, with the source section locator "T-002"; and identifies "QR code expiration prompt refresh" as candidate business function 10, with the source section locator "T-003".
[0168] Then, the electronic device establishes matching identifiers for the extracted candidate business functions. Each candidate business function's matching identifier includes a first type of matching identifier and a second type of matching identifier. The first type of matching identifier includes the interface address and task number, used for direct matching between documents of different specifications through shared interface addresses or task numbers. The second type of matching identifier includes verb-noun pairs in the function description, used for matching between documents of different specifications through semantic similarity.
[0169] For example, the second type of matching identifier for candidate business function 1 ("New employees need to collect their work cards online after joining the company") is the verb-noun pair "collect" and "work card". The first type of matching identifier for candidate business function 3 ("POST / api / card / claim") is the interface address "POST / api / card / claim", and the second type of matching identifier is the verb-noun pair "claim" and "card". The second type of matching identifier for candidate business function 5 ("The QR code is valid for 30 minutes") is the keywords "QR code", "validity period", and "30 minutes". The second type of matching identifier for candidate business function 7 ("The replacement review process is within 24 hours") is the keywords "replacement" and "review". The first type of matching identifier for candidate business function 8 ("Successful collection") is the task number "T-001", and the second type of matching identifier is the verb-noun pair "collect" and "successful". It should be noted that the second type of matching identifier, in addition to verb-noun pairs, may also include business constraint keywords and other business characteristics; this application does not specifically limit this.
[0170] It should be noted that the matching identifiers for the above-mentioned candidate business functions are merely illustrative examples, and this application does not limit the specific content and form of the matching identifiers.
[0171] Furthermore, the electronic device uses a large language model to perform semantic matching on the matching identifiers of candidate business functions in documents of different specifications, and determines whether the candidate business functions extracted from different documents point to the same business function.
[0172] When the semantic similarity of the verb-noun pairs of two candidate business functions is greater than or equal to the first threshold, or when the first type of matching identifier (interface address or task number) is the same, it is determined that the two candidate business functions point to the same business function.
[0173] Taking the "employee card issuance" business function as an example, the specific process of semantic matching and association establishment may include: Candidate business function 1 ("New employees need to issue their employee cards online after joining the company") and candidate business function 3 ("POST / api / card / claim") have a second type of matching identifier (issue / claim, employee card / card) semantic similarity greater than or equal to the first threshold, thus determining them to be the same business function; Candidate business function 8 ("Successful issuance") and candidate business function 1 both contain the verb-noun pair "issue," and their semantic similarity is greater than or equal to the first threshold, thus determining them to be the same business function. One business function; the keyword "QR code" in candidate business function 5 ("QR code validity period is 30 minutes") points to the scanning step before "requisitioning", and its semantic similarity with candidate business function 1 is greater than or equal to the first threshold, so it is determined to be the same business function; candidate business function 9 ("Duplicate requisition interception") describes the abnormal branch of "requisitioning", and its semantic similarity is greater than or equal to the first threshold, so it is determined to be the same business function; candidate business function 10 ("QR code expired prompt refresh") points to the abnormal QR code step of the requisition process, and its semantic similarity is greater than or equal to the first threshold, so it is determined to be the same business function.
[0174] Candidate business function 2 ("Replacement of lost work card") and candidate business function 4 ("POST / api / card / replace") have a semantic similarity of the second type of matching identifier (replacement / replacement, work card / card) greater than or equal to the first threshold, and are therefore determined to be the same business function; the keyword "replacement" in candidate business function 7 ("Replacement review process within 24 hours") has a semantic similarity of the first threshold with candidate business function 2, and is therefore determined to be the same business function.
[0175] It should be noted that the descriptions of the "work card issuance" business function in the four specification documents are consistent and there are no conflict markers.
[0176] When a candidate business function points to the same business function as multiple other candidate business functions, the candidate business function is associated with the highest-priority candidate business function according to the priority of the proposal document, functional specification document, design document, and task document. If a candidate business function does not point to the same business function as any other candidate business function in the specification document, the candidate business function is marked as an isolated business function and is still retained in the business function list.
[0177] For example, candidate business function 6 ("concurrent use of distributed locks") has no corresponding description in the proposal document, functional specification document, and task document, so it is marked as an isolated business function.
[0178] Electronic devices can locate and match the description text and source chapter of candidate business functions that point to the same business function, and obtain a set of attribute information of the business function in different specification documents.
[0179] For example, after merging the description text and source section of candidate business functions pointing to the same business function, the electronic device obtains a list of business functions. This list of business functions can be output in JSON format, for example:
[0180] {
[0181] "function_points":[
[0182] {
[0183] "id": "FP-001",
[0184] "name": "Work Card Issuance Function",
[0185] "association_strength": "strong",
[0186] "sources": [
[0187] {"doc": "proposal.md", "section": "§1.1", "desc": "Implementing Online Employee Card Issuance"},
[0188] {"doc": "spec.md", "section": "§2.1", "endpoint": "POST / api / card / claim"},
[0189] {"doc": "design.md", "section": "§3.1", "desc": "QR code valid for 30 minutes"},
[0190] {"doc": "tasks.md", "section": "T-001", "desc": "Successfully issued"} ]
[0192] },
[0193] {
[0194] "id": "FP-002",
[0195] "name": "Work Card Loss Replacement Function",
[0196] "association_strength": "medium",
[0197] "sources": [
[0198] {"doc": "proposal.md", "section": "§1.2", "desc": "Replacement of Lost Work Card"},
[0199] {"doc": "spec.md", "section": "§2.2", "endpoint": "POST / api / card / replace"},
[0200] {"doc": "design.md", "section": "§3.3", "desc": "Re-approval process within 24 hours"},
[0201] {"doc": "tasks.md", "section": "T-004", "desc": "Replacement successful notification"} ]
[0203] },
[0204] {
[0205] "id": "FP-003",
[0206] "name": "Concurrent Acquisition of Distributed Locks",
[0207] "association_strength": "isolated",
[0208] "sources": [
[0209] {"doc": "design.md", "section": "§3.2", "desc": "Concurrent Distributed Locks"} ]
[0211] } ]
[0213] }
[0214] Here, `function_points` represents a list of business functions, which is an array where each element corresponds to a business function. `id` represents the business function number, used to uniquely identify each function; for example, `FP-001` represents the first business function. `name` represents the business function name, such as "Work Card Issuance Function". `association_strength` represents the association strength, characterizing the degree of association of the business function across different specification documents; for example, `strong` indicates that the function is associated in all four specification documents, `medium` indicates that it is associated in three, and `isolated` indicates that it is an isolated function, associated only in one specification document. `sources` represents the source of the business function's attribute information in different specification documents; it is an array where each element corresponds to attribute information in one specification document. `doc` represents the specification document where the attribute information is located; for example, `proposal.md` represents the proposal document, `spec.md` represents the functional specification document, `design.md` represents the design document, and `tasks.md` represents the task document. `section` can represent the section locator of the attribute information in the specification document. For example, §1.1 represents section 1.1, and T-001 can represent task number T-001. `desc` can represent the descriptive text of the attribute information, such as "implement online employee card collection". `endpoint` can represent the interface address corresponding to the attribute information, such as POST / api / card / claim.
[0215] It should be noted that the JSON structure, field names, association strength, and specific content of the above-mentioned business function list are merely illustrative examples, and this application does not impose any limitations on them. Electronic devices may output the business function list in other structured data formats, such as XML and YAML, and this application does not impose any limitations on them.
[0216] As can be seen, the above attribute information set organizes the attribute information of the same business function in different specification documents in the order of proposal document, functional specification document, design document, and task document.
[0217] Through the above process, the electronic device associates candidate business functions that point to the same business function in the four types of specification documents, and obtains the attribute information set of each business function in different specification documents.
[0218] Then, the process of integrating the attribute information of the requirements document with the attribute information of each specification document is explained.
[0219] In this embodiment, the electronic device fuses the attribute information of the requirements document with the attribute information sets of each business function in different specification documents to obtain the fused attribute information of each business function. Specifically:
[0220] First, the electronic device integrates the attribute information from the requirements document and the attribute information from the four types of specification documents. In the integrated JSON intermediate representation, each type of document corresponds to a document node. For example, the integrated JSON intermediate representation is as follows:
[0221] json
[0222] {
[0223] "inputs": {
[0224] "requirement_doc": {"source": "Feishu PRD", "content_blocks": []},
[0225] "spec.md": {"source": "specs / spec.md", "structured": {}},
[0226] "design.md": {"source": "specs / design.md", "structured": {}},
[0227] "proposal.md": {"source": "specs / proposal.md", "structured": {}},
[0228] "tasks.md": {"source": "specs / tasks.md", "structured": {}}
[0229] }
[0230] }
[0231] In this dataset, `inputs` represents the collection of all document attribute information; `requirement_doc` represents the attribute information of the requirement document; `spec.md` represents the attribute information of the functional specification document; `design.md` represents the attribute information of the design document; `proposal.md` represents the attribute information of the proposal document; `tasks.md` represents the attribute information of the task document; `source` represents the document source; `content_blocks` represents the attribute information content of the requirement document; and `structured` represents the attribute information content of each specification document. The attribute information from these five documents serves as the input data for the fusion processing. In practical applications, the contents of the `content_blocks` and `structured` fields can be filled according to the actual parsing results of the documents. Empty arrays and empty objects in the above example simply indicate the omission of specific content.
[0232] Then, the electronic device performs fusion processing on the integrated attribute information based on preset priorities. When attribute information for the same business function overlaps or conflicts in different documents, the attribute information to be retained can be determined according to preset priorities, thus obtaining the fused attribute information for each business function. Specifically:
[0233] The electronic device identifies fields in the integrated requirements document and four types of specification documents to construct a global field set. For example, the electronic device identifies fields such as "functional description" and "rule constraints" from the requirements document, and fields such as "functional description," "interface address," "request parameters," "return result," "implementation method," "constraints," "task number," and "acceptance criteria" from the attribute information set of the specification document, and constructs these fields into a global field set.
[0234] For each field in the global field set, the electronic device checks whether there are fields describing the same attribute in the requirements document and various specification documents, and performs similarity matching on these fields. When the similarity is greater than or equal to a second threshold, it is determined that the field in each document points to the same attribute. Based on this, it is determined whether the attribute content recorded in the field in each document is the same: if the attribute content is the same, it is determined to be a redundant conflict, and one copy of the attribute information is retained; if the attribute content is different, it is determined to be an overriding conflict, and the attribute information in the document with the highest preset priority is retained, while the field in other documents is written as conflict information in the conflict log. When the similarity is less than the second threshold, it is determined to be a complementary conflict, and the attribute information in the requirements document and the corresponding specification document is merged and the source document is marked.
[0235] It should be noted that the preset priorities, from highest to lowest, are: Requirements Document, Functional Specification Document, Design Document, Proposal Document, and Task Document. The Requirements Document defines the business functionality; all other documents are generated to implement it, therefore, the Requirements Document has the highest priority. The Functional Specification Document defines how interfaces should be designed, while the Design Document defines how they should be implemented; in case of discrepancies, the Functional Specification Document prevails. The Design Document defines the technical implementation method; in case of conflict with the Proposal Document, the Design Document prevails. The Acceptance Criteria in the Task Document represent a commitment to the development task; when upstream documents change, the Task Document may not be updated in a timely manner, therefore its priority is relatively low.
[0236] For example, regarding the field "Limit on the number of times it can be claimed," the requirements document states "unlimited number of times it can be claimed," while the functional specification document states "one per person." The electronic device performs semantic similarity matching between the two. If the matching result is greater than the second threshold but the attribute content is different, it is determined to be an overriding conflict. The functional specification document has higher priority than the requirements document; therefore, the "one per person" from the functional specification document is retained, while the "unlimited number of times it can be claimed" from the requirements document is written as a note in the conflict log.
[0237] For example, regarding the "parameter validation" field, the functional specification document states "parameter required," while the design document states "parameter is filtered for cross-site scripting (XSS) attacks." The electronic device performs semantic similarity matching between the two. If the matching result is less than a second threshold, it is determined to be complementary and conflicting. The electronic device merges the two descriptions into "parameter required (design requirement: XSS filtering)," and marks the sources as the functional specification document and the design document, respectively.
[0238] For example, regarding the field "Limit on the number of times it can be claimed," both the requirements document and the functional specification document state "one per person." The matching result exceeds the second threshold and the attribute content is identical, thus identifying it as a redundant conflict. The electronic device retains a copy of the description, tagged with the source as both the requirements document and the functional specification document.
[0239] For fields with inconsistent types (such as text or numeric) or value ranges, electronic devices perform a mechanical comparison; inconsistencies are identified as overriding conflicts. For example, if the user_id field in the functional specification document is a text type, while the user_id field in the design document is a numeric type, the inconsistency is identified as an overriding conflict.
[0240] When the business meaning of the same interface address is described inconsistently in different documents, the electronic device identifies it as a critical identifier conflict. The electronic device marks this conflict information as an item requiring clarification and outputs a list of items requiring clarification for subsequent manual confirmation. For example, the functional specification document states that the / api / card / claim interface is used for "receiving work cards," while the design document states that the / api / card / claim interface is used for "querying work card information." The two have inconsistent business meanings and are therefore identified as a critical identifier conflict.
[0241] For fields that are in conflict, electronic devices can write conflict information to a conflict log, which includes the field name, conflict type, winning source document, losing source document, and conflict description.
[0242] For example, let's take the "Renewal Limit" field corresponding to the business function "Employee Card Renewal" as an example:
[0243] The requirements document states "unlimited usage times," while the functional specification document states "one per person." Both point to the "limited usage times" attribute, but the attribute content differs, indicating a conflict. According to the preset priority, the functional specification document takes precedence over the requirements document; therefore, the "one per person" provision from the functional specification document is retained, and the "unlimited usage times" provision from the requirements document is written to the conflict log as the source of the failure. This conflict log can be represented as follows:
[0244] json
[0245] {
[0246] "field": "business_rule.claim_limit",
[0247] "type": "coverage",
[0248] "winning_source": "spec.md",
[0249] "losing_sources": ["Requirements Documents"],
[0250] "description": "The requirements document states that there is no limit to the number of times it can be claimed, while spec.md states that each person can only claim one. The two documents have different attributes, and the record in spec.md is retained according to priority."
[0251] }
[0252] In this context, `field` represents the name of the conflicting field, `type` represents the conflict type, `winning_source` represents the winning source document, `losing_sources` represents the losing source documents, and `description` represents a detailed description of the conflict. It should be noted that the above field names, conflict types, and conflict log content are merely illustrative examples and are not intended to limit the scope of this application.
[0253] It should be noted that the handling of conflict fields and conflict logs in the above examples are merely illustrative. This application does not limit the specific handling of conflict fields, conflict types, or the specific content of conflict logs in the fusion process.
[0254] Through the above fusion process, the electronic device can obtain the fusion attribute information of each business function. The fusion attribute information records the final value of each field and its source document.
[0255] Finally, the process of extracting a set of attribute information for at least one business function from the fused attribute information is explained.
[0256] In this embodiment of the application, fused attribute information is obtained through the above-described fusion process. Then, the electronic device extracts at least one set of attribute information for a business function from the fused attribute information. Specifically, the electronic device identifies information in the fused attribute information that meets at least one of the following characteristics as a business function: chapters starting with keywords such as "business function," "requirement," "optimization," or "rectification," operation entry descriptions, user-perceptible operation processes, acceptance criteria or expected performance, and interface definitions, etc.
[0257] The operation entry description may include at least one of the following features: page path (e.g., "enter Lark → Administration Management → Employee Card Management"), button action (e.g., "click the 'Receive Employee Card' button"), entry identifier (e.g., "scan the QR code of the collection location"), or role permission (e.g., "employees can receive employee cards").
[0258] User-perceptible operational processes may include at least one of the following features: process verb chains (e.g., "scan the code first → confirm then → check the work card finally"), visual feedback (e.g., "work card information is displayed when the card is successfully issued"), status changes (e.g., "work card status changes from 'not issued' to 'issued'"), or abnormal interactions (e.g., "intercept and prompt the user when the card is issued repeatedly").
[0259] The interface definition may include at least one of the following features: HTTP method and path (e.g., "POST / api / card / claim"), request parameters (e.g., "request parameters: user_id, location_id"), response structure (e.g., "return: card_id, claim_time"), or error code definition (e.g., "error code 400, 409").
[0260] In some embodiments, electronic devices can employ multi-feature joint determination to identify business functions. When the same description simultaneously satisfies at least two types of features, the electronic device identifies it as a business function. For example, "scanning the QR code at the collection location" satisfies the entry identifier feature in the operation entry description; "displaying work card information upon successful collection" satisfies the visual feedback feature in the user-perceptible operation process; and "POST / api / card / claim" satisfies the HTTP method and path features in the interface definition. Since the above description simultaneously satisfies three types of features, the electronic device identifies it as the "work card collection" business function.
[0261] Electronic devices can acquire the functional descriptions and rule constraints of the identified business functions in the requirements document, the interface addresses and request parameters in the functional specification document, the implementation methods and constraints in the design document, and the task numbers and acceptance criteria in the task document, forming a set of attribute information for the business function.
[0262] For example, in addition to the business function "work card issuance" mentioned above, the electronic device can also extract attribute information sets of other business functions from the integrated attribute information. For instance, if the electronic device identifies the business function "user login function," the attribute information set of this business function can be represented as follows:
[0263] {
[0264] "name": "User Login Function",
[0265] "sources": [
[0266] {"doc": "proposal.md", "section": "§2.1", "desc": "Users need to log in to the system securely"},
[0267] {"doc": "spec.md", "section": "§3.2", "desc": "POST / api / auth / login"},
[0268] {"doc": "design.md", "section": "§4.1", "desc": "JWT token valid for 24 hours"},
[0269] {"doc": "tasks.md", "section": "T-001", "desc": "Acceptance Standards - Login Successful Redirect to Homepage"} ]
[0271] }
[0272] For example, if an electronic device identifies the service function "password reset function", the set of attribute information for this service function may include:
[0273] {
[0274] "name": "Password reset function",
[0275] "sources": [
[0276] {"doc": "proposal.md", "section": "§2.2", "desc": "Self-service password reset when users forget their password"},
[0277] {"doc": "spec.md", "section": "§3.3", "desc": "POST / api / auth / reset-password"},
[0278] {"doc": "design.md", "section": "§4.2", "desc": "Verification code valid for 5 minutes"},
[0279] {"doc": "tasks.md", "section": "T-002", "desc": "Acceptance Criteria - Reset Success Message"} ]
[0281] }
[0282] In this array, name represents the business function name, sources represents the source of the attribute information of the business function in different specification documents, each array element corresponds to one specification document of attribute information, doc represents the specification document where the attribute information is located, section represents the source section locator of the attribute information in the specification document, and desc represents the descriptive text of the attribute information.
[0283] It should be noted that the above-mentioned business function names, specific content in each document and their source chapter locators are merely illustrative examples, and this application does not impose any limitations on them.
[0284] In this way, the electronic device extracts a set of attribute information for multiple business functions from the fused attribute information, providing input data for the generation of subsequent test cases.
[0285] S103: Based on the name of at least one business function, obtain the test assistance information corresponding to each business function.
[0286] In this embodiment of the application, the electronic device can retrieve test assistance information corresponding to at least one business function from the knowledge base based on the name of that business function.
[0287] In this application embodiment, the knowledge base refers to a pre-set knowledge base that stores test auxiliary information corresponding to various business functions. For example, it can be implemented based on retrieval-augmented generation (RAG) technology. This knowledge base can be deployed on an internal enterprise server or in the cloud and maintained independently by the enterprise's internal knowledge base team. This application does not limit the specific implementation method of the knowledge base.
[0288] In this embodiment, the electronic device can load the knowledge base's connection information through a configuration file. The configuration file may include the knowledge base's API address, session identifier, authentication token, and timeout period. The electronic device establishes a connection with the knowledge base based on the connection information in the configuration file for subsequent retrieval operations. This application does not limit the specific method by which the electronic device loads the knowledge base's connection information.
[0289] For example, the configuration file can be in the format of config.json, containing fields such as baseUrl (knowledge base address), chatId (session identifier), apiToken (authentication token), and timeout (timeout period). Electronic devices can obtain connection information by parsing this configuration file.
[0290] In this way, electronic devices can dynamically load configurations and establish connections when they need to use the knowledge base, avoiding the occupation of connection resources when not needed, and can be handled according to the degradation strategy when loading fails, thus improving the stability and flexibility of the system.
[0291] In this embodiment, the knowledge base may include at least one of the following: business background information, used to describe business scenarios, user stories, and business value; function trigger entry points, used to describe the access path and triggering method of functions in the system; test specifications and acceptance criteria, used to describe test design specifications, coverage requirements, and acceptance conditions; abnormal scenario descriptions, used to describe known abnormal situations, boundary conditions, and error handling instructions; business rule constraints, used to describe business logic restrictions, rules, and calculation formulas; and historical test cases and field mappings, used to store historical test cases, field mapping relationships, and operation step references. The above information is organized and stored according to the business function dimension. The test auxiliary information corresponding to each business function is independent of the requirements document and specification document set, used to supplement information not recorded in the documents but necessary for generating test cases.
[0292] In this way, the knowledge base complements the requirements and specifications documents. The requirements and specifications documents provide descriptive information about the functionality itself, while the knowledge base provides corresponding test support information. Together, they serve as the basis for generating test cases. It should be understood that this application does not limit the specific content and organization of the knowledge base. For example, the knowledge base may also include other types of test support information, such as performance testing requirements and security testing requirements; this application does not limit such inclusion.
[0293] In this embodiment, when the electronic device obtains test assistance information corresponding to each business function, it can retrieve the corresponding test assistance information from the knowledge base in multiple retrieval stages. For example, it may include supplementary retrieval, enhanced retrieval, and verification retrieval.
[0294] The first retrieval stage is a supplementary retrieval. The electronic device combines the name of each business function with keywords from a first preset keyword set to generate multiple first query texts. The first preset keyword set includes at least one of the following: function triggering conditions, test specifications, abnormal scenarios, and function constraints.
[0295] Specifically, the electronic device generates the first query text using the query template in the configuration file. The query template may include "{function name} operation entry", "{function name} test specification", "{function name} abnormal scenario", "{function name} business rule", etc. The electronic device fills the name of the business function into the placeholder position in the template to generate the corresponding query text.
[0296] The electronic device retrieves information from a pre-defined knowledge base based on the query text to obtain the function triggering conditions, test specifications, abnormal scenarios, and functional constraints corresponding to each business function. The function triggering conditions are used to fill in the precondition fields of the test cases (e.g., user operation path and entry page), the test specifications and functional constraints are used to fill in the expected result fields of the test cases, and the abnormal scenarios are used to generate supplementary test cases.
[0297] For example, taking the "work card issuance" business function as an example, the electronic device generates four first query texts and performs retrieval in parallel with the knowledge base.
[0298] For the query of "Work Card Issuance Operation Entry", the knowledge base returns "Lark → Administration → Work Card Management → Issuance Button". The electronic device fills this into the precondition field of test case one (TC-001), that is, "Enter Lark → Administration → Work Card Management page".
[0299] For the query "Work Card Issuance Test Specification", the knowledge base returns "One card per person; the work card information will be displayed on the page after successful issuance". The electronic device fills this into the expected result field of test case one (TC-001), which is "the work card information will be displayed on the page after successful issuance".
[0300] For queries on "abnormal scenarios of work card issuance", the knowledge base returns "QR code expired, network error, duplicate issuance". The electronic device generates test cases for abnormal scenarios such as test case 2 (TC-002, duplicate issuance interception) and test case 3 (TC-003, QR code expired) based on these abnormal scenarios.
[0301] When querying the "Work Card Issuance Business Rules", the knowledge base returns "One card per person; validity period of 30 minutes". The electronic device uses this to generate test case four (TC-004) boundary test case to verify the 30-minute critical value scenario.
[0302] It should be understood that TC-001, TC-002, TC-003, and TC-004 are all different test cases under the "Work Card Issuance" business function. TC-001 is a normal process test case, TC-002 and TC-003 are abnormal scenario test cases, and TC-004 is a boundary test case.
[0303] It should be understood that the query text, search results, and embedded fields described above are merely illustrative examples, and this application does not limit them. The queries can be executed in parallel, with each query running independently. The total time consumed depends on the slowest query, thereby improving retrieval efficiency. Thus, before generating test cases, the electronic device obtains the functional triggering conditions, test specifications, abnormal scenarios, and functional constraints corresponding to each business function from the knowledge base, providing supplementary information for subsequent test case generation.
[0304] The second retrieval phase is an enhanced retrieval, executed during the test case generation process. The electronic device combines the names and operation steps of each business function to generate a second query text, and retrieves the corresponding operation steps for each business function from the knowledge base based on the second query text.
[0305] For example, taking the "employee card issuance" business function as an example, the electronic device generates the query text "employee card issuance operation steps", performs a search on the knowledge base, and the knowledge base returns "enter employee card management → click issuance → scan QR code → confirm issuance". The electronic device fills these operation steps into the test step field of the test case.
[0306] It should be understood that the enhanced retrieval in the second retrieval phase is performed for each specific business function during the test case generation process. It is used to obtain detailed operational guidance and supplement the content of the test step fields. The retrieval content of the first and second retrieval phases differs. The first retrieval phase obtains functional triggering conditions, test specifications, abnormal scenarios, and functional constraints, while the second retrieval phase obtains operational steps. Together, they constitute test auxiliary information, providing supplementary information for test case generation.
[0307] Based on the above, electronic devices obtain test assistance information corresponding to each business function through supplementary retrieval in the first retrieval stage and enhanced retrieval in the second retrieval stage. The test assistance information may include function triggering conditions, test specifications, abnormal scenarios, function constraints, and operation steps.
[0308] For example, for the "Employee Card Issuance" function, the first search phase retrieves the function triggering conditions "Lark → Administration → Employee Card Management", the testing specification "one card per person", the abnormal scenarios "QR code expired, duplicate issuance, network error", and the function constraint "QR code validity period is 30 minutes". The second search phase retrieves the operation steps "enter Employee Card Management → click to issue → scan QR code → confirm issuance". The above information together constitutes the testing auxiliary information for the "Employee Card Issuance" function.
[0309] In this way, electronic devices can obtain test assistance information corresponding to each business function, providing supplementary information for test case generation.
[0310] In this embodiment, after obtaining the test assistance information corresponding to each business function, the electronic device can automatically embed the retrieved content into the corresponding fields of the test case according to preset embedding rules. Specifically, the electronic device fills the function triggering conditions into the precondition field of the test case, fills the operation steps into the test step field of the test case, fills the test specifications and functional constraints into the expected result field of the test case, and uses abnormal scenarios to generate the first supplementary test case.
[0311] For example, for entry-level content such as "access via Lark → Administration → Work Card Management," the electronic device embeds it into the precondition field of the test case. For operation step details such as "scan the QR code at the collection location to jump to an H5 page," the electronic device embeds it into the test step field of the test case. For business rule restrictions such as "each person is limited to one work card," the electronic device embeds it into the expected result field of the test case. For exception scenarios such as "the handling logic when the QR code expires," the electronic device does not embed it into the current test case's field, but instead generates supplementary test cases based on the exception scenario.
[0312] It should be understood that the above-mentioned knowledge base content types, embedding locations, and specific content are merely illustrative examples, and this application does not limit them. Different types of knowledge base content can correspond to different embedding locations; for example, it may also include embedding expected result fields into boundary conditions, embedding expected result fields into test specifications, etc. Electronic devices can automatically complete the above mapping according to preset embedding rules without manual intervention. This application does not limit the specific content and mapping method of the embedding rules.
[0313] S104: Based on the attribute information set of each business function and the test auxiliary information corresponding to each business function, generate at least one test case corresponding to each business function.
[0314] In this embodiment, after obtaining the attribute information set of each business function and the corresponding test assistance information, the electronic device can input the attribute information set and test assistance information of each business function into the large language model. The test assistance information includes function triggering conditions, operation steps, test specifications, functional constraints, and abnormal scenarios. The large language model generates at least one test case corresponding to each business function based on a preset test case template.
[0315] Specifically, electronic devices can fill in the preconditions field of test cases with function triggering conditions, the test steps field with operation steps, the expected results field with test specifications and functional constraints, and use abnormal scenarios to generate supplementary test cases. Based on the filled-in test case template, the electronic device generates at least one test case corresponding to each business function through a large language model.
[0316] In this application embodiment, at least one test case for a business function may include the following fields:
[0317] json
[0318] {
[0319] "id": "TC-001",
[0320] "title": "<Use Case Title>",
[0321] "preconditions": ["<precondition 1>", "<precondition 2>"],
[0322] "steps": ["<Step 1>", "<Step 2>"],
[0323] "expectedResult": ["<Result 1>", "<Result 2>"]
[0324] }
[0325] Here, `id` represents the test case number, used to uniquely identify each test case. `title` represents the test case title, used to briefly describe the test purpose. `preconditions` represents the preconditions, used to describe the conditions that must be met before executing the test. `steps` represents the test steps, used to describe the specific order of operations for executing the test. `expectedResult` represents the expected result, used to describe the result that should be achieved after the test is executed.
[0326] In this embodiment, the large language model can generate at least one basic test case and at least one first supplementary test case for a business function. The basic test case is used to verify the normal flow of the business function, and the first supplementary test case is used to verify abnormal scenarios of the business function.
[0327] In this embodiment, the generated test cases can cover at least one of the following dimensions: normal process, parameter validation, business rules, abnormal scenarios, idempotency, and security. Specifically, the normal process covers the standard success path of each business function; parameter validation covers situations such as empty required fields, incorrect formatting, and boundary values; business rules cover both positive and negative test cases for each business rule; abnormal scenarios cover situations such as unavailable dependent services, missing data, and illegal input; idempotency covers the security of repetitive operations; and security covers situations such as authentication interception and prevention of sensitive data leakage. The above coverage dimensions are merely illustrative; in actual applications, other coverage dimensions can be set according to the needs of the business functions, and this application does not limit this.
[0328] For example, for the "work card issuance" business function, the large language model generates a basic test case TC-001 based on the set of attribute information for this business function (including the function description and rule constraints in the requirements document, the interface address and request parameters in the function specification document, the implementation method and constraints in the design document, and the task number and acceptance criteria in the task document) and the function triggering conditions, operation steps, test specifications, and function constraints in the test auxiliary information. First supplementary test cases TC-002 (duplicate issuance interception), TC-003 (QR code expiration), and TC-004 (network anomaly) are generated based on abnormal scenarios. TC-001 is used to verify the normal issuance process, while TC-002 to TC-004 are used to verify each abnormal scenario. Thus, each business function corresponds to at least one test case, and the basic test case and the first supplementary test case together constitute the test case set for that business function.
[0329] The above examples only illustrate normal processes and abnormal scenarios. In actual applications, the generated test cases can also cover dimensions such as parameter validation, business rules, idempotency, and security.
[0330] In this embodiment, after generating test cases corresponding to each business function, the electronic device can also perform verification-type retrieval through a knowledge base. Specifically, the electronic device combines the name of each business function with "all test scenarios" and "boundary conditions" to generate query text. For example, for the "work card issuance" business function, the electronic device generates two query texts: "all test scenarios for work card issuance" and "work card issuance boundary conditions," and retrieves the complete list of test scenarios and boundary conditions corresponding to this business function from the knowledge base.
[0331] The electronic device compares the generated test cases with the retrieved complete test scenario list to identify any uncovered test scenarios. For example, if the complete test scenario list returned by the knowledge base includes "normal requisition, duplicate requisition interception, QR code expiration, network anomaly, and concurrent requisition," and the generated test cases cover "normal requisition, duplicate requisition interception, and QR code expiration," then the missing scenarios are "network anomaly" and "concurrent requisition."
[0332] The electronic device generates corresponding second supplementary test cases based on the uncovered test scenarios and boundary conditions. For example, it generates second supplementary test cases based on the missing scenario "network anomaly" and based on "concurrent use" and boundary conditions.
[0333] It should be understood that the above query text, test scenario list, and second supplementary test cases are merely illustrative examples, and this application does not limit them. The above queries can be executed in parallel, with each query performed independently. The total time depends on the slowest query, thereby improving retrieval efficiency. Thus, through the generated verification retrieval, missing test scenarios can be identified and corresponding test cases can be generated, further improving the coverage and completeness of the test cases.
[0334] In this embodiment, the electronic device generates at least one test case corresponding to each business function based on the attribute information set of each business function and test auxiliary information through a large language model.
[0335] For example, taking the "work card requisition" business function as an example, the complete structured test cases output after completion can be:
[0336] json
[0337] {
[0338] "modules": [
[0339] {
[0340] "name": "Work Card Issuance Function",
[0341] "requirementName": "Online employee ID card application function",
[0342] "checkpoints": [
[0343] {
[0344] "id": "TC-001",
[0345] "title": "Work card successfully issued",
[0346] "preconditions": [
[0347] "Logged into Lark account"
[0348] "Go to Lark → Administration → Work Card Management page (Source: KB - Operation Entry)"
[0349] ],
[0350] "steps": [
[0351] "Click the 'Get Work Card' button (Source: KB - Operation Steps)",
[0352] "Scan the QR code at the collection location (Source: KB - Operation Steps)"
[0353] "Redirecting to an H5 page to confirm receipt (Source: KB - Operation Steps)",
[0354] "Observe the interface response (Source: spec.md §2.1)"
[0355] ],
[0356] "expectedResult": [
[0357] "Successfully issued, the work card information is displayed on the page (Source: KB-Acceptance Standards)".
[0358] "Each person is limited to one work card (Source: KB - Business Rules)"
[0359] "HTTP 200 response, including card_id and claim_time"
[0360] ],
[0361] "_kb_metadata": {
[0362] "embedded_preconditions": ["KB-operation entry point"],
[0363] "embedded_steps": ["KB-operation steps"],
[0364] "embedded_expected": ["KB-Business Rules", "KB-Acceptance Criteria"],
[0365] "enhancement_sources": ["Knowledge Base", "spec.md"]
[0366] }
[0367] },
[0368] {
[0369] "id": "TC-002",
[0370] Title: "Duplicate work card application blocked",
[0371] "preconditions": [
[0372] "Logged into Lark account"
[0373] "User has already received a work card"
[0374] ],
[0375] "steps": [
[0376] Click the 'Get Work Card' button.
[0377] ],
[0378] "expectedResult": [
[0379] The message reads, "You have already received a work card. Each person is limited to one card."
[0380] "Unable to continue the requisition process" ]
[0382] },
[0383] {
[0384] "id": "TC-003",
[0385] "title": "QR code expired and failed to be redeemed",
[0386] "preconditions": [
[0387] "Logged into Lark account"
[0388] The QR code has expired after 30 minutes.
[0389] ],
[0390] "steps": [
[0391] Click the 'Get Work Card' button.
[0392] Scan expired QR code
[0393] ],
[0394] "expectedResult": [
[0395] The message reads, "The QR code has expired. Please refresh and try again."
[0396] Show refresh button ]
[0398] } ]
[0400] }
[0401] ],
[0402] "_s5_output_metadata": {
[0403] "embedding_rules_applied": [
[0404] "Operation Entry -> Preconditions",
[0405] "Operation Steps"
[0406] "Business Rules->expectedResult",
[0407] "Exceptional scenarios -> Independent use cases"
[0408] ],
[0409] "kb_content_used": ["KB-Operation Entry Point", "KB-Operation Steps", "KB-Business Rules", "KB-Acceptance Criteria", "KB-Abnormal Scenarios"],
[0410] "total_test_cases": 15,
[0411] "kb_enhanced_test_cases": 15,
[0412] "kb_independent_test_cases_added": 3
[0413] }
[0414] }
[0415] Here, `modules` represents the list of business function modules, `name` represents the business function name, `requirementName` represents the requirement name, `checkpoints` represents the list of test cases corresponding to the business function, `id` represents the test case number, `title` represents the test case title, `preconditions` represents the preconditions, `steps` represents the test steps, `expectedResult` represents the expected result, and `_kb_metadata` represents the source information of the knowledge base enhancement, used to record the source of each field's content (such as knowledge base, specification documents, etc.) for easy traceability and auditing. `_s5_output_metadata` represents the output metadata of the S5 steps, where `embedding_rules_applied` represents the application's embedding rules, `kb_content_used` represents the type of knowledge base content used, `total_test_cases` represents the total number of generated test cases, `kb_enhanced_test_cases` represents the number of test cases enhanced by the knowledge base, and `kb_independent_test_cases_added` represents the number of first supplementary test cases independently generated based on knowledge base exception scenarios.
[0416] It should be understood that the test case numbers, preconditions, test steps, and expected results described above are merely illustrative examples, and this application does not impose any limitations on them. The electronic device can generate a corresponding number of supplementary test cases based on the number of abnormal scenarios and boundary conditions corresponding to the business functions. This application does not limit the specific content and format of the test cases; for example, they may also include fields such as test case level, author, and creation time. This application also does not limit whether the _kb_metadata and _s5_output_metadata fields are included. In this way, the electronic device generates test cases corresponding to each business function.
[0417] In this embodiment, after the electronic device generates test cases for each business function based on the large language model, it can output a test case document. The format of the test case document can be Hypertext Markup Language (HTML), Markdown, or XMind.
[0418] In this embodiment, the electronic device can also generate an output report, which may include at least one of the following: output file path, total number of test cases, business function coverage verification results, knowledge base enhancement status, and risk identification results. The total number of test cases refers to the number of test cases generated. The business function coverage verification results refer to the verification status of whether corresponding test cases have been generated for each business function in the business function list. The knowledge base enhancement status refers to the success of knowledge base retrieval in multiple retrieval stages and the summary information of the retrieval results. The risk identification results refer to the list of items requiring clarification output by the electronic device after identifying document conflicts, ambiguous requirements, and other issues discovered during or after the test case generation process and / or verification stages.
[0419] It should be understood that the above output format and report content are merely illustrative examples, and this application does not limit their scope. For example, the electronic device can also output test cases in JSON format for integration with other test management systems. This application does not limit the specific output format and report content of the test cases. In this way, the electronic device completes the generation and output of test cases.
[0420] It should be noted that this application implements three types of optimization strategies for the knowledge base retrieval process to improve retrieval efficiency, reduce duplicate queries, and avoid excessive time consumption for a single query.
[0421] First, for multiple queries within the same stage, the electronic device employs a parallel query strategy. Since the multiple queries within the same stage are independent of each other—for example, the four queries in Stage 1, "Operation Entry," "Test Specifications," "Abnormal Scenarios," and "Business Rules," are all independent—the electronic device sends multiple queries to the knowledge base simultaneously. The total execution time depends on the slowest single query, not the sum of the execution times of each query. For example, taking the "Work Card Requisition" business function, if the average execution time of the four queries is 800ms, the total execution time serially is 3200ms, while the total execution time in parallel is only the time of the slowest query, approximately 900ms, resulting in a performance improvement of about 3.5 times.
[0422] Secondly, for identical queries, electronic devices employ a caching and deduplication strategy. They cache and reuse query results for the same keywords, avoiding repeated access to the knowledge base. For example, if the query "work card issuance test specifications" is performed in multiple stages or sessions, the electronic device only executes the query once, and subsequently uses the cached results directly, avoiding duplicate queries.
[0423] Finally, for a single query, the electronic device employs a timeout control strategy. The electronic device sets a connection timeout and a read timeout for each query, with the maximum timeout for a single query not exceeding the sum of the connection and read timeouts. After initiating a query request, the electronic device first waits for a connection to be established. If the connection timeout is exceeded, a retry process is initiated. Upon successful connection establishment, an HTTP request is sent, and the device waits for a server response. If the read timeout is exceeded, a retry process is initiated. After a timeout, the electronic device follows a degradation strategy. If the current number of retries is less than the maximum number of retries, the query is re-initiated after a retry delay. If the maximum number of retries has been reached, an error result is returned, and the timeout information is recorded to prevent the overall process from being blocked due to an excessively long single query. For example, the electronic device can be configured with a connection timeout of 5 seconds, a read timeout of 15 seconds, a maximum number of retries of 3, and a retry delay of 1 second. If the query times out and fails after 3 retries, a "Network Error (3 Retrieved)" is returned, and the subsequent process continues.
[0424] It should be understood that the specific implementation methods of the above three optimization strategies are merely illustrative examples, and this application does not limit them. Electronic devices can configure parameters such as timeout time and caching strategies according to actual application scenarios. Parallel queries only apply to multiple queries within a single retrieval stage, not to the three stages. Because the three-stage retrieval has data dependencies—that is, the retrieval in stage two requires the retrieval results in stage one as input, and the retrieval in stage three requires the retrieval results in stage two as input—the three stages must be executed sequentially and cannot be parallelized. This application does not limit the specific parameter configuration of the above optimization strategies.
[0425] Thus, through three optimization strategies—parallel querying, cache deduplication, and timeout control—electronic devices can improve the efficiency and stability of knowledge base retrieval.
[0426] Based on the above test case generation method, the electronic device obtains a set of requirements documents and specification documents (including proposal documents, functional specification documents, design documents, and task documents), extracts business functions and their attribute information in different documents from these documents, and aggregates attribute information belonging to the same business function into an attribute information set through cross-document association. Then, it retrieves corresponding test auxiliary information from the knowledge base in stages according to the name of the business function, and finally generates at least one test case for each business function based on the attribute information set and the test auxiliary information.
[0427] In this way, the specification document set provides descriptive information about the function itself, and the knowledge base provides business information that is not recorded in the documents but is necessary for test execution. The combination of the two makes the generation of test cases no longer dependent on a single document source. Information such as abnormal scenarios and boundary conditions not recorded in the documents can be supplemented by knowledge base retrieval, and conflicts between documents can be identified and resolved through fusion processing, thereby improving the coverage completeness and accuracy of test cases.
[0428] It is understood that the above-described test case generation method can be applied to software testing and other scenarios related to software quality assurance, and this application does not limit its application in this regard. For example, in the field of high-security software development such as automotive electronics and aerospace, the method provided in this application can be used to generate high-coverage test cases to meet the testing requirements of high-security software. This application does not limit the specific application scenarios of the test case generation method.
[0429] In the embodiments of this application, Figure 2 According to an embodiment of this application, an architecture diagram of a test case generation system is shown.
[0430] refer to Figure 2 The test case generation system includes an input layer, a document processing layer, a knowledge base enhancement layer, a test case generation layer, and an output layer.
[0431] In this embodiment of the application, the input layer can be used to obtain requirements documents and a set of specification documents, which may include proposal documents, functional specification documents, design documents, and task documents.
[0432] In this embodiment, the document processing layer may include a document scanning module, a structured parsing module, and a cross-document association module. The document scanning module scans the project directory, uses fuzzy matching to identify and obtain the specification document set. The structured parsing module performs structured processing on the requirement documents and specification document set to obtain attribute information corresponding to each document. The cross-document association module associates attribute information belonging to the same business function in different specification documents, obtaining a set of attribute information for each business function in different specification documents. The fused attribute information is obtained by the electronic device after cross-document association by fusing the attribute information of the requirement documents with the attribute information sets of each business function in different specification documents. After the cross-document association module outputs the attribute information set, the electronic device further fuses the attribute information of the requirement documents with the attribute information sets of each business function in different specification documents to obtain fused attribute information, which is then input to the business function extraction module in the use case generation layer.
[0433] In this embodiment, the knowledge base enhancement layer may include a RAG Flow knowledge base for storing test assistance information corresponding to each business function and performing a three-stage retrieval: Stage 1 is a supplementary retrieval, used to obtain function triggering conditions, test specifications, abnormal scenarios, and functional constraints from the knowledge base. Stage 2 is an enhancement retrieval, used to obtain operation steps from the knowledge base. Stage 3 is a verification retrieval, used to obtain the test scenario set and boundary conditions from the knowledge base after generating test cases, and perform coverage integrity verification. It should be understood that RAG Flow is only an exemplary knowledge base implementation method, and this application does not limit the specific type of knowledge base.
[0434] In this embodiment, the use case generation layer may include a business function extraction module, a use case design and generation module, and a risk identification and labeling module.
[0435] The business function extraction module retrieves fused attribute information from the document processing layer and obtains function triggering conditions, test specifications, exception scenarios, and functional constraints from the supplementary retrieval of the knowledge base enhancement layer. It then extracts business functions and their attribute information sets from the fused attribute information and outputs the attribute information sets to the test case design and generation module. The supplementary retrieval is executed before test case generation, providing the business function extraction module with function triggering conditions, test specifications, exception scenarios, and functional constraints.
[0436] The test case design and generation module retrieves attribute information sets from the business function extraction module and operation steps from the enhanced retrieval layer of the knowledge base. Based on the attribute information sets, function triggering conditions, operation steps, test specifications, and functional constraints, this module generates basic test cases, generates first supplementary test cases based on abnormal scenarios, and outputs the generated test cases to the risk identification and annotation module and the output layer. Enhanced retrieval is executed during the test case generation process, providing operation steps to the test case design and generation module.
[0437] The risk identification and annotation module retrieves test cases from the test case design and generation module, and obtains a set of test scenarios and boundary conditions from the validation retrieval layer of the knowledge base. This module compares the generated test cases with the test scenario set to identify uncovered test scenarios. Based on these uncovered scenarios and boundary conditions, it generates second supplementary test cases, identifies ambiguous requirements and potential conflicts, and outputs a list of items requiring clarification to the output layer. The validation retrieval is executed after test case generation, providing the risk identification and annotation module with the test scenario set and boundary conditions for coverage integrity verification.
[0438] In this embodiment, the output layer can output test cases corresponding to each business function in HTML format. The HTML test case documents support one-click copying to XMind with tab indentation and can also be exported as Markdown. The output layer can also output test cases corresponding to each business function in XMind format, where the XMind test case documents are displayed as mind maps. The output layer can also output an output report, which may include at least one of the following: output file path, total number of test cases, business function coverage verification results, knowledge base enhancement status, and risk identification results.
[0439] It should be noted that, Figure 2 The input layer, document processing layer, knowledge base enhancement layer, test case generation layer, and output layer in the example are merely illustrative, and this application does not limit the system's layer division. In practical applications, the functions of each layer can be merged, split, or recombined as needed. For example, the functions of the document processing layer and the test case generation layer can be merged, or the functions of the knowledge base enhancement layer can be integrated into the test case generation layer. This application does not limit the specific division method and functional settings of each layer.
[0440] Thus, through the above system architecture, electronic devices can realize the complete process from document acquisition, parsing, association, fusion, knowledge base retrieval to test case generation.
[0441] In this embodiment of the application, after obtaining the set of attribute information for each business function in different specification documents, the electronic device can evaluate the set of attribute information and obtain the correlation analysis results.
[0442] For example, Figure 3 According to an embodiment of this application, a schematic diagram of cross-document association and association analysis results for specification documents is shown.
[0443] refer to Figure 3 For the business function "Work Card Issuance," the electronic device extracts the corresponding attribute information from the proposal document, functional specification document, design document, and task document. It then correlates the attribute information belonging to the "Work Card Issuance" business function in these four documents to obtain a set of attribute information for the business function across different specification documents. This set of attribute information is then evaluated to obtain the correlation analysis results. For example, for the "Work Card Issuance" business function, the correlation analysis results show complete business function coverage, no document conflicts, and no missing information.
[0444] The proposal document outlines the business objective of this feature: "to enable online employee card issuance," the use case: "new employee card issuance upon onboarding," and the target value: "improving administrative efficiency." The functional specification document defines the interface "POST / api / card / claim," the request parameters "user_id (user identifier) required, location_id (issuance location identifier) required," and the response "card_id (employee card identifier)." The design document outlines the technical solution for this feature: "QR code validity period of 30 minutes," concurrency control "distributed control," and exception handling "3 retries after timeout." The task document outlines the acceptance criteria for this feature: "successful issuance upon normal use, interception of duplicate issuance, and prompt for refresh upon QR code expiration."
[0445] It should be noted that, Figure 3 The specific content, correlation analysis results, and format of each specification document are merely illustrative examples and are not limited herein. In practical applications, correlation analysis results may also include the level of detail in business function coverage, specific descriptions of document conflicts, and suggestions for supplementing missing information. This application does not limit the specific content of each specification document.
[0446] In this embodiment of the application, in order to obtain test assistance information corresponding to each business function from the knowledge base, the electronic device can perform a three-stage retrieval.
[0447] For example, Figure 4 According to an embodiment of this application, a schematic diagram of a three-stage knowledge base retrieval process is shown.
[0448] refer to Figure 4The three-stage retrieval in the knowledge base enhancement layer includes stage one (supplementary retrieval), stage two (enhanced retrieval), and stage three (verification retrieval).
[0449] Phase One is a supplementary retrieval, executed before test case generation. The electronic device can perform parallel retrieval of operation entry points, test specifications, abnormal scenarios, and business rules, retrieving the corresponding function triggering conditions, test specifications, abnormal scenarios, and functional constraints for each business function from the knowledge base. For example, for the "Employee Card Issuance" business function, the electronic device executes four queries in parallel: "Employee Card Issuance Operation Entry Point," "Employee Card Issuance Test Specification," "Employee Card Issuance Abnormal Scenario," and "Employee Card Issuance Business Rules," retrieving from the knowledge base respectively: "Lark → Administration → Employee Card Management," "Limited to one card per person," "QR code expired, duplicate issuance, network error," and "QR code validity period 30 minutes." After Phase One retrieval is completed, test case generation begins.
[0450] Phase two is an enhanced retrieval process, executed during test case generation. The electronic device performs an operation step retrieval, retrieving the corresponding operation steps for each business function from the knowledge base. For example, for the "Employee Card Issuance" business function, the electronic device executes a "Employee Card Issuance Operation Steps" query, retrieving "Enter Employee Card Management → Click Issuance → Scan QR Code → Confirm Issuance" from the knowledge base. After Phase two retrieval is complete, the electronic device continues generating test cases.
[0451] Phase three is a verification-type retrieval, executed after test cases are generated. The electronic device can perform test scenario retrieval and boundary condition retrieval in parallel, obtaining the complete set of test scenarios and boundary conditions corresponding to each business function from the knowledge base. For example, for the "work card issuance" business function, the electronic device executes two queries in parallel: "all test scenarios for work card issuance" and "work card issuance boundary conditions," retrieving "normal issuance, duplicate issuance interception, QR code expiration, network anomaly, concurrent issuance" and "QR code 30-minute threshold" from the knowledge base, respectively. The electronic device compares the generated test cases with the complete set of test scenarios, identifies uncovered test scenarios, generates second supplementary test cases based on the uncovered test scenarios and boundary conditions, and finally outputs the test cases.
[0452] It should be noted that there are data dependencies among the three stages of retrieval. The enhanced retrieval in stage two requires the business function context output from the supplementary retrieval in stage one as input, and the validation retrieval in stage three requires the generated test case set output from the enhanced retrieval in stage two as input. Therefore, the three stages are executed sequentially. Multiple queries within the same stage do not have data dependencies and can be executed in parallel. The total execution time depends on the slowest single query, thereby improving retrieval efficiency.
[0453] This application does not limit the specific implementation of the above three-stage retrieval. For example, stage one can also retrieve business background information, and stage three can also retrieve other types of verification information; this application does not limit this.
[0454] In this way, through the three-stage knowledge base retrieval, electronic devices obtain different types of information from the knowledge base before, during and after test case generation, providing complete supplementary information and verification mechanisms for test case generation.
[0455] Figure 5 According to an embodiment of this application, a schematic diagram of the structure of another test case generation system is shown.
[0456] refer to Figure 5 The test case generation system 500 may include a document scanning and parsing module 501, a business function extraction module 502, a knowledge base retrieval module 503, and a test case generation module 504.
[0457] Specifically, the document scanning and parsing module 501 is used to obtain a set of requirements documents and specification documents, wherein the specification document set includes at least one of proposal documents, functional specification documents, design documents, and task documents. The business function extraction module 502 is used to determine a set of attribute information for at least one business function based on the requirements documents and specification document set. The knowledge base retrieval module 503 is used to obtain test auxiliary information corresponding to each business function based on its name. The test case generation module 504 is used to generate at least one test case corresponding to each business function based on the attribute information set and the corresponding test auxiliary information.
[0458] It should be noted that the document scanning and parsing module 501 can correspond to the input layer and document processing layer mentioned above, the business function extraction module 502 can correspond to the business function extraction and verification module in the test case generation layer mentioned above, the knowledge base retrieval module 503 can correspond to the knowledge base enhancement layer mentioned above, and the test case generation module 504 can correspond to the test case design and generation module in the test case generation layer mentioned above.
[0459] It should be understood that the names and functional divisions of the above modules are merely illustrative examples and are not intended to limit the scope of this application.
[0460] This application also provides a readable storage medium. The readable storage medium stores instructions that, when executed on an electronic device, cause the electronic device to perform the methods mentioned in this application.
[0461] This application also provides a computer program product, which includes computer instructions. When the computer instructions are executed on an electronic device, the electronic device can implement the methods mentioned in this application.
[0462] This application also provides an electronic device. The electronic device includes at least one memory and at least one processor, with the memory coupled to the processor. The memory stores computer program code / instructions. When the computer program code / instructions are executed by the processor, the electronic device can implement the methods mentioned in this application.
[0463] like Figure 6 The diagram illustrates the hardware structure of an electronic device 100 according to an embodiment of this application.
[0464] like Figure 6 As shown, the electronic device 100 may include one or more processors 102, a system control logic unit 101 connected to at least one of the processors 102, a system memory 105 connected to the system control logic unit 101, a memory 103 connected to the system control logic unit 101, and a network interface 107 connected to the system control logic unit 101.
[0465] It is understood that the structures illustrated in the embodiments of this application do not constitute a limitation on the only possible implementation of the electronic device 100. In other embodiments of this application, the electronic device 100 may include more or fewer components than illustrated, or combine some components, or split some components, or have different component arrangements. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
[0466] Processor 102 may include one or more single-core or multi-core processors. In some embodiments, processor 102 may include any combination of general-purpose processors and special-purpose processors (e.g., application processors, baseband processors, etc.). It is understood that in embodiments of this application, processor 102 may be configured to execute executable instructions 104 stored in memory 103 to implement the methods of embodiments of this application. When at least one instruction 104 is executed in processor 102, electronic device 100 implements the methods of embodiments of this application.
[0467] System control logic unit 101 may include any suitable interface controller to provide any suitable interface to at least one of the processors 102 and / or any suitable device or component communicating with system control logic unit 101. System control logic unit 101 may include one or more memory controllers to provide an interface to system memory 105. System memory 105 may be used to load and store data and / or instructions. In some embodiments, system memory 105 of electronic device 100 may include any suitable volatile memory, such as suitable dynamic random access memory.
[0468] Memory 103 may include one or more tangible, non-transitory computer-readable media for storing data and / or instructions. In some embodiments, memory 103 may include any suitable volatile memory and / or any suitable non-volatile storage device, such as memory 103 may include random access memory (RAM) and / or cache memory cells, and may further include read-only memory (ROM).
[0469] The memory 103 may include a portion of the storage resources on the device on which the electronic device 100 is installed, or it may be accessible by the device, but is not necessarily part of the device. For example, the memory 103 may be accessed over a network via the network interface 107.
[0470] Instruction 104 may include, when executed by at least one of processors 102, causing electronic device 100 to implement the methods of embodiments of this application. In some embodiments, instruction 104, hardware, firmware and / or its software components may additionally / alternatively be located in system control logic unit 101, network interface 107 and / or processor 102.
[0471] Network interface 107 may include a transceiver for providing a radio interface to electronic device 100, thereby enabling communication with any other suitable device (such as a front-end module, antenna, etc.) via one or more networks. In some embodiments, network interface 107 may be integrated into other components of electronic device 100. For example, network interface 107 may be integrated into at least one of processor 102, system memory 105, memory 103, and firmware device (not shown) with instructions.
[0472] Network interface 107 may further include any suitable hardware and / or firmware to provide a multiple-input multiple-output radio interface. For example, network interface 107 may be a network adapter, a wireless network adapter, a telephone modem, and / or a wireless modem.
[0473] The electronic device 100 may further include an input / output (I / O) device 106. The input / output device 106 enables a user to interact with the electronic device 100.
[0474] In some embodiments, the electronic device 100 may further include, but is not limited to, a display (e.g., a liquid crystal display, a touch screen display, etc.), a speaker, a microphone, one or more cameras (e.g., a still image camera and / or a video camera), a flashlight (e.g., a light-emitting diode flash) and a keyboard.
[0475] In some embodiments, the electronic device 100 further includes a sensor for determining at least one of environmental conditions or location information associated with the electronic device 100.
[0476] In some embodiments, the sensor may include, but is not limited to, a gyroscope sensor, an accelerometer, a proximity sensor, an ambient light sensor, and a positioning unit. The positioning unit may also be part of or interact with the network interface 107 to communicate with components of the positioning network, such as global positioning system (GPS) satellites.
[0477] The embodiments disclosed in this application can be implemented in hardware, software, firmware, or a combination of these implementation methods. Embodiments of this application can be implemented as computer programs or program code executable on a programmable system, the programmable system including at least one processor, a storage system (including volatile and non-volatile memory and / or storage elements), at least one input device, and at least one output device.
[0478] Program code can be applied to input instructions to execute the functions described in this application and generate output information. The output information can be applied to one or more output devices in a known manner. For the purposes of this application, the processing system includes any system having a processor such as, for example, a digital signal processor, a microcontroller, an application-specific integrated circuit, or a microprocessor.
[0479] The program code can be implemented using a high-level procedural language or an object-oriented programming language to communicate with the processing system. Assembly language or machine language can also be used when needed. In fact, the mechanisms described in this application are not limited to any particular programming language. In either case, the language can be a compiled language or an interpreted language.
[0480] In some cases, the disclosed embodiments may be implemented in hardware, firmware, software, or any combination thereof. The disclosed embodiments may also be implemented as instructions carried or stored thereon on one or more temporary or non-temporary machine-readable (e.g., computer-readable) storage media, which may be read and executed by one or more processors. For example, the instructions may be distributed via a network or through other computer-readable media. Therefore, machine-readable media may include any mechanism for storing or transmitting information in a machine-readable (e.g., computer-readable) form, including but not limited to floppy disks, optical disks, optical discs, magneto-optical disks, ROM, RAM, magnetic cards or optical cards, or tangible machine-readable storage for transmitting information using the Internet in the form of electrical, optical, acoustic, or other forms of propagation signals. Therefore, machine-readable media include any type of machine-readable medium suitable for storing or transmitting electronic instructions or information in a machine-readable (e.g., computer-readable) form.
[0481] In the accompanying drawings, some structural or methodological features may be shown in a specific arrangement and / or order. However, it should be understood that such a specific arrangement and / or order may not be necessary. Rather, in some embodiments, these features may be arranged in a manner and / or order different from that shown in the illustrative drawings. Furthermore, including structural or methodological features in a particular figure does not imply that such features are required in all embodiments, and in some embodiments, these features may be omitted or may be combined with other features.
[0482] It should be noted that all units / modules mentioned in the device embodiments of this application are logical units / modules. Physically, a logical unit / module can be a physical unit / module, a part of a physical unit / module, or a combination of multiple physical units / modules. The physical implementation of these logical units / modules themselves is not the most important factor; the combination of functions implemented by these logical units / modules is the key to solving the technical problems proposed in this application. Furthermore, to highlight the innovative aspects of this application, the above-described device embodiments of this application have not introduced units / modules that are not closely related to solving the technical problems proposed in this application. This does not mean that the above-described device embodiments do not contain other units / modules.
[0483] It should be noted that in the examples and description of this application, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one" does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0484] Although this application has been illustrated and described with reference to certain preferred embodiments thereof, those skilled in the art will understand that various changes in form and detail may be made thereto without departing from the scope of this application.
Claims
1. A test case generation method, characterized in that, Applied to electronic devices, the method includes: Obtain the requirements document and specification document set, wherein the specification document set includes at least one of the following: proposal document, functional specification document, design document and task document; Based on the requirements document and the specification document set, determine at least one set of attribute information for a business function; Based on the name of the at least one business function, obtain the test assistance information corresponding to each business function; Based on the attribute information set of each business function and the test auxiliary information corresponding to each business function, at least one test case corresponding to each business function is generated.
2. The method according to claim 1, characterized in that, The step of determining a set of attribute information for at least one business function based on the requirements document and the specification document set includes: The requirement document and the specification document set are parsed using a large language model to obtain the attribute information corresponding to each specification document in the requirement document and the specification document set, respectively. Multiple business functions are identified from the requirements document and each of the specifications document using a large language model; By associating attribute information belonging to the same business function in different documents, a set of attribute information for each business function in different documents is obtained.
3. The method according to claim 1, characterized in that, The test assistance information includes at least one of the following: function triggering conditions, test specifications, abnormal scenarios, function constraints, and operation steps corresponding to each of the business functions.
4. The method according to claim 2, characterized in that, The attribute information of the functional specification document includes at least one of the following: functional description, interface address, request parameters, and return result; The attribute information of the proposal document includes at least one of the following: business background, business objectives, use cases, and target value; The attribute information of the design document includes at least one of the implementation method and constraints; The attribute information of the task document includes at least one of the following: task number and acceptance criteria; The attribute information in the requirements document includes at least one of the following: functional description and rule constraints.
5. The method according to claim 2, characterized in that, The method of using a large language model to identify multiple business functions from the requirements document and each of the specifications document includes: Based on preset business function extraction rules, extract multiple candidate business functions corresponding to each document; The preset business function extraction rules are related to document types, with different document types corresponding to different preset business function extraction rules.
6. The method according to claim 5, characterized in that, The step of associating attribute information belonging to the same business function in different documents to obtain a set of attribute information for each business function in different documents includes: Using a large language model, semantic matching is performed on the matching identifiers of candidate business functions in documents of different specifications; Candidate business functions with semantic similarity greater than or equal to the first threshold are identified as the same business function, and the attribute information set of each business function in different specification documents is obtained. The candidate business functions extracted from each of the specification documents carry matching identifiers. The matching identifiers include a first type of matching identifier and a second type of matching identifier. The first type of matching identifier includes the interface address and the task number, and the second type of matching identifier includes verb-noun pairs in the function description.
7. The method according to claim 6, characterized in that, The method further includes: The attribute information of the requirements document is merged with the attribute information set of each business function in different specification documents to obtain the merged attribute information of each business function.
8. The method according to claim 7, characterized in that, The process of fusing the attribute information of the requirement document with the attribute information sets of each business function in different specification documents to obtain the fused attribute information of each business function includes: Perform similarity matching on the same attribute fields belonging to the same business function in the requirements document and each of the specifications document; When the similarity is greater than or equal to the second threshold, the attribute information in the document with the highest preset priority is retained, wherein the preset priorities are in the following order from high to low: the requirement document, the functional specification document, the design document, the proposal document, and the task document; When the similarity is less than the second threshold, the attribute information in the requirement document and each specification document is merged and the source document is marked. The attribute information of the same business function is merged to obtain the integrated attribute information of each business function.
9. The method according to claim 1, characterized in that, The step of obtaining test assistance information corresponding to each of the at least one business function based on its name includes: Based on the name of each business function, it is combined with keywords in the first preset keyword set to generate multiple first query texts, wherein the first preset keyword set includes at least one of function triggering conditions, test specifications, abnormal scenarios and function constraints; Based on the first query text, the function triggering conditions, test specifications, abnormal scenarios and function constraints corresponding to each business function are retrieved from the preset knowledge base; The second query text is generated by combining the names of each business function with keywords in the second preset keyword set, and the second preset keyword set includes operation steps. Based on the second query text, the operation steps corresponding to each of the business functions are retrieved from the preset knowledge base.
10. The method according to claim 9, characterized in that, The step of generating at least one test case corresponding to each of the aforementioned business functions based on the attribute information set of each business function and the test auxiliary information corresponding to each business function includes: Obtain a preset test case template, which includes a precondition field, a test step field, and an expected result field. Based on the attribute information set, function triggering conditions, operation steps, test specifications and function constraints of the business function, basic test cases of the business function are generated through a large language model; Based on the abnormal scenarios of the business function, at least one first supplementary test case is generated for the business function through the large language model.
11. The method according to claim 10, characterized in that, The method further includes: After generating at least one test case corresponding to each of the aforementioned business functions, the test scenario set and boundary conditions corresponding to each of the aforementioned business functions are retrieved from the preset knowledge base according to the name of each of the aforementioned business functions. Wherein, the boundary conditions characterize the critical values of the input parameters or operating states corresponding to each of the business functions; The at least one test case is compared with the set of test scenarios to determine the uncovered test scenarios; Based on the uncovered test scenario and the boundary conditions, a corresponding second supplementary test case is generated.
12. A test case generation system, characterized in that, The test case generation system includes: The document scanning and parsing module is used to obtain requirements documents and specification document sets, wherein the specification document set includes at least one of proposal documents, functional specification documents, design documents and task documents; A business function extraction module is used to determine a set of attribute information for at least one business function based on the requirements document and the specification document set. The knowledge base retrieval module is used to obtain test assistance information corresponding to each of the at least one business function based on the name of the business function. The test case generation module is used to generate at least one test case corresponding to each of the business functions based on the attribute information set of each business function and the test auxiliary information corresponding to each business function.
13. An electronic device, characterized in that, include: One or more processors; One or more memories; the one or more memories storing one or more programs that, when executed by the one or more processors, cause the electronic device to perform the method of any one of claims 1 to 11.
14. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a program or instructions that, when executed on an electronic device, cause the electronic device to perform the method of any one of claims 1 to 11.
15. A computer program product, characterized in that, include: A program or instruction that, when executed on an electronic device, causes the electronic device to perform the method of any one of claims 1 to 11.
