A test case generation method and device based on hybrid retrieval

By using a hybrid retrieval method, this approach optimizes the weights of retrieval features using a logistic regression model and an adaptive fusion neural network model. Combined with keyword and semantic matching, it generates efficient and accurate test cases, solving the problems of low efficiency and insufficient accuracy in generating test cases in existing technologies. This approach is adaptable to different business scenarios and user inputs.

CN123048414APending Publication Date: 2026-11-06SHENZHEN XGRIDS-INNOVATION CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611436262.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-09-16
Publication Date
2026-11-06

AI Technical Summary

Technical Problem

Existing methods for generating test cases are inefficient, prone to omissions in manual design, and prone to producing illusions when generating large models. Traditional retrieval-enhanced generation techniques have insufficient retrieval accuracy and low efficiency, and are difficult to adapt to personalized input, resulting in unstable test case quality.

Method used

By extracting keyword information from business requirements, using a logistic regression model to identify business function modules, combining keyword retrieval and fine-tuned vector retrieval, and relying on an adaptive fusion neural network model to dynamically optimize the weight coefficients of the two retrieval features, target business knowledge base document blocks are selected, and test cases are generated using a large language model.

Benefits of technology

It improves the accuracy and efficiency of test case generation, enhances the alignment of test cases with business requirements and rules, effectively reduces invalid or erroneous test cases, and adapts to different business scenarios and user input specifications.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123048414A_ABST
    Figure CN123048414A_ABST
Patent Text Reader

Abstract

This application provides a test case generation method and apparatus based on hybrid retrieval. The method includes: extracting keyword information from input business requirement information and using a logistic regression model to determine the business functional modules of the keyword information; based on the business functional modules, using a keyword retrieval method and a fine-tuned vector model to retrieve data from a business knowledge base, obtaining sparse and dense vector features of document blocks in the business knowledge base for each business functional module, and using an adaptive fusion neural network model to determine weight coefficients; based on the weight coefficients and the sparse and dense vector features, determining the fusion score of the document blocks in the business knowledge base, and based on the fusion score, determining the target business knowledge base document block in the business knowledge base document blocks, and using a large language model to generate target test cases for the business requirement information. This method improves the accuracy and efficiency of test case generation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of software testing technology, and in particular to a test case generation method and apparatus based on hybrid retrieval. Background Technology

[0002] Software testing is a core component in ensuring the quality of software products, and test case design is the foundation of software testing. Test cases are a set of standardized test instructions used by testers to verify whether the system meets the expected functions, business logic, and requirements, and their quality directly determines the test results.

[0003] Currently, there are three main ways to generate test cases: manual test case design relies on manual writing based on requirements and business logic, which is inefficient and prone to omissions; large model test case generation uses AI to automatically generate initial drafts to improve efficiency, but is limited by insufficient business understanding and is prone to producing invalid test cases; traditional retrieval-augmented generation (RAG) technology combines retrieval and generation, using knowledge base information to assist large models in generating test cases. This technology suffers from semantic matching bias, which can cause test cases to deviate from requirements, low global retrieval efficiency, and lack of adaptability. It is difficult to adapt to personalized input, resulting in unstable test case quality, high manual verification costs, and an inability to truly achieve efficient and accurate test output. Summary of the Invention

[0004] In view of this, the purpose of this application is to provide a test case generation method and apparatus based on hybrid retrieval. By extracting keyword information from business requirement information, using a logistic regression model to lock in business functional modules, combining keyword retrieval and fine-tuned vector retrieval, and relying on an adaptive fusion neural network model to dynamically optimize the weight coefficients of the two retrieval features, the method further selects target business knowledge base document blocks and uses a large language model to generate test cases. This solves the problems of low efficiency in manually designing test cases, the tendency of large model-generated test cases to produce illusions, and the insufficient retrieval accuracy, low efficiency, and rigid retrieval strategies of traditional retrieval enhancement generation techniques in existing technologies. It improves the accuracy and efficiency of generated test cases, enhances the fit between test cases and business requirements and rules, effectively reduces invalid or erroneous test cases, and adapts to different business scenarios and user input specifications.

[0005] This application provides a test case generation method based on hybrid retrieval, the method comprising: In response to receiving input business requirement information, keyword information is extracted from the business requirement information, and at least one business function module corresponding to the keyword information is determined using a preset logistic regression model. Based on the business function modules, a search is performed in the pre-defined business knowledge base using a preset keyword retrieval method and a preset fine-tuning vector model. The sparse features and dense vector features corresponding to the document blocks in the business knowledge base of each business function module are obtained. The weight coefficients corresponding to the sparse features and the dense vector features are determined by a preset adaptive fusion neural network model. Based on the weight coefficients and the sparse features and dense vector features corresponding to each business knowledge base document block, a fusion score value corresponding to each business knowledge base document block is determined, and based on the fusion score value, a target business knowledge base document block is determined in the business knowledge base document block. Based on the document segmentation of the target business knowledge base, target test cases corresponding to the business requirement information are generated using a preset large language model.

[0006] Furthermore, in response to receiving the input business requirement information, extracting keyword information from the business requirement information includes: In response to the input business requirement information, the text corresponding to the business requirement information is split into multiple candidate words using a preset word segmentation tool, and stop words in the text corresponding to the business requirement information are filtered out. The importance score corresponding to each candidate word is determined by using a preset text feature weight calculation method, and the candidate words are sorted in descending order according to the importance score to obtain the keyword ranking result; Extract the candidate words corresponding to a preset number of keywords from the keyword ranking results to extract keyword information.

[0007] Furthermore, the step of using a preset logistic regression model to determine at least one business function module corresponding to the keyword information includes: The keyword information is input into a preset logistic regression model to obtain at least one candidate functional module corresponding to the keyword information output by the logistic regression model and the credibility result corresponding to each candidate functional module. The credibility result is normalized to obtain a normalized score for each candidate functional module, and the candidate functional modules are sorted in descending order according to the normalized score to obtain the functional module sorting result. Extract the candidate functional modules corresponding to a preset number of modules from the functional module sorting results to determine at least one business functional module corresponding to the keyword information.

[0008] Furthermore, based on the business function modules, a search is performed in the pre-defined business knowledge base using a preset keyword retrieval method and a preset fine-tuning vector model, respectively, to obtain the sparse features and dense vector features corresponding to the document blocks in the business knowledge base of each business function module, including: The keyword matching degree between each user's query business needs and the document blocks in the pre-defined business knowledge base is calculated using a preset keyword retrieval method. The keyword matching degree is normalized to determine the sparse features corresponding to each business knowledge base document block; The user query business requirements and the business knowledge base are input into a preset fine-tuning vector model to obtain dense vector features output by the fine-tuning vector model that represent the semantic relevance between each user query business requirement and the document block; wherein, the fine-tuning vector model is obtained by fine-tuning a preset sentence embedding generation model based on preset triplet labeled data and using a preset triplet loss function.

[0009] Furthermore, the adaptive fusion neural network model includes a feature projection layer, a modality equalization normalization layer, a multi-head attention layer, a cross-modal gating layer, a residual enhancement layer, and a fully connected output layer; the step of determining the weight coefficients corresponding to the sparse features and the dense vector features using the preset adaptive fusion neural network model includes: The feature projection layer maps the sparse features and the dense vector features to a preset dimension, respectively, to obtain sparse features and dense vector features of the same dimension. The modal equalization normalization layer normalizes the same-dimensional sparse features and the same-dimensional dense vector features respectively, thereby obtaining the calibrated sparse features and calibrated dense vector features. The multi-head attention layer captures the semantic relationships between the business requirement information, the keyword information, and the document blocks in the business knowledge base based on the calibrated sparse features and the calibrated dense vector features, and obtains attention features. The gating coefficients generated by the cross-modal gating layer are multiplied element-wise with the attention features to obtain the gating features; The residual enhancement layer concatenates the same-dimensional sparse features and the same-dimensional dense vector features to obtain concatenated projection features, and adds the concatenated projection features to the gated features to obtain residual enhancement features; The fully connected output layer sequentially performs feature compression and normalization on the residual enhancement features to obtain the weight coefficients corresponding to the sparse features and dense vector features output by the fully connected output layer.

[0010] Furthermore, the weighting coefficients include sparse weighting coefficients and dense weighting coefficients; the step of determining the fusion score value corresponding to each business knowledge base document block based on the weighting coefficients and the sparse and dense vector features corresponding to each business knowledge base document block, and determining the target business knowledge base document block in the business knowledge base document blocks based on the fusion score value, includes: Multiply the sparse weight coefficient corresponding to each sparse feature with the sparse feature to obtain a first product result, and multiply the dense weight coefficient corresponding to each dense vector feature with the dense vector feature to obtain a second product result; The sum of the first product result and the second product result is determined as the fusion score value corresponding to each of the business knowledge base document blocks; The business knowledge base document blocks are sorted in descending order according to the fusion score value to obtain the business knowledge base document block sorting result. Extract the business knowledge base document blocks corresponding to the preset number of document blocks from the sorting results of the business knowledge base document blocks to determine the target business knowledge base document blocks.

[0011] Furthermore, the method also includes: The target test cases and the business knowledge base documents are sent to an external system in blocks. In response to the received test case feedback results from the external system, the adaptive fusion neural network model is updated and trained based on the test case feedback results to update the weight coefficients.

[0012] This application also provides a test case generation device based on hybrid retrieval, the test case generation device comprising: The keyword matching unit is used to extract keyword information from the input business requirement information in response to the acquisition of the input business requirement information, and to determine at least one business function module corresponding to the keyword information using a preset logistic regression model. The hybrid retrieval unit is used to perform retrieval in the pre-segmented business knowledge base based on the business function module, using a preset keyword retrieval method and a preset fine-tuning vector model respectively, to obtain the sparse features and dense vector features corresponding to the document blocks of the business knowledge base in each business function module, and to determine the weight coefficients corresponding to the sparse features and the dense vector features respectively using a preset adaptive fusion neural network model. The module determination unit is used to determine the fusion score value corresponding to each business knowledge base document block based on the weight coefficients and the sparse features and dense vector features corresponding to each business knowledge base document block, and to determine the target business knowledge base document block in the business knowledge base document block based on the fusion score value. The test case generation unit is used to generate target test cases corresponding to the business requirement information based on the target business knowledge base document blocks and using a preset large language model.

[0013] Furthermore, the test case generation device also includes a model update unit, which is used for: The target test cases and the business knowledge base documents are sent to an external system in blocks. In response to the received test case feedback results from the external system, the adaptive fusion neural network model is updated and trained based on the test case feedback results to update the weight coefficients.

[0014] This application also provides an electronic device, including: a processor, a memory, and a bus. The memory stores machine-readable instructions executable by the processor. When the electronic device is running, the processor communicates with the memory via the bus. When the machine-readable instructions are executed by the processor, the steps of the test case generation method based on hybrid retrieval described above are performed.

[0015] This application also provides a computer-readable storage medium storing a computer program, which, when run by a processor, executes the steps of the test case generation method based on hybrid retrieval described above.

[0016] The present application provides a method and apparatus for generating test cases based on hybrid retrieval. The method includes: in response to receiving input business requirement information, extracting keyword information from the business requirement information, and using a preset logistic regression model to determine at least one business functional module corresponding to the keyword information; based on the business functional module, performing retrieval in a pre-segmented business knowledge base using a preset keyword retrieval method and a preset fine-tuning vector model, respectively, to obtain sparse features and dense vector features corresponding to business knowledge base document blocks in each business functional module, and using a preset adaptive fusion neural network model to determine the weight coefficients corresponding to the sparse features and the dense vector features; based on the weight coefficients and the sparse features and dense vector features corresponding to each business knowledge base document block, determining a fusion score value corresponding to each business knowledge base document block, and based on the fusion score value, determining a target business knowledge base document block in the business knowledge base document blocks; and based on the target business knowledge base document block, generating target test cases corresponding to the business requirement information using a preset large language model.

[0017] Compared to existing technologies such as manually designed test cases, large-model generated test cases, and traditional retrieval enhancement generation techniques, this method extracts keyword information from business requirements, uses a logistic regression model to pinpoint business functional modules, combines keyword retrieval with fine-tuned vector retrieval, and dynamically optimizes the weight coefficients of the two retrieval features using an adaptive fusion neural network model. This allows for the selection of target business knowledge base document blocks, and the generation of test cases using a large language model. This solves the problems of low efficiency in manually designed test cases, the susceptibility to illusions in large-model generated test cases, and the insufficient retrieval accuracy, low efficiency, and rigid retrieval strategies of traditional retrieval enhancement generation techniques. It improves the accuracy and efficiency of generated test cases, enhances the fit between test cases and business requirements and rules, effectively reduces invalid or erroneous test cases, and adapts to different business scenarios and user input specifications.

[0018] To make the above-mentioned objectives, features and advantages of this application more apparent and understandable, preferred embodiments are described below in detail with reference to the accompanying drawings. Attached Figure Description

[0019] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of this application and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.

[0020] Figure 1One of the flowcharts for a test case generation method based on hybrid retrieval provided in an embodiment of this application; Figure 2 A second flowchart illustrating a test case generation method based on hybrid retrieval provided in an embodiment of this application; Figure 3 This is one of the structural schematic diagrams of a test case generation device based on hybrid retrieval provided in an embodiment of this application; Figure 4 This is a second schematic diagram of a test case generation device based on hybrid retrieval provided in an embodiment of this application; Figure 5 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation

[0021] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. The components of the embodiments of this application described and shown in the accompanying drawings can generally be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of this application provided in the accompanying drawings is not intended to limit the scope of the claimed application, but merely represents selected embodiments of this application. Based on the embodiments of this application, every other embodiment obtained by those skilled in the art without inventive effort falls within the scope of protection of this application.

[0022] Research has shown that software testing is a core component in ensuring software product quality, and test case design is the foundation of software testing. Test cases are a set of standardized test instructions used by testers to verify whether a system meets expected functions, business logic, and requirements; their quality directly determines the testing effectiveness. Currently, there are three main approaches to test case design, all of which have significant shortcomings.

[0023] Specifically, manually designing test cases is the traditional method of test case design, which refers to testers manually planning and writing test cases based on a deep understanding of software requirements, business logic, and system functions. The core drawback of this method is that it is time-consuming and labor-intensive, extremely inefficient, and prone to omissions or incompleteness of test cases due to human error, making it unable to meet the testing needs of large-scale, complex software systems.

[0024] The core of using Large Language Models (LLMs) to automatically generate test cases is to use the LLM to automatically extract test points and generate structured test cases based on inputs such as requirements documents. This approach aims to improve efficiency and reduce the risk of human oversight by replacing manual drafting of test cases in batches. However, this method has significant shortcomings: the LLM lacks in-depth understanding of specific business scenarios and rules, which can easily lead to "illusions" (i.e., generating content that is irrelevant to the actual business and does not conform to business logic), resulting in invalid or erroneous test cases. These cases still require a lot of manual verification and are difficult to truly improve testing efficiency.

[0025] Retrieval-Augmented Generation (RAG) is a technical architecture that combines information retrieval with large language model generation. Its core goal is to solve the illusion problem of large models and improve the accuracy and timeliness of generated content. The principle is to allow the large model to retrieve information related to the current question from an external knowledge base before generating an answer, and then generate the answer based on this real and reliable information, rather than simply relying on the "memory" of the model's pre-training.

[0026] Traditional retrieval enhancement generation techniques, when used to assist in generating test cases for large models, typically employ single keyword matching or vector matching as their retrieval strategy. Keyword matching can achieve precise literal matching but cannot understand the semantics of the text, easily missing relevant information that is semantically similar but literally different. Vector matching alone can understand the semantics of the text and achieve similarity matching, but the matching accuracy is insufficient, easily retrieving irrelevant knowledge.

[0027] In addition, traditional retrieval-enhanced generation technology has the following core problems: First, semantic matching bias, which easily leads to the false detection of irrelevant knowledge and insufficient retrieval accuracy. This results in generated test cases that are not closely related to business needs and deviate from core requirements, making manual verification costly and offsetting its efficiency advantage. Second, retrieval efficiency is low, as it requires a global search of all blocks in the knowledge base and fails to achieve precise scope locking. Third, it lacks adaptability and is difficult to adapt to personalized test specifications input by users. User input may be colloquial or contain professional terminology, and when the retrieval effect is poor, it cannot dynamically optimize the retrieval strategy, further affecting the quality of generated test cases.

[0028] Based on this, this application provides a test case generation method based on hybrid retrieval. By extracting keyword information from business requirement information, using a logistic regression model to lock in business function modules, combining keyword retrieval and fine-tuned vector retrieval, and relying on an adaptive fusion neural network model to dynamically optimize the weight coefficients of the two retrieval features, the method selects target business knowledge base document blocks and generates test cases using a large language model. This solves the problems of low efficiency in manually designing test cases, the tendency of large model-generated test cases to produce illusions, and the insufficient retrieval accuracy, low efficiency, and rigid retrieval strategies of traditional retrieval enhancement generation techniques in the prior art. It improves the accuracy and efficiency of generating test cases, enhances the fit between test cases and business requirements and rules, and effectively reduces invalid or erroneous test cases to adapt to different business scenarios and user input specifications.

[0029] Please see Figure 1 , Figure 1 This is one of the flowcharts for a test case generation method based on hybrid retrieval provided in an embodiment of this application. For example... Figure 1 As shown in the embodiments of this application, the test case generation method based on hybrid retrieval includes: S101. In response to obtaining the input business requirement information, extract the keyword information from the business requirement information, and use a preset logistic regression model to determine at least one business function module corresponding to the keyword information.

[0030] In this embodiment of the application, business requirement information refers to the requirement description input by the user for generating test cases, which can be in the form of natural language (e.g., including colloquial description, professional terminology description, etc.). For example, business requirement information may include: "High-definition reshooting 3D reconstruction, the user can select multiple reshooting images to improve the reconstruction clarity."

[0031] Here, keyword information refers to words extracted from business requirement information that can represent the core content of the requirements. It is the core basis for matching business function modules and realizing retrieval.

[0032] In this embodiment, the logistic regression model is a lightweight and efficient classification model that is pre-trained with keyword samples from business modules. It can identify the corresponding business function module and output the credibility based on the input keyword information, thereby narrowing the search scope.

[0033] Here, business function modules refer to independent functional units in a software system that are divided according to business logic, such as data collection, scene generation, and scene viewing. Each module corresponds to specific business rules and functional points.

[0034] In this step, in specific implementation, first, business requirement information (in the form of natural language) input by a user is received, and keyword information capable of representing the core requirement is extracted from the business requirement information through a preset text processing procedure; subsequently, the extracted keyword information is input into a pre-trained logistic regression model, and the logistic regression model identifies and outputs at least one business function module corresponding to the keyword information based on the correspondence between "keywords and business modules" learned during the training process, so as to realize accurate matching between the business requirement and the business modules.

[0035] Here, the core keywords of the business requirement are extracted, the business function modules related to the requirement are locked, the subsequent retrieval range is narrowed, the problem of low efficiency caused by global retrieval is avoided, and the retrieval direction is ensured to be highly consistent with the business requirement.

[0036] In this way, business modules irrelevant to the business requirement are quickly filtered out, the retrieval range is narrowed from the entire business knowledge base to specific business function modules, and the subsequent retrieval efficiency is greatly improved; at the same time, through keyword extraction, the core of the business requirement is accurately captured, which lays a foundation for subsequently generating business-conforming test cases and reduces interference from irrelevant information.

[0037] In one implementable embodiment of the present application, in specific implementation, the step of extracting the keyword information in the business requirement information in step S101 in response to obtaining the input business requirement information may include: S1011. In response to obtaining the input business requirement information, split the text corresponding to the business requirement information into a plurality of candidate words by using a preset word segmentation tool, and filter out stop words in the text corresponding to the business requirement information.

[0038] In this step, after the business requirement information input by the user is received, a preset Chinese word segmentation tool is first used to split the natural language text corresponding to the business requirement information into a plurality of independent candidate words; subsequently, stop words in the text are filtered out, redundant information is removed through stop word filtering, and candidate words with business significance are retained.

[0039] In the embodiment of the present application, the preset word segmentation tool may include a "jieba" word segmentation tool, which can split Chinese text into a computable and analyzable word list.

[0040] Here, the stop words refer to function words that have no actual business significance and are not helpful for representing the core of the requirement, such as "de", "he", "baohan", "cong'er", "keyi", etc.

[0041] S1012. The importance score corresponding to each candidate word is determined by using a preset text feature weight calculation method, and the candidate words are sorted in descending order according to the importance score to obtain the keyword ranking result.

[0042] In this step, a preset text feature weight calculation method is used to calculate the importance score for each filtered candidate word; then, all candidate words are sorted in descending order of importance score to obtain the keyword ranking result. The higher the score, the more important the word is to the core of the business needs.

[0043] In this embodiment of the application, the text feature weight calculation method adopts the TF-IDF algorithm. The TF-IDF algorithm is a classic text feature weight calculation algorithm. Its core function is to quantify "the importance of a word to a document". It calculates the TF value (term frequency, which refers to the frequency of a word in the text) and IDF value (inverse document frequency, which refers to the inverse ratio of the frequency of a word in all documents) of a word, and multiplies the two to obtain the TF-IDF value, that is, the importance score of the word.

[0044] For example, the TF-IDF algorithm is used to calculate the importance score of each word in the filtered candidate word list. "Data collection" appears twice, "HD reshoot" twice, "reshoot" three times, and "image" three times. These words have high TF values ​​and are core business terms in the business knowledge base, appearing only in a few business documents, thus their IDF values ​​are high, resulting in high importance scores. Words like "attention," "new," and "functional point" have lower importance scores, while words like "user" and "selection" have lower importance scores. The resulting keyword ranking (in descending order of score) is: reshoot, image, data collection, HD reshoot, 3D reconstruction, functional point, new, reshoot point, clear, need, add, attention, user, multiple images, result.

[0045] S1013. Extract the candidate words corresponding to the preset number of keywords from the keyword ranking results to extract keyword information.

[0046] In this embodiment of the application, the preset number of keywords is a preset positive integer, which can be flexibly adjusted according to the business scenario. For example, the preset number of keywords can be between 5 and 10.

[0047] In one possible implementation of this application, in specific implementation, the step S101 of determining at least one business function module corresponding to the keyword information using a preset logistic regression model may include: S1014. Input the keyword information into a preset logistic regression model to obtain at least one candidate functional module corresponding to the keyword information output by the logistic regression model and the credibility result corresponding to each candidate functional module.

[0048] In this step, the extracted keyword information is input into the logistic regression model. Based on the learned correspondence, the logistic regression model will output one or more candidate functional modules that the keyword information may correspond to, and at the same time output the confidence result of each candidate functional module.

[0049] The credibility result is used to characterize the degree of association between keyword information and the candidate functional module, and the initial value range is not fixed.

[0050] In this embodiment of the application, the preset logistic regression model is pre-trained using keyword samples from business modules. The model has learned the correspondence between different keywords and various business functional modules.

[0051] Specifically, when training the logistic regression model, the different business modules (data collection, scene generation, etc.) were first identified, and then a batch of "core keywords or typical expressions" were compiled for each module. Then, a TF-IDF vector generator was used to extract all the previously compiled keywords into features, and the word-segmented keyword text was converted into a numerical feature matrix (each row corresponds to a keyword, and each column corresponds to the TF-IDF weight of a term) through the TF-IDF vector generator. After that, the module names were converted into numerical labels to meet the model training requirements (assigning a "business representativeness score" to each word so that the logistic regression model can identify which words are more important to which module, and converting the abstract module names into numerical labels).

[0052] Furthermore, the organized feature data is first divided into a "training set" and a "test set". Then, the logistic regression model is used to "learn". Through the data in the training set, the model learns the pattern of "which features correspond to which business modules". After training, the logistic regression model has the ability to "identify business modules" by inputting several keywords.

[0053] S1015. Normalize the credibility result to obtain the normalized score corresponding to each candidate functional module, and sort the candidate functional modules in descending order according to the normalized score to obtain the functional module sorting result.

[0054] In this step, the Min-Max normalization method is used to map the confidence result of the model output to the range of 0-1, so as to obtain the normalized score corresponding to each candidate functional module. Then, all candidate functional modules are sorted in descending order of normalized score to obtain the functional module ranking result, which is convenient for subsequent screening of core business functional modules.

[0055] Here, the closer the normalized score is to 1, the higher the correlation between the keyword information and the candidate functional module; the closer it is to 0, the lower the correlation.

[0056] For example, suppose the credibility results are: Data Acquisition 1.2, Scene Generation 0.98, Scene Viewing 0.25, Scene Data Generation and Management 0.12. After normalization, the normalized scores are: Data Acquisition (1.0), Scene Generation (0.8796), Scene Viewing (0.2348), Scene Data Generation and Management (0.1111). Sorting the normalized scores in descending order, the functional modules are: Data Acquisition, Scene Generation, Scene Viewing, Scene Data Generation and Management.

[0057] S1016. Extract the candidate functional modules corresponding to the preset number of modules from the functional module sorting results to determine at least one business functional module corresponding to the keyword information.

[0058] In this embodiment of the application, the number of preset modules can be flexibly adjusted according to the business scenario. For example, the number of preset modules can be set to 2 to 3.

[0059] In this step, the candidate functional modules with the highest ranking of the functional modules are extracted from the sorted results. These modules are at least one business functional module that corresponds to the keyword information and has the highest relevance to the business requirements, thus completing the determination of the business functional modules.

[0060] S102. Based on the business function modules, a search is performed in the pre-defined business knowledge base using a preset keyword retrieval method and a preset fine-tuning vector model, respectively, to obtain the sparse features and dense vector features corresponding to the document blocks of the business knowledge base in each business function module, and the weight coefficients corresponding to the sparse features and the dense vector features are determined using a preset adaptive fusion neural network model.

[0061] In this embodiment of the application, the keyword retrieval method adopts the BM25 algorithm (Best Matching 25, a classic keyword retrieval algorithm based on statistical rules). Its core function is to calculate the keyword matching relevance score between the user query (keyword information) and the document block. The higher the score, the higher the keyword overlap and matching degree between the two, and the more likely the document is to be the result needed by the user.

[0062] The fine-tuned vector model is based on the Sentence-BERT model (Sentence-BERT, or SBERT for short, is an improved BERT model designed to generate semantic vectors at the sentence or paragraph level. It can convert text of any length into dense vectors of fixed dimensions. The higher the cosine similarity between vectors, the closer the semantics of the texts are). It is fine-tuned using domain-specific triplet annotation data to generate semantic vectors for text, achieving accurate matching at the semantic level.

[0063] The fine-tuned vector model is obtained by fine-tuning a preset sentence embedding generation model based on preset triplet labeled data and using a preset triplet loss function.

[0064] Specifically, when fine-tuning the pre-set sentence embedding generation model, firstly, targeted fine-tuning is performed using triplet-labeled data to optimize the model's semantic vector encoding capability; then, the pre-trained sentence embedding generation model (Sentence-BERT Chinese model) is loaded; finally, the model fine-tuning training is started using the pre-set triplet loss function, and the fine-tuning effect is verified to obtain the fine-tuned vector model.

[0065] The triplet-labeled data includes anchor sentences, positive sample sentences, and negative sample sentences.

[0066] Here, the anchor sentence serves as the "benchmark reference sentence," representing the core semantics you want to anchor to in the entire triplet; the positive sentence is a sentence that is highly related to or similar to the anchor in semantics, and is the target that the model needs to "pull closer" to; the negative sentence is a sentence that is unrelated to or low in relation to the anchor in semantics, and is the target that the model needs to "push away" from.

[0067] In this embodiment, the business knowledge base is a collection of business knowledge that is pre-organized and divided into blocks according to specified rules. It contains core business information such as the functional modules, functional points, and business descriptions of the software system, and is used to provide the business knowledge support required for retrieval. Its block setting is to achieve accurate retrieval and improve retrieval efficiency.

[0068] For example, business knowledge can be organized according to specified rules, so that when performing block retrieval of the business knowledge base later, the corresponding functional module block can be found, thereby improving retrieval efficiency. For example, the specified rules may include: functional module: scene generation; functional point: single scene; business description; functional point: map fusion; business description.

[0069] Furthermore, for example, segmenting the business knowledge base into blocks based on specified rules may include: Multi-format file text extraction: Specifically handling Word (.docx) and PDF (.pdf) files, automatically identifying file formats, and then extracting plain text from the documents (ignoring formatting and images, retaining only the text content). Structured parsing of business documents: Dedicated optimizations for business documents, using regular expressions to accurately match [functional modules], [functional points], and [business descriptions] within the document. Sliding window segmentation of long text: If the business description of a certain functional point is too long (exceeding the preset CHUNK_SIZE), it is segmented into multiple appropriately sized blocks using a "sliding window" method, with a certain amount of overlap between adjacent blocks (CHUNK_OVERLAP) to avoid semantic breaks caused by segmentation. Layered processing and vectorization of individual files: Refined processing of each parsed module and function point: Adding metadata tags for modules and functions to each small block (e.g., [module: scene generation, function point: high-definition reshoot]) so that it can be associated with specific business during subsequent retrieval; Vectorizing "tags and text blocks" using a fine-tuned vector model to generate corresponding semantic vectors (converted into list format for easy subsequent storage and retrieval); Assigning a unique chunk_id to each small block and recording metadata such as source file and block index, and finally encapsulating it into a standardized dictionary format.

[0070] Here, sparse features refer to features obtained through keyword retrieval methods that represent the degree of keyword matching. They are one-dimensional scalars and primarily reflect the degree of literal matching between texts. Dense vector features refer to features obtained through fine-tuning vector models that represent the semantic relevance of texts. They are dense vectors with fixed dimensions (e.g., 768 dimensions) and primarily reflect the degree of semantic similarity between texts.

[0071] In the embodiments of this application, the adaptive fusion neural network model is a deep learning network specifically designed for the fusion of "sparse features and dense vector features". It can dynamically learn and determine the weight coefficients of the two features, solve the problems of modal heterogeneity, modal crushing, distribution imbalance and weight rigidity in traditional hybrid retrieval, and achieve accurate fusion of the two features.

[0072] The adaptive fusion neural network model includes a feature projection layer, a modality equalization normalization layer, a multi-head attention layer, a cross-modal gating layer, a residual enhancement layer, and a fully connected output layer.

[0073] Here, the role of the adaptive fusion neural network model is to receive multimodal features (sparse keyword features, dense document semantic features, and business requirement semantic features), automatically learn the correlation between multimodal information, and dynamically output the optimal fusion weights of sparse features and dense vector features for each group of "business requirements and document chunks" samples, thereby achieving adaptive weighting of retrieval scoring and adaptively balancing the contribution of keyword retrieval and semantic retrieval.

[0074] Among them, the fusion weights output by the multimodal adaptive fusion neural network have higher rationality: the network is trained with the retrieval relevance task objective, the weight decision logic is driven by real business labeled data, the optimization target directly aligns with the retrieval recall accuracy, and gets rid of the subjective bias brought by human experience; by modeling the complex nonlinear relationship between business requirements, document segmentation, and keyword matching information through a multi-head attention mechanism, it can handle complex cross-matching scenarios that are difficult to cover by manual rules; relying on the structural design of modal equilibrium normalization, cross-modal noise filtering, and residual feature preservation, it ensures that sparse features and dense vector features participate in the calculation fairly, reducing the risk of weight misjudgment caused by noise interference; it realizes dynamic output of fusion weights for each sample, adaptively balances the contribution of keyword matching and semantic matching for different query intentions, and adapts to diverse retrieval scenarios.

[0075] For example, a breakdown of the input and output details for each layer in an adaptive fusion neural network model includes: Feature projection layer (3-way independent Linear+ReLU): Query branch: Input parameters: query semantic vector of dimension [1, 768], output content: query projection features of dimension [1, 128]; Document branch: Input parameters: document semantic vector of dimension [1, 768], output content: document projection features of dimension [1, 128]; BM25 branch: Input parameters: BM25 normalized matching score of dimension [1, 1], output content: BM25 projection features of dimension [1, 128].

[0076] Modal equalization normalization layer (LayerNorm): Query feature normalization: Input parameters: query projection features of dimension [1, 128], output content: normalized query features of dimension [1, 128]; Document feature normalization: Input parameters: document projection features of dimension [1, 128], output content: normalized document features of dimension [1, 128]; BM25 feature normalization: Input parameters: BM25 projection features of dimension [1, 128], output content: normalized BM25 features of dimension [1, 128].

[0077] Multi-head attention layer (4-head self-attention): Input parameters: three sets of normalized modal features with dimensions [1, 128], output content: multi-modal interactive attention fusion features with dimensions [1, 384].

[0078] Cross-modal gating layer: Input parameters: attention fusion features of dimension [1, 384], output content: gating and filtering enhancement features of dimension [1, 384].

[0079] Residual Enhancement Layer: Input parameters: gated features of dimension [1, 384], original projected stitched features of dimension adaptation [1, 384], output content: residual fusion enhancement features of dimension [1, 384].

[0080] Fully connected output layer: Input parameters: residual augmentation features of dimension [1, 384], output content: normalized dynamic fusion weights of dimension [1, 2] (weight sum is 1).

[0081] The weight coefficients are the coefficients output by the adaptive fusion neural network model that characterize the importance of sparse features and dense vector features. They include sparse weight coefficients (corresponding to sparse features) and dense weight coefficients (corresponding to dense vector features), and the sum of the two is 1. They are used to calculate the fusion score.

[0082] Here, each business knowledge base document segment generates a separate set of weight coefficients. Specifically, the pairing relationship is as follows: a query semantic vector is paired with the semantic vector and corresponding BM25 score of each business knowledge base document segment to form a set of inputs, which are then fed into the network for computation. The output result is a set of [w1, w2] weight coefficients for each set of inputs: w1: the BM25 matching weight corresponding to the current single document segment, and w2: the semantic vector matching weight corresponding to the current single document segment. In practice, this set of weights is used to weightedly fuse the BM25 score and semantic similarity score of the current segment to obtain the comprehensive relevance score of the segment. Finally, the retrieval and ranking are completed based on the comprehensive score of all segments.

[0083] In this step, the search scope is defined by specific document blocks in the business knowledge base. Instead of a global search, two parallel search methods are employed: First, a pre-defined keyword search method is used to calculate the keyword matching degree between each user's query business requirement and the corresponding document block in the business knowledge base, resulting in sparse features. Second, a pre-defined fine-tuned vector model is used, inputting the user's query business requirement and the document blocks in the business knowledge base into the model to generate dense vector features representing the semantic relevance between the two. Subsequently, the obtained sparse and dense vector features are input into a pre-defined adaptive fusion neural network model. This network model dynamically learns and outputs the weight coefficients corresponding to the two features through multi-stage processing, achieving adaptive adaptation of the two search features.

[0084] The weighting coefficients include sparse weighting coefficients corresponding to sparse features and dense weighting coefficients corresponding to dense vector features.

[0085] Here, the advantages of keyword retrieval (literal exact matching) and vector retrieval (semantic similarity matching) are combined to make up for the shortcomings of single retrieval methods; by dynamically allocating the weights of the two features through an adaptive fusion neural network model, the problems of rigid weights, modal heterogeneity, and modal overwhelming in traditional hybrid retrieval are solved, thereby improving retrieval accuracy.

[0086] In this way, both precise matching at the keyword level and similarity matching at the semantic level are achieved, avoiding false detection and missed detection problems caused by a single search method. The adaptive weight allocation can be dynamically adjusted according to different business scenarios and different needs, making the search results more in line with business needs. The search accuracy is significantly improved compared with the traditional RAG technology, while the search scope is locked on specific business modules, greatly improving search efficiency.

[0087] In one possible implementation of this application, in specific implementation, step S102, based on the business function module, involves searching the pre-defined business knowledge base using a preset keyword retrieval method and a preset fine-tuning vector model, respectively, to obtain the sparse features and dense vector features corresponding to the document blocks in the business knowledge base of each business function module. This step may include: S1021. Calculate the keyword matching degree between each user's query business needs and the document blocks in the pre-defined business knowledge base using a preset keyword retrieval method.

[0088] Here, the pre-defined business knowledge base is organized and segmented according to the rules of "functional modules, functional points, and business descriptions," and each document block is bound to the corresponding business functional module tag.

[0089] In this step, for each business knowledge base document block in the identified business function module, the name of the module and the corresponding keyword information are used as query conditions. The keyword retrieval method is used to calculate the keyword matching degree between the query conditions and all document blocks under the corresponding function module in the business knowledge base. The higher the matching degree, the higher the overlap between the document block and the keywords of the user's query business needs.

[0090] S1022. Normalize the keyword matching degree to determine the sparse features corresponding to the business knowledge base document blocks in each business function module.

[0091] In this step, the Min-Max normalization method is used to map the calculated keyword matching degree (BM25 original score) to the range of 0 to 1. The normalized score is the sparse feature corresponding to the document block of the business knowledge base. The sparse feature is a one-dimensional scalar that directly represents the accuracy of keyword matching.

[0092] For example, for the business function module "Scene Generation", the corresponding keyword information is ['reshooting', 'image', 'high-definition reshooting', '3D reconstruction']. Using this information as query conditions, the BM25 algorithm is used to calculate the keyword matching degree between the query conditions and all document blocks under the "Scene Generation" module in the business knowledge base. Among them, the keyword matching degree of document blocks such as "high-definition reshooting requires shooting with the same device", "single scene reconstruction can set the maximum number of Gaussian points", and "aerial reconstruction image resolution must be higher than 1024×768" are relatively high, and the matching degree scores are 8.5, 7.2 and 6.8 respectively. The matching degree scores of the remaining document blocks are relatively low (such as 2.1 and 1.5).

[0093] Furthermore, for example, the original BM25 scores (8.5, 7.2, 6.8, 2.1, 1.5) of each document block under the above "Scene Generation" module are normalized. The sparse features obtained after normalization are 0.85, 0.72, 0.68, 0.21, and 0.15, respectively. These sparse features accurately reflect the degree of keyword matching between each document block and the "Scene Generation" module and keyword information.

[0094] S1023. Input the user query business requirements and the business knowledge base into a preset fine-tuning vector model to obtain dense vector features output by the fine-tuning vector model that represent the semantic relevance between each user query business requirement and the document block.

[0095] In this step, the determined user query business requirements (and their keyword information) and the document blocks in the business knowledge base are input into the fine-tuning vector model. The model will output the semantic vector corresponding to the user query business requirements and the semantic vector corresponding to each document block. By calculating the cosine similarity between the two vectors, a value representing the semantic relevance between the two is obtained. This value is the dense vector feature (768-dimensional dense vector) corresponding to the document block of the business knowledge base. The higher the cosine similarity, the stronger the semantic relevance.

[0096] In one possible implementation of this application, in specific implementation, the step S102 of determining the weight coefficients corresponding to the sparse features and the dense vector features using a preset adaptive fusion neural network model may include: S1024. The feature projection layer maps the sparse features and the dense vector features to a preset dimension respectively, thereby obtaining sparse features and dense vector features of the same dimension.

[0097] Here, the input to the feature projection layer is the query semantic vector, the document semantic vector, and the BM25 normalized matching score.

[0098] Among them, the query semantic vector is a dense feature representation obtained by semantically encoding the search text input by the user; the generation process includes: first, using jieba to segment the query text, then inputting it into the fine-tuned pre-trained vector model, and the model outputs the encoding result; the data form is a floating-point vector with dimensions [1, 768]; its core function is to represent the overall semantics and query intent of the user's search, and to be used for semantic matching of document content.

[0099] Document semantic vectors are dense feature representations obtained by semantically encoding single document blocks in a knowledge base. The generation process includes: after segmenting the document fragments into words, they are fed into the same fine-tuned vector model as the query end to complete the encoding. The data form is a floating-point vector with dimensions [1, 768]. Its core function is to characterize the content semantics of document blocks and to calculate semantic similarity with the query semantic vector.

[0100] The BM25 normalized matching score is a one-dimensional scalar feature based on the relevance score obtained from keyword literal matching and after extreme value normalization. The generation process includes: segmenting the query text and document into blocks and words respectively, extracting keywords, calculating the original keyword matching score using the BM25 algorithm, and normalizing the score to the range of 0 to 1 using MinMaxScaler. The data form is a scalar value of dimension [1, 1], which is not a vector. Its core function is to represent the degree of keyword literal overlap between the query and the document, supplementing the matching information of traditional retrieval dimensions.

[0101] Here, the feature projection layer consists of three independent linear layers and a ReLU activation function, which solves the problem of dimensional heterogeneity between sparse features (1-dimensional scalar) and dense vector features (768-dimensional) (different dimensions cannot interact directly).

[0102] In this step, sparse features and dense vector features are input into their respective linear layers. Both are mapped to a preset dimension (128 dimensions in this invention) through linear transformation. At the same time, the nonlinearity of the features is increased by the ReLU activation function, and finally, sparse features and dense vector features of the same dimension are obtained, laying the foundation for subsequent fusion processing.

[0103] For example, the sparse features (0.85, 1-dimensional) and dense vector features (768-dimensional) of a document block under the "Scene Generation" module are input into the feature projection layer. Through linear layer transformation and ReLU activation, they are mapped to 128-dimensional sparse features and 128-dimensional dense vector features of the same dimension, respectively. The two have the same dimension and can be used for subsequent interactive processing.

[0104] S1025. The modal equalization normalization layer normalizes the same-dimensional sparse features and the same-dimensional dense vector features respectively to obtain the calibrated sparse features and calibrated dense vector features.

[0105] Here, the modal equalization normalization layer adopts the LayerNorm (layer normalization) method, which solves the problem of imbalance in the distribution of sparse features and dense vector features of the same dimension. Specifically, the numerical range of dense vector features is usually between ±1, while the numerical range of sparse features is between 0 and 1. Direct interaction will cause sparse features to be ignored, i.e., "modal crushing".

[0106] In this step, LayerNorm processing is performed on the same-dimensional sparse features and same-dimensional dense vector features respectively, normalizing them to an interval with a mean of 0 and a variance of 1, so that the two modal features "start on the same starting line" and ensure the fairness of subsequent interactions, thus obtaining the calibrated sparse features and calibrated dense vector features.

[0107] For example, LayerNorm processing is performed on the 128-dimensional sparse features and the 128-dimensional dense vector features of the same dimension. After normalization, the calibrated sparse features (mean 0, variance 1, 128 dimensions) and the calibrated dense vector features (mean 0, variance 1, 128 dimensions) are obtained. The numerical distributions of the two are consistent, thus avoiding the modal crushing problem.

[0108] S1026. The multi-head attention layer captures the semantic relationships between the business requirement information, the keyword information, and the document blocks in the business knowledge base based on the calibrated sparse features and the calibrated dense vector features, and obtains attention features.

[0109] Here, the multi-head attention layer adopts a 4-head self-attention mechanism. Its core function is to capture the semantic relationship between "business requirement information, keyword information, and document chunking". For example, when the sparse feature score is high but the dense vector feature score is low, the weight of the sparse feature needs to be increased, and vice versa.

[0110] In this step, firstly, sequence dimensions are added to the calibrated sparse features, calibrated dense vector features, and semantic vectors corresponding to business requirements (generated by a fine-tuned vector model, 128 dimensions), and concatenated into a sequence of [1, 3, 128] (the three tokens correspond to business requirements, dense vector features, and sparse features, respectively); the attention weights between the three are calculated through a 4-head self-attention mechanism to learn the dependencies between features; finally, the attention output is flattened into a feature vector of [1, 384] (3×128), which is the attention feature.

[0111] For example, the 128-dimensional sparse features, the 128-dimensional dense vector features, and the 128-dimensional semantic vector corresponding to the business requirement information "HD reshoot 3D reconstruction" are concatenated into a sequence of [1,3,128] after adding a sequence dimension. The attention weights of the three are calculated through a 4-head self-attention mechanism. It is learned that the keyword "HD reshoot" has a strong semantic association with the document block "HD reshoot requires shooting with the same device" and the keyword matching degree is also high. Therefore, high attention weights are given to both. After flattening the attention output, the attention feature of [1,384] is obtained.

[0112] S1027. The gating coefficients generated by the cross-modal gating layer are multiplied element-wise with the attention features to obtain the gating features.

[0113] Here, the cross-modal gating layer consists of a linear layer and a sigmoid activation function. Its core function is to filter out noise information in the attention features and select effective features.

[0114] In this step, the attention features ([1,384]) are converted into gating coefficients (ranging from 0 to 1) of [1,384] through a linear layer. Dimensions with gating coefficients close to 1 represent effective features, and dimensions close to 0 represent noisy features. The gating coefficients are then multiplied element-wise with the attention features to retain effective features and suppress noisy features, thus obtaining the gating features.

[0115] For example, the attention features of [1,384] are input into the cross-modal gating layer to generate gating coefficients of [1,384]. The gating coefficients corresponding to the feature components related to semantic information such as "high-definition reshoot", "reshoot image", and "3D reconstruction" are close to 1 (e.g., 0.92, 0.88), while the gating coefficients corresponding to the feature components related to irrelevant information are close to 0 (e.g., 0.15, 0.08). The gating coefficients are multiplied element-wise with the attention features to obtain the gating features, which effectively filters out irrelevant noise.

[0116] S1028. The residual enhancement layer concatenates the same-dimensional sparse features and the same-dimensional dense vector features to obtain concatenated projection features, and adds the concatenated projection features to the gated features to obtain residual enhancement features.

[0117] Here, the residual enhancement layer adopts the residual connection method, which is the core solution to the gradient vanishing problem that easily occurs during deep network training and avoids the loss of feature information.

[0118] In this step, the sparse features (128-dimensional) and dense vector features (128-dimensional) of the same dimension are first concatenated to obtain the concatenated projection features of [1,256]. Then, the concatenated projection features are added to the gated features ([1,384]) after dimensionality adaptation to obtain the residual enhancement features. This retains both the interaction information learned by attention and the basic information of the original projection features, thereby improving the stability of network training.

[0119] For example, 128-dimensional sparse features and 128-dimensional dense vector features of the same dimension are concatenated to obtain the concatenated projection features of [1,256]. The dimensions of the concatenated projection features are expanded to match the dimensions of the gated features of [1,384]. The two are then added together to obtain the residual enhancement features of [1,384]. This effectively avoids gradient vanishing and retains all the effective feature information.

[0120] S1029. The fully connected output layer sequentially performs feature compression and normalization on the residual enhancement features to obtain the weight coefficients corresponding to the sparse features and dense vector features output by the fully connected output layer.

[0121] Here, the fully connected output layer consists of two linear layers, a Dropout layer, and a Softmax normalization layer. The core objective is to output the normalized dynamic weight coefficients (sparse weight coefficients and dense weight coefficients, the sum of which is 1).

[0122] In this step, the residual enhancement features ([1,384]) are first compressed to 64 dimensions through the first linear layer, and the model is prevented from overfitting through the Dropout layer (with a dropout probability of 0.1). Then, the 64-dimensional features are converted into 2-dimensional original weights through the second linear layer. Finally, the original weights are normalized through the Softmax normalization layer to obtain the sparse weight coefficients corresponding to the sparse features and the dense weight coefficients corresponding to the dense vector features, thus completing the determination of the weight coefficients.

[0123] For example, the residual enhancement feature of [1,384] is input into the fully connected output layer. The first linear layer compresses it to 64 dimensions, and the Dropout layer filters out the risk of overfitting. The second linear layer converts the 64-dimensional feature into 2-dimensional original weights (such as [0.30, 0.70]). After Softmax normalization, the sparse weight coefficient is 0.3 and the dense weight coefficient is 0.7 (the sum of the two is 1), which means that in the retrieval of this document block, the weight of dense vector features (semantic matching) is higher than that of sparse features (keyword matching), which is consistent with the characteristics of strong semantic relevance and high keyword matching degree of this document block.

[0124] S103. Based on the weight coefficients and the sparse features and dense vector features corresponding to each business knowledge base document block, determine the fusion score value corresponding to each business knowledge base document block, and based on the fusion score value, determine the target business knowledge base document block in the business knowledge base document block.

[0125] In this embodiment, the fusion score is a comprehensive score calculated based on weighting coefficients, sparse features, and dense vector features. It is used to measure the degree of correlation between business knowledge base document blocks and business requirement information. The higher the score, the higher the correlation. The target business knowledge base document block is the business knowledge base document block with the highest correlation to business requirement information selected based on the fusion score. It is the core business basis for generating test cases in the future.

[0126] In this step, a weighted summation method is used to multiply the sparse features corresponding to each business knowledge base document block by the corresponding sparse weight coefficient to obtain the first product result; the dense vector features corresponding to the business knowledge base document block are multiplied by the corresponding dense weight coefficient to obtain the second product result; the first product result and the second product result are added to obtain the fusion score value corresponding to the business knowledge base document block; the fusion scores of all business knowledge base document blocks are sorted, and the business knowledge base document block with the highest fusion score and the highest relevance to business requirements is selected as the target business knowledge base document block.

[0127] Here, by integrating scores to comprehensively measure the relevance between business knowledge base document blocks and business requirements, the target business knowledge base document blocks that best meet the requirements are accurately selected, providing core business basis for generating high-quality test cases in the future.

[0128] In this way, the fusion score can comprehensively reflect the keyword matching degree and semantic similarity, avoiding the bias caused by a single feature measurement, and ensuring that the document blocks of the target business knowledge base are highly aligned with business requirements; at the same time, through sorting and filtering, the core business knowledge is further focused on, reducing the interference of irrelevant business modules, and ensuring the accuracy of subsequent test case generation.

[0129] In one possible implementation of this application, step S103 may include: S1031. Multiply the sparse weight coefficient corresponding to each sparse feature with the sparse feature to obtain a first product result, and multiply the dense weight coefficient corresponding to each dense vector feature with the dense vector feature to obtain a second product result.

[0130] In this step, for each document block under each business function module, a weighted calculation is performed: the sparse features of the document block are multiplied by the corresponding sparse weight coefficients to obtain the first product result (representing the weighted score of keyword matching); the dense vector features of the document block are multiplied by the corresponding dense weight coefficients to obtain the second product result (representing the weighted score of semantic matching). Through the weighted calculation, the difference in importance between the two features is reflected.

[0131] For example, for a document block under the "Scene Generation" module, its sparse feature is 0.85, the sparse weight coefficient is 0.3, and the result of the first product is 0.85 × 0.3 = 0.255; its dense vector feature is 0.82, the dense weight coefficient is 0.7, and the result of the second product is 0.82 × 0.7 = 0.574; the weighted score of this document block reflects the contribution of keyword matching and semantic matching, respectively.

[0132] S1032. The sum of the first product result and the second product result is determined as the fusion score value corresponding to each of the business knowledge base document blocks.

[0133] In this step, for each document block under each business function module, the first product result and the second product result are added together to obtain the fusion score value of the document block, which measures the degree of correlation between the business knowledge base document block and business requirements.

[0134] For example, suppose the first product result of the above document block is 0.255 and the second product result is 0.574, and its fusion score is 0.255 + 0.574 = 0.829; suppose there are 5 document blocks under the "Scene Generation" business knowledge base document block, and their fusion scores are 0.829, 0.756, 0.718, 0.231 and 0.152 respectively.

[0135] S1033. Sort the business knowledge base document blocks in descending order according to the fusion score value to obtain the business knowledge base document block sorting result.

[0136] In this step, all the identified business knowledge base documents are divided into blocks and sorted in descending order of their respective integration scores to obtain the sorting results of the business knowledge base document blocks. The higher the sorting, the higher the relevance of the business knowledge base document block to the business requirements.

[0137] S1034. Extract the business knowledge base document blocks corresponding to the preset number of document blocks from the business knowledge base document block sorting results to determine the target business knowledge base document blocks.

[0138] Here, the preset number of document chunks can be flexibly adjusted according to the business scenario. For example, the preset number of document chunks can be set to 1 to 3. In the business knowledge base document chunk sorting results, the business knowledge base document chunks with the highest preset number of document chunks are extracted as the target business knowledge base document chunks. These document chunks are the ones with the highest relevance to business requirements and can provide core business support for test case generation. The business knowledge base document chunks are used for test case generation.

[0139] S104. Based on the target business knowledge base document segmentation, generate target test cases corresponding to the business requirement information using a preset large language model.

[0140] Here, the large language model is an artificial intelligence model with natural language understanding and generation capabilities. It is used to generate structured test cases that conform to business logic based on the business knowledge and business requirement information corresponding to the document blocks of the target business knowledge base.

[0141] In this embodiment of the application, the target test case is the final generated test case that closely matches the business requirements information, does not contain invalid content, and conforms to the business rules, and can be directly used for software testing.

[0142] In this step, the core business knowledge (including functional points, business descriptions, business rules, etc.) corresponding to the business knowledge base document blocks of the target business knowledge base is extracted. This business knowledge is then concatenated with the original business requirement information input by the user to construct a business-specific prompt. This prompt is then input into a preset large language model, which is constrained to generate test cases only based on the concatenated business knowledge and business requirement information. Finally, structured target test cases that conform to business logic are output.

[0143] Here, relying on the precise business knowledge corresponding to the document blocks of the target business knowledge base, the generation scope of the large language model is constrained, the illusion problem of the large language model is solved, and test cases that are highly relevant to the business and do not contain invalid content are generated.

[0144] In this way, the large language model generates test cases based on accurate business knowledge, significantly reducing invalid and erroneous test cases and greatly improving the fit between test cases and business requirements and rules. At the same time, it eliminates the need for extensive manual verification, greatly reducing labor costs, improving test case generation efficiency, and solving the problem of existing large model-generated test cases being out of touch with business needs.

[0145] Optional, please refer to Figure 2 , Figure 2 This is a second flowchart illustrating a test case generation method based on hybrid retrieval provided in an embodiment of this application. Figure 2 As shown in the embodiment of this application, the test case generation method based on hybrid retrieval, in addition to steps S101 to S104, also includes step S105. Specifically, step S105 is to make the weight allocation of the adaptive fusion neural network model more in line with the actual business scenario and test requirements through a closed-loop iterative optimization process, thereby gradually improving the retrieval accuracy and test case generation quality and achieving continuous optimization of model performance.

[0146] S105. The target test cases and the business knowledge base documents are sent to the outside in blocks, and in response to the received test case feedback results from the outside, the adaptive fusion neural network model is updated and trained based on the test case feedback results to update the weight coefficients.

[0147] In this step, the generated target test cases, along with the determined target business knowledge base document blocks and retrieved document blocks, are sent to external entities (e.g., users and testers). External entities then verify the target test cases based on business requirements and rules, determining whether the test cases meet business needs, whether there are any omissions or errors, and inputting test case feedback results (including whether they are qualified, require modification, and specific modification suggestions, and invalid test case markings).

[0148] Furthermore, after receiving the feedback result of the test case, the feedback result is converted into a model update signal. Combining the sparse features, dense vector features and weight coefficients used in generating the test case, an update training sample for the adaptive fusion neural network model is constructed. The gradient descent method is used to iteratively update and train the adaptive fusion neural network model, adjust the internal parameters of the model, and then update the weight coefficients corresponding to the sparse features and dense vector features.

[0149] For example, suppose the target test case generated based on the target business function module "data acquisition" includes the entry "high-definition reshoot images can be taken with different devices". After verification by the testers, it is found that the business knowledge base clearly stipulates that "high-definition reshoots must be taken with the same device". Therefore, this test case does not comply with the business rules, and the input test case feedback result is "invalid test case, high-definition reshoot images must be taken with the same device, this test case needs to be corrected".

[0150] Furthermore, for example, upon receiving the feedback result, it is determined that the weight allocation of the document block "HD reshoot requires shooting with the same device" during the current retrieval process is unreasonable (possibly due to excessively high sparse weight coefficients and excessively low dense weight coefficients, resulting in insufficient capture of semantic association). Therefore, the feedback result is converted into a negative sample training signal. Combining the sparse features (0.85), dense vector features (0.82), and original weight coefficients (sparse 0.3, dense 0.7) used in this retrieval, updated training samples are constructed. Gradient descent is used to iteratively train the adaptive fusion neural network model, adjusting the linear layer parameters and attention weights within the model. After training, the weight coefficients are updated to sparse 0.2 and dense 0.8, further enhancing the weight of semantic matching features in subsequent retrieval processes. This more accurately captures the semantic association between "HD reshoot" and "shooting with the same device," avoiding the generation of similar invalid test cases and achieving gradual optimization of model performance.

[0151] Thus, the method described in this application has significant advantages over the prior art, primarily in the following four aspects, comprehensively addressing the shortcomings of existing test case generation methods while balancing efficiency, accuracy, and practicality: First, it significantly improves test case generation efficiency by using a logistic regression model to lock in relevant business function modules, avoiding the global retrieval of traditional RAG technology. Combined with parallel processing of keyword retrieval and fine-tuned vector retrieval, it significantly shortens retrieval time. Simultaneously, it relies on large language models to generate test cases in batches, reducing the workload of manual writing and verification, thus solving the pain points of low efficiency in manual design and the need for extensive verification in large model generation. Second, it significantly improves the accuracy and business relevance of test cases by using a fine-tuned vector model to capture semantic relationships in text and combining an adaptive fusion neural network model to dynamically allocate weights, solving the problems of traditional retrieval... The system effectively addresses semantic matching bias and modal crushing issues, suppressing the "illusion" of large models, reducing invalid and erroneous test cases, and ensuring that generated test cases strictly adhere to business rules and requirements. Thirdly, it possesses strong adaptability and scalability. The adaptive fusion neural network model can iteratively update through external feedback results, dynamically optimizing weight coefficients to adapt to different business scenarios and user input specifications (colloquial or technical terminology input), eliminating the need for manual adjustments to retrieval strategies. Fourthly, it lowers the technical threshold and usage costs. The entire process is highly automated, requiring testers to possess deep AI or retrieval skills to quickly generate high-quality test cases. Simultaneously, the closed-loop iterative optimization mechanism continuously improves model performance, reducing testing costs in the long term, making it suitable for test case generation scenarios in various large-scale and complex software systems.

[0152] The test case generation method based on hybrid retrieval provided in this application extracts keyword information from business requirement information, uses a logistic regression model to locate business function modules, combines keyword retrieval and fine-tuned vector retrieval, and dynamically optimizes the weight coefficients of the two retrieval features using an adaptive fusion neural network model. This allows for the selection of target business knowledge base document blocks, and the generation of test cases using a large language model. This method solves the problems of low efficiency in manually designing test cases, the potential for illusions in large model-generated test cases, and the insufficient retrieval accuracy, low efficiency, and rigid retrieval strategies of traditional retrieval enhancement generation techniques. It improves the accuracy and efficiency of generated test cases, enhances the fit between test cases and business requirements and rules, and effectively reduces invalid or erroneous test cases to adapt to different business scenarios and user input specifications.

[0153] Please see Figure 3 , Figure 4 , Figure 3 This is one of the structural schematic diagrams of a test case generation device based on hybrid retrieval provided in an embodiment of this application. Figure 4 This is a second schematic diagram of a test case generation device based on hybrid retrieval provided in an embodiment of this application. Figure 3 As shown, the test case generation device 300 includes: The keyword matching unit 310 is used to extract keyword information from the business requirement information in response to the acquisition of input business requirement information, and to determine at least one business function module corresponding to the keyword information using a preset logistic regression model. The hybrid retrieval unit 320 is used to perform retrieval in the pre-blocked business knowledge base based on the business function module, using a preset keyword retrieval method and a preset fine-tuning vector model respectively, to obtain the sparse features and dense vector features corresponding to the document blocks of the business knowledge base in each business function module, and to determine the weight coefficients corresponding to the sparse features and the dense vector features respectively using a preset adaptive fusion neural network model. The module determining unit 330 is used to determine the fusion score value corresponding to each business knowledge base document block based on the weight coefficient and the sparse features and dense vector features corresponding to each business knowledge base document block, and to determine the target business knowledge base document block in the business knowledge base document block based on the fusion score value. The test case generation unit 340 is used to generate target test cases corresponding to the business requirement information based on the target business knowledge base document blocks and using a preset large language model.

[0154] Furthermore, when the keyword matching unit 310 extracts keyword information from the input business requirement information in response to obtaining the input business requirement information, the keyword matching unit 310 is used to: In response to the input business requirement information, the text corresponding to the business requirement information is split into multiple candidate words using a preset word segmentation tool, and stop words in the text corresponding to the business requirement information are filtered out. The importance score corresponding to each candidate word is determined by using a preset text feature weight calculation method, and the candidate words are sorted in descending order according to the importance score to obtain the keyword ranking result; Extract the candidate words corresponding to a preset number of keywords from the keyword ranking results to extract keyword information.

[0155] Furthermore, when the keyword matching unit 310 is used to determine at least one business function module corresponding to the keyword information using a preset logistic regression model, the keyword matching unit 310 is used to: The keyword information is input into a preset logistic regression model to obtain at least one candidate functional module corresponding to the keyword information output by the logistic regression model and the credibility result corresponding to each candidate functional module. The credibility result is normalized to obtain a normalized score for each candidate functional module, and the candidate functional modules are sorted in descending order according to the normalized score to obtain the functional module sorting result. Extract the candidate functional modules corresponding to a preset number of modules from the functional module sorting results to determine at least one business functional module corresponding to the keyword information.

[0156] Furthermore, when the hybrid retrieval unit 320 is used to perform retrieval in the pre-segmented business knowledge base based on the business function module, using a preset keyword retrieval method and a preset fine-tuning vector model respectively, and to obtain the sparse features and dense vector features corresponding to each document segment of the business knowledge base, the hybrid retrieval unit 320 is used to: The keyword matching degree between each user's query business requirement and the document blocks in the pre-defined business knowledge base is calculated using a preset keyword retrieval method. The keyword matching degree is normalized to determine the sparse features corresponding to the business knowledge base document blocks in each of the business function modules; The user query business requirements and the business knowledge base are input into a preset fine-tuning vector model to obtain dense vector features output by the fine-tuning vector model that represent the semantic relevance between each user query business requirement and the document block; wherein, the fine-tuning vector model is obtained by fine-tuning a preset sentence embedding generation model based on preset triplet labeled data and using a preset triplet loss function.

[0157] Furthermore, the adaptive fusion neural network model includes a feature projection layer, a modality equalization normalization layer, a multi-head attention layer, a cross-modal gating layer, a residual enhancement layer, and a fully connected output layer; when the hybrid retrieval unit 320 is used to determine the weight coefficients corresponding to the sparse features and the dense vector features using the preset adaptive fusion neural network model, the hybrid retrieval unit 320 is used to: The feature projection layer maps the sparse features and the dense vector features to a preset dimension, respectively, to obtain sparse features and dense vector features of the same dimension. The modal equalization normalization layer normalizes the same-dimensional sparse features and the same-dimensional dense vector features respectively, thereby obtaining the calibrated sparse features and calibrated dense vector features. The multi-head attention layer captures the semantic relationships between the business requirement information, the keyword information, and the document blocks in the business knowledge base based on the calibrated sparse features and the calibrated dense vector features, and obtains attention features. The gating coefficients generated by the cross-modal gating layer are multiplied element-wise with the attention features to obtain the gating features; The residual enhancement layer concatenates the same-dimensional sparse features and the same-dimensional dense vector features to obtain concatenated projection features, and adds the concatenated projection features to the gated features to obtain residual enhancement features; The fully connected output layer sequentially performs feature compression and normalization on the residual enhancement features to obtain the weight coefficients corresponding to the sparse features and dense vector features output by the fully connected output layer.

[0158] Furthermore, the weighting coefficients include sparse weighting coefficients and dense weighting coefficients; when the module determining unit 330 determines the fusion score value corresponding to each business knowledge base document block based on the weighting coefficients and the sparse features and dense vector features corresponding to each business knowledge base document block, and determines the target business knowledge base document block in the business knowledge base document block based on the fusion score value, the module determining unit 330 is used to: Multiply the sparse weight coefficient corresponding to each sparse feature with the sparse feature to obtain a first product result, and multiply the dense weight coefficient corresponding to each dense vector feature with the dense vector feature to obtain a second product result; The sum of the first product result and the second product result is determined as the fusion score value corresponding to each of the business knowledge base document blocks; The business knowledge base document blocks are sorted in descending order according to the fusion score value to obtain the business knowledge base document block sorting result. Extract the business knowledge base document blocks corresponding to the preset number of document blocks from the sorting results of the business knowledge base document blocks to determine the target business knowledge base document blocks.

[0159] Furthermore, such as Figure 4 As shown, the test case generation device 300 further includes a model update unit 350, which is used for: The target test cases and the business knowledge base documents are sent to an external system in blocks. In response to the received test case feedback results from the external system, the adaptive fusion neural network model is updated and trained based on the test case feedback results to update the weight coefficients.

[0160] The test case generation device based on hybrid retrieval provided in this application extracts keyword information from business requirement information, uses a logistic regression model to lock in business function modules, combines keyword retrieval and fine-tuned vector retrieval, and dynamically optimizes the weight coefficients of the two retrieval features based on an adaptive fusion neural network model. This allows for the selection of target business knowledge base document blocks, and the generation of test cases using a large language model. This solves the problems of low efficiency in manually designing test cases, the tendency for large model-generated test cases to produce illusions, and the insufficient retrieval accuracy, low efficiency, and rigid retrieval strategies of traditional retrieval enhancement generation techniques. It improves the accuracy and efficiency of generated test cases, enhances the fit between test cases and business requirements and rules, and effectively reduces invalid or erroneous test cases to adapt to different business scenarios and user input specifications.

[0161] Please see Figure 5 , Figure 5 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Figure 5 As shown, the electronic device 500 includes a processor 510, a memory 520, and a bus 530.

[0162] The memory 520 stores machine-readable instructions executable by the processor 510. When the electronic device 500 is running, the processor 510 and the memory 520 communicate via the bus 530. When the machine-readable instructions are executed by the processor 510, they can perform the operations described above. Figure 1 as well as Figure 2 The steps of the test case generation method based on hybrid retrieval in the method embodiment shown are explained in detail in the method embodiment, and will not be repeated here.

[0163] This application also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, can perform the above-described actions. Figure 1 as well as Figure 2 The steps of the test case generation method based on hybrid retrieval in the method embodiment shown are explained in detail in the method embodiment, and will not be repeated here.

[0164] Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

[0165] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. The apparatus embodiments described above are merely illustrative. For example, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. Furthermore, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Additionally, the shown or discussed mutual couplings, direct couplings, or communication connections may be through some communication interfaces; indirect couplings or communication connections between devices or units may be electrical, mechanical, or other forms.

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

[0167] In addition, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.

[0168] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a processor-executable, non-volatile, computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0169] Finally, it should be noted that the above-described embodiments are merely specific implementations of this application, used to illustrate the technical solutions of this application, and not to limit them. The scope of protection of this application is not limited thereto. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that any person skilled in the art can still modify or easily conceive of changes to the technical solutions described in the foregoing embodiments, or make equivalent substitutions for some of the technical features, within the scope of the technology disclosed in this application. Such modifications, changes, or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application, and should all be covered within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

Claims

1. A test case generation method based on hybrid retrieval, characterized in that, The method includes: In response to receiving input business requirement information, keyword information is extracted from the business requirement information, and at least one business function module corresponding to the keyword information is determined using a preset logistic regression model. Based on the business function modules, a search is performed in the pre-defined business knowledge base using a preset keyword retrieval method and a preset fine-tuning vector model. The sparse features and dense vector features corresponding to the document blocks in the business knowledge base of each business function module are obtained. The weight coefficients corresponding to the sparse features and the dense vector features are determined by a preset adaptive fusion neural network model. Based on the weight coefficients and the sparse features and dense vector features corresponding to each business knowledge base document block, a fusion score value corresponding to each business knowledge base document block is determined, and based on the fusion score value, a target business knowledge base document block is determined in the business knowledge base document block. Based on the document segmentation of the target business knowledge base, target test cases corresponding to the business requirement information are generated using a preset large language model.

2. The method according to claim 1, characterized in that, The step of extracting keyword information from the input business requirement information in response to receiving the input business requirement information includes: In response to the input business requirement information, the text corresponding to the business requirement information is split into multiple candidate words using a preset word segmentation tool, and stop words in the text corresponding to the business requirement information are filtered out. The importance score corresponding to each candidate word is determined by using a preset text feature weight calculation method, and the candidate words are sorted in descending order according to the importance score to obtain the keyword ranking result; Extract the candidate words corresponding to a preset number of keywords from the keyword ranking results to extract keyword information.

3. The method according to claim 1, characterized in that, The step of determining at least one business function module corresponding to the keyword information using a preset logistic regression model includes: The keyword information is input into a preset logistic regression model to obtain at least one candidate functional module corresponding to the keyword information output by the logistic regression model and the credibility result corresponding to each candidate functional module. The credibility result is normalized to obtain a normalized score for each candidate functional module, and the candidate functional modules are sorted in descending order according to the normalized score to obtain the functional module sorting result. Extract the candidate functional modules corresponding to a preset number of modules from the functional module sorting results to determine at least one business functional module corresponding to the keyword information.

4. The method according to claim 1, characterized in that, Based on the aforementioned business function modules, a search is performed in a pre-defined business knowledge base using a preset keyword retrieval method and a preset fine-tuning vector model. This yields the sparse and dense vector features corresponding to the document blocks in the business knowledge base for each business function module, including: The keyword matching degree between each user's query business needs and the document blocks in the pre-defined business knowledge base is calculated using a preset keyword retrieval method. The keyword matching degree is normalized to determine the sparse features corresponding to the business knowledge base document blocks in each of the business function modules; The user query business requirements and the business knowledge base are input into a preset fine-tuning vector model to obtain dense vector features output by the fine-tuning vector model that represent the semantic relevance between each user query business requirement and the document block; wherein, the fine-tuning vector model is obtained by fine-tuning a preset sentence embedding generation model based on preset triplet labeled data and using a preset triplet loss function.

5. The method according to claim 1, characterized in that, The adaptive fusion neural network model includes a feature projection layer, a modality equalization and normalization layer, a multi-head attention layer, a cross-modal gating layer, a residual enhancement layer, and a fully connected output layer; the step of determining the weight coefficients corresponding to the sparse features and the dense vector features using the preset adaptive fusion neural network model includes: The feature projection layer maps the sparse features and the dense vector features to a preset dimension, respectively, to obtain sparse features and dense vector features of the same dimension. The modal equalization normalization layer normalizes the same-dimensional sparse features and the same-dimensional dense vector features respectively, thereby obtaining the calibrated sparse features and calibrated dense vector features. The multi-head attention layer captures the semantic relationships between the business requirement information, the keyword information, and the document blocks in the business knowledge base based on the calibrated sparse features and the calibrated dense vector features, and obtains attention features. The gating coefficients generated by the cross-modal gating layer are multiplied element-wise with the attention features to obtain the gating features; The residual enhancement layer concatenates the same-dimensional sparse features and the same-dimensional dense vector features to obtain concatenated projection features, and then adds the concatenated projection features to the gated features to obtain residual enhancement features; The fully connected output layer sequentially performs feature compression and normalization on the residual enhancement features to obtain the weight coefficients corresponding to the sparse features and dense vector features output by the fully connected output layer.

6. The method according to claim 1, characterized in that, The weighting coefficients include sparse weighting coefficients and dense weighting coefficients; the step of determining a fusion score value corresponding to each business knowledge base document block based on the weighting coefficients and the sparse and dense vector features corresponding to each business knowledge base document block, and determining a target business knowledge base document block in the business knowledge base document blocks based on the fusion score value, includes: Multiply the sparse weight coefficient corresponding to each sparse feature with the sparse feature to obtain a first product result, and multiply the dense weight coefficient corresponding to each dense vector feature with the dense vector feature to obtain a second product result; The sum of the first product result and the second product result is determined as the fusion score value corresponding to each of the business knowledge base document blocks; The business knowledge base document blocks are sorted in descending order according to the fusion score value to obtain the business knowledge base document block sorting result. Extract the business knowledge base document blocks corresponding to the preset number of document blocks from the sorting results of the business knowledge base document blocks to determine the target business knowledge base document blocks.

7. The method according to claim 1, characterized in that, The method further includes: The target test cases and the business knowledge base documents are sent to an external system in blocks. In response to the received test case feedback results from the external system, the adaptive fusion neural network model is updated and trained based on the test case feedback results to update the weight coefficients.

8. A test case generation device based on hybrid retrieval, characterized in that, The test case generation device includes: The keyword matching unit is used to extract keyword information from the input business requirement information in response to the acquisition of the input business requirement information, and to determine at least one business function module corresponding to the keyword information using a preset logistic regression model. The hybrid retrieval unit is used to perform retrieval in the pre-segmented business knowledge base based on the business function module, using a preset keyword retrieval method and a preset fine-tuning vector model respectively, to obtain the sparse features and dense vector features corresponding to the document blocks of the business knowledge base in each business function module, and to determine the weight coefficients corresponding to the sparse features and the dense vector features respectively using a preset adaptive fusion neural network model. The module determination unit is used to determine the fusion score value corresponding to each business knowledge base document block based on the weight coefficients and the sparse features and dense vector features corresponding to each business knowledge base document block, and to determine the target business knowledge base document block in the business knowledge base document block based on the fusion score value. The test case generation unit is used to generate target test cases corresponding to the business requirement information based on the target business knowledge base document blocks and using a preset large language model.

9. An electronic device, characterized in that, include: The device includes a processor, a memory, and a bus. The memory stores machine-readable instructions executable by the processor. When the electronic device is running, the processor communicates with the memory via the bus. The machine-readable instructions are executed by the processor to perform the steps of the hybrid retrieval-based test case generation method as described in any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, performs the steps of the test case generation method based on hybrid retrieval as described in any one of claims 1 to 7.