Test case generation method, electronic equipment and storage medium

Test cases are generated through semantic recursive slices and large language model sharding sliding window processing, which solves the problem of difficult to maintain semantic integrity and context coherence in long-term documents, and achieves high-quality test cases generation.

CN119782173APending Publication Date: 2025-04-08ZHONGKE YUNGU TECH
View PDF 0 Cites 4 Cited by

Patent Information

Application Number
CN202411917970.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-24
Publication Date
2025-04-08

AI Technical Summary

Technical Problem

In the prior art, when generating test cases, long-length demand documents are difficult to maintain the semantic integrity of segmented text and the coherence of context information, resulting in unstable quality of generated test cases.

Method used

The target document is divided into semantic coherent slices through semantic recursive slices, and the slices are sliced ​​and sliding windowed using the preset large language model to generate test cases. Then, the test case set is merged according to the functional dependencies contained in the test case to form.

Benefits of technology

It realizes efficiently generating detailed and accurate test cases while maintaining semantic integrity of segmented text and coherence of context information, solving the problem of quality instability when long-term requirements document generation test cases.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119782173A_ABST
    Figure CN119782173A_ABST
Patent Text Reader

Abstract

The invention discloses a test case generation method, electronic equipment and a storage medium, and the method comprises the steps: carrying out semantic recursion slicing on a target document, and obtaining semantic coherent demand document slices; performing fragment sliding window processing on the document slices through a preset large language model to obtain a plurality of test cases; and according to the correlation of the functions contained in the plurality of test cases, merging the plurality of test cases to obtain a test case set. The invention discloses a test case generation method, electronic equipment and a storage medium, which can keep semantic integrity of a segmented text and correspond to context information, and realize that a demand document outputs a test case in an end-to-end manner.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of artificial intelligence technology, and in particular to a test case generation method, electronic device and storage medium. Background Art

[0002] The rapid development of large language model-related technologies has great potential and advantages in text generation tasks, providing a foundation for different business scenarios. A test case is a set of combinations with specific formats, conditions and expected results, which are used to verify the functions or characteristics of a system. The design process of test cases needs to rely on requirements-related documents, and is designed and written by testers through scientific methods to form test cases. However, the process of manually writing test cases is a tedious and time-consuming process; at the same time, manual writing of test cases is centered on test engineers, and the quality of the output test cases is unstable and varies from person to person. Although the use of large language models to generate test cases can make up for some of the shortcomings of manually written test cases, the generated test cases still have some shortcomings. First of all, if a long requirement document is directly segmented and the test cases are obtained through multiple generation methods, it is difficult to ensure the semantic integrity of the segmented text, and contextual information will be missing. Therefore, for long requirement documents, how to maintain the semantic integrity of the segmented text and the coherence of the contextual information, and effectively generate detailed and accurate test cases based on the requirement documents, is an urgent problem to be solved. Summary of the invention The purpose of the embodiments of the present application is to provide a test case generation method, an electronic device and a storage medium, which can maintain the semantic integrity of the segmented text and correspond to the context information, and realize the output of test cases in an "end-to-end" manner for long requirement documents.

[0003] In order to achieve the above objectives, the present application embodiment adopts the following technical solutions: In a first aspect, an embodiment of the present application provides a test case generation method, comprising: Slice the target document recursively and semantically to obtain semantically coherent requirement document slices; By presetting a large language model, the document slices are processed by slicing and sliding windows to obtain multiple test cases. According to the relevance of the functions included in the multiple test cases, the multiple test cases are merged to obtain a test case set.

[0004] In one embodiment, semantically recursively slicing a target document to obtain semantically coherent target document slices includes: Segment the sentences in the target document according to the preset punctuation marks in the target document to obtain a sentence list of the target document; Input the sentences in the sentence list into the preset embedding model for quantization processing, and obtain the embedding vector corresponding to each sentence; Calculate the similarity between adjacent sentences based on the embedding vectors and obtain a similarity list; The target document is sliced ​​according to the similarity list to obtain semantically coherent target document slices.

[0005] In one embodiment, calculating the similarity between adjacent sentences based on the embedding vectors includes: The similarity between adjacent sentences is calculated according to the following formula: ; in, D i Indicates i Sentences and i+1 The similarity between sentences, X i Indicates i The embedding vector of the sentence, X i+1 Indicates i+1 The embedding vector of each sentence.

[0006] In one implementation, similarities between adjacent sentences are calculated based on the embedding vectors to obtain a similarity list, including: Arrange the similarities in ascending order to obtain a similarity list.

[0007] In one embodiment, slicing the target document according to the similarity list to obtain semantically coherent target document slices includes: Calculate the position index corresponding to the p quantile according to the similarity list; Determine a segmentation threshold for slicing the target document according to the position index; The target document is segmented based on the segmentation threshold to obtain semantically coherent target document slices.

[0008] In one embodiment, determining a segmentation threshold for performing segmentation processing on a target document according to a position index includes: When the position index is an integer, the segmentation threshold for slicing processing is the position index value; When the position index is a decimal, the segmentation threshold for slicing processing is the average value of the values ​​on both sides of the position index.

[0009] In one embodiment, segmenting the target document based on the segmentation threshold to obtain semantically coherent target document slices includes: The segmentation threshold is used as a segmentation point to segment sentences whose length is greater than or equal to the segmentation threshold; after merging sentences whose length is less than the segmentation threshold, the merged sentences are segmented using the segmentation threshold as a segmentation point; Recursively slice the segmentation results and terminate the recursion when the length of all sentences is less than the preset slice length.

[0010] In one implementation, a large language model is preset to perform slice sliding window processing on document slices to obtain multiple test cases, including: Determine the prompt words for generating test cases for the large language model; The large language model is controlled to slide from the first slice with a window of a preset size, so that the large language model uses the current slice as a generation fragment and generates test cases based on the prompt words.

[0011] In a second aspect, the present application provides an electronic device comprising: a processor; a memory for storing processor executable instructions; wherein the processor is configured to execute instructions to implement the steps of the test case generation method as described in any one of the first aspects.

[0012] In a third aspect, the present application provides a computer-readable storage medium. When the instructions in the computer-readable storage medium are executed by a processor, the steps of the test case generation method as described in any one of the first aspects are implemented.

[0013] The test case generation method, electronic device and storage medium provided by the present application include: semantically recursively slicing the target document to obtain semantically coherent requirement document slices; performing slice sliding window processing on the document slices by presetting a large language model to obtain multiple test cases; merging multiple test cases according to the relevance of the functions contained in the multiple test cases to obtain a test case set. Therefore, the test case generation method, electronic device and storage medium provided by the present application obtain more semantically coherent slices by semantically recursively slicing the requirement document; and then using the large language model slice sliding window to generate test cases. It is possible to keep the semantic integrity of the segmented text and correspond to the context information, and realize the output of test cases in an "end-to-end" manner of the requirement document. BRIEF DESCRIPTION OF THE DRAWINGS

[0014] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings: Figure 1 A flowchart of a test case generation method provided for one embodiment of the present application; Figure 2 A schematic diagram of the process of semantic recursive slicing of a target document in this application; Figure 3 A flowchart of the test case generation process provided for this application; Figure 4 A schematic diagram of the structure of an electronic device provided for one embodiment of the present application. DETAILED DESCRIPTION

[0015] In order to make the purpose, technical solution and advantages of the present application clearer, the technical solution of the present application will be clearly and completely described below in combination with the specific embodiments of the present application and the corresponding drawings. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present application.

[0016] The terms "first", "second", etc. in this specification and claims are used to distinguish similar objects, and are not used to describe a particular order or precedence. It should be understood that the terms used in this way can be interchanged where appropriate so that the embodiments of the present application are implemented in a sequence other than those illustrated or described herein. In addition, "and / or" in this specification and claims means at least one of the connected objects, and the character " / " generally means that the objects associated with each other are in an "or" relationship.

[0017] See also Figure 1 , which is a flow chart of a test case generation method provided in an embodiment of the present application. The test case generation method can be executed by an electronic device provided in an embodiment of the present application. The electronic device can be implemented in software and / or hardware, such as a server or a computer.

[0018] It should be noted that the test case generation method provided in this application is suitable for long text files, which have the characteristics of containing a large amount of information and having more pages or characters than conventional documents. It can be defined according to character length, number of words, number of pages, number of paragraphs, complexity of the subject or content, etc., and is not specifically limited here.

[0019] In this embodiment, the test case generation method is performed by a computer processor as an example. The test case generation method provided by this embodiment includes: Step S1, semantically recursively slice the target document to obtain semantically coherent requirement document slices.

[0020] In this embodiment, an initial slice length L (i.e., a preset slice length) may be set first, and then the document may be segmented into initial slices according to the slice length L. After the segmentation is completed, a semantic analysis is then performed on each slice, and natural language processing technology may be used to identify the topics and semantic boundaries in the segmented sentences. Then, the semantic coherence of each slice is checked, and if the slice is found to be semantically incoherent (for example, a slice contains discussions on two different topics, then further slicing is performed) a slice contains discussions on two different topics), then further slicing is performed. Based on the results of the semantic analysis, the boundaries of the slices are adjusted to ensure that each slice is semantically consistent. In this way, the requirement document can be effectively decomposed into semantically reasonable and coherent parts, thereby generating high-quality test cases based on these document slices.

[0021] In one embodiment, a target document is semantically recursively sliced ​​to obtain semantically coherent target document slices, including: slicing sentences in the target document according to preset punctuation marks in the target document to obtain a sentence list of the target document; inputting the sentences in the sentence list into a preset embedding model for quantization processing to obtain an embedding vector corresponding to each sentence; calculating the similarity between adjacent sentences based on the embedding vector to obtain a similarity list; slicing the target document according to the similarity list to obtain semantically coherent target document slices.

[0022] In this embodiment, the demand document is first segmented according to symbols to obtain a list of sentences in the demand document. The segmentation symbols include various punctuation marks such as "," "." "!" "?" ";". After the segmentation is completed, each segmented sentence is input into the embedding model for vectorization to obtain the embedding vector X of each sentence. i (i represents the index of the sentence, n is the total number of sentences, i=0,1,2,3…n); then the similarity between adjacent sentences is calculated based on the embedding vector and a similarity list is obtained.

[0023] Understandably, embedding models are an important part of natural language processing (NLP) and machine learning, and are mainly used to convert unstructured text data into structured numerical representations. Simply put, embedding models can map text to a point in a high-dimensional space, namely, an embedding vector. The embedding vector can capture the semantic and grammatical information of the original text, so that the text data can be better understood by the computer. It should be noted that in the embedding space, semantically similar or related text elements are usually closer in the vector space, that is, the similarity is higher.

[0024] The embedding model in this application can specifically be Word2Vec, GloVe, BERT (BidirectionalEncoder Representations from Transformers), etc.

[0025] In one embodiment, calculating the similarity between sentences based on the embedding vectors includes: calculating the similarity between adjacent sentences according to the following formula: ; in, D i Indicates i Sentences and i+1 The similarity between sentences, X i Indicates i The embedding vector of the sentence, X i+1 Indicates i+1 The embedding vector of each sentence.

[0026] In this embodiment, the similarity between adjacent sentences is constructed based on the cosine similarity between their corresponding embedding vectors. The cosine similarity distance between adjacent sentences can be used to measure the semantic continuity of sentences in the text, thereby understanding the structure and content flow of the text.

[0027] It can be understood that the greater the similarity distance between adjacent sentences, the lower the similarity, and the smaller the similarity distance, the higher the similarity.

[0028] Further, similarities between adjacent sentences are calculated based on the embedding vectors to obtain a similarity list, including: arranging the similarities in ascending order to obtain a similarity list.

[0029] Understandably, arranging the similarities between adjacent sentences calculated based on the embedding vector in ascending order to obtain a similarity list can help identify structural features in the text, such as chapter transitions, changes in themes, etc. Low similarity values ​​may indicate large content or topic jumps. Sentence pairs with low similarity may represent abnormal points or turning points in the text. The arranged list makes these points easy to identify, allowing for further analysis or processing. In addition, by arranging the similarity values ​​in ascending order, the continuity and smoothness between sentences can be intuitively analyzed. Points with lower similarity in the list may indicate sudden changes in the topic or faults in the text.

[0030] In one embodiment, a target document is sliced ​​according to a similarity list to obtain semantically coherent target document slices, including: calculating a position index corresponding to a p quantile according to the similarity list; determining a slicing threshold for slicing the target document according to the position index; and slicing the target document based on the slicing threshold to obtain semantically coherent target document slices.

[0031] Understandably, the p-quantile is a statistical concept that represents the position of a value that is less than or equal to p% of the data values ​​in a sorted data set. The p-quantile can help determine the location of a certain percentage of data in the sorted data set. In the scenario of semantic segmentation, this can be used to determine the location of the split point in the requirements document. When semantically segmenting the requirements document, calculating the position index corresponding to the p-quantile can determine the best point in the document to cut according to the semantic content, thereby obtaining semantically coherent document slices of equal length.

[0032] In one embodiment, a slicing threshold for slicing a target document is determined based on a position index, including: when the position index is an integer, the slicing threshold for slicing is the position index value; when the position index is a decimal, the slicing threshold for slicing is the average of the values ​​on both sides of the position index.

[0033] In one embodiment, a target document is segmented based on a segmentation threshold to obtain semantically coherent target document slices, including: using the segmentation threshold as a segmentation point to segment sentences whose length is greater than or equal to the segmentation threshold; merging sentences whose length is less than the segmentation threshold, and then segmenting the merged sentences using the segmentation threshold as a segmentation point; recursively slicing the segmentation results, and terminating the recursion when the length of all sentences is less than a preset slice length.

[0034] Specifically, the position index Q corresponding to the p quantile of the distance list is calculated based on the distance list between the sorted sentences. The calculation method of the position index Q corresponding to the p quantile number is as follows. The distance value corresponding to the quantile is the quantile: Q = (n-1) × (p / 100), where n-1 is the length of the distance list; when Q is an integer, the segmentation threshold is the distance of the position index Q corresponding to the distance list; when Q is a decimal, the segmentation threshold is the average of the values ​​on both sides of Q. Secondly, according to the position segmentation threshold of the quantile, the requirement document is initially segmented. The segmentation rule is: the distance point of the p quantile of the sentence greater than or equal to the distance threshold is used as the text segmentation point, and the p quantile sentences with a distance less than the distance threshold are merged.

[0035] Specifically, the process of performing semantic recursive slicing on the target document in this embodiment can be referred to in Figure 2 .

[0036] like Figure 2 As shown, the segmentation threshold is calculated according to the p quantile, and the long document is preliminarily segmented according to the segmentation threshold to obtain a preliminary segmentation result; the preliminary segmentation result is segmented again according to the segmentation threshold, and the segmentation is continuously performed in a recursive manner until the segment length is less than the preset slice length L, and the segmentation is terminated.

[0037] exist Figure 2 In the segmentation process shown, the length of segment 1 is obviously greater than the preset length L, so the segmentation is continued to obtain segments 1-1 and 1-2. The lengths of segments 2 and 3 are equal to the preset length L, and segments 2 and 3 are no longer segmented in the subsequent segmentation process. Similarly, the length of segment 4 is greater than the preset length L, and segment 4 is continued to be segmented during the second segmentation to obtain segments 4-1 and 4-2.

[0038] Step S2: Performing slice and slide window processing on document slices by using a preset large language model to obtain multiple test cases.

[0039] Understandably, through sliding window processing, it can be ensured that each slice contains sufficient contextual information, which is of great significance for understanding the semantic relationship between sentences or paragraphs. In addition, sliding window processing can generate multiple overlapping test cases, which increases the test coverage and helps to discover potential boundary case errors.

[0040] In one embodiment, a large language model is preset to perform slice sliding window processing on document slices to obtain multiple test cases, including: determining prompt words for the large language model to generate test cases; controlling the large language model to slide from the first slice with a window of a preset size, so that the large language model uses the current slice as a generated segment and generates test cases based on the prompt words.

[0041] Specifically, the steps of obtaining test cases based on prompt words of the large language model may include: The first step is to set the prompt words for the large language model to generate test cases, including the test case rules and test case formats; for example, the prompt words for outputting Json format test cases: ## OutputFormat: {"{{system}}Test design":{"{{story_name}}":{"module name":[ { "Test Case Title" : "Test Case Title", "Step" : "1. Step 1; 2. Step 2; 3. Step 3; 4. Step 4", "Expected results" : "Expected results" }]}}} In the second step, the large language model slides with a window of size s. Starting from the first slice, the s slices of the sliding window are simultaneously input into the large language model. The current slice focused in the window is used as the generated fragment of the large language model to generate the content of the test case. The remaining slice contents of the sliding window are used as the "memory" of the large language model to supplement the context information; in addition, the initial sliding window has no context information.

[0042] Step S3, merging the multiple test cases according to the relevance of the functions contained in the multiple test cases to obtain a test case set.

[0043] In this embodiment, since the test cases in Json format can be output in the second step, the test cases can be merged according to the dimension of the test case functions to obtain a test case set. The test case set is connected to the test management tool. Since most of the current test processes are completed through the test management tool, the test case set in Json format can be quickly connected to the test management tool and associate the test cases with the requirements.

[0044] The method for generating test cases for documents provided in this application recursively slices the requirement document according to semantics to obtain more semantically coherent slices; and then uses a large language model to generate test cases using a slice sliding window. The following technical effects can be achieved: 1. The requirement document is segmented recursively according to semantics, which takes into account the semantic information of the text while keeping the text at an appropriate length; at the same time, it can better support the generation of long documents for test cases.

[0045] 2. Large language model slice sliding window generation can provide contextual information for slices when generating test cases, which can be used to generate more accurate test case results.

[0046] 3. In the implementation process, semantic recursive slicing and sliding window generation are combined to generate more detailed test cases for long requirement documents without being limited by the output of the large language model and causing content interruption.

[0047] 4. In an end-to-end manner, test cases can be directly output from the requirement document to the test management tool, which is more in line with the actual testing process.

[0048] Based on the same inventive concept as the above embodiments, the overall process of generating a test case in the present invention is described below by using a specific example. Figure 3 .

[0049] First, input the requirement document. Then, perform recursive semantic segmentation on the requirement document to obtain requirement document segment 1, requirement document segment 2, requirement document segment 3, ..., requirement document segment n (the document segment here is the document slice mentioned in the previous text). Then, according to the prompt words generated by the pre-prepared test case, the test case is generated according to the large language model segmentation sliding window, or multiple test case results are obtained, including test case result 1, trial case result 2, trial case result 3, ..., trial case result n. Then, merge, convert the format and save the above multiple test case results. In this example, taking the test case format as Json format as an example, after merging and converting the above multiple test case results, a test case set in Json format is obtained, and the test case set is saved in the form of Xmind, csv, excel, etc., or the test case in Json format is directly connected to the test management tool, and the test process is carried out.

[0050] The above is a description of a specific embodiment of the specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0051] Figure 4 This is a schematic diagram of the structure of an electronic device according to an embodiment of the present application. Figure 4 At the hardware level, the electronic device includes a processor, and optionally also includes an internal bus, a network interface, and a memory. The memory may include a memory, such as a high-speed random access memory (RAM), and may also include a non-volatile memory (non-volatile memory), such as at least one disk storage. Of course, the electronic device may also include hardware required for other services.

[0052] The processor, network interface and memory can be interconnected through an internal bus, which can be an ISA (Industry Standard Architecture) bus, a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 4Only one bidirectional arrow is used in the diagram, but this does not mean that there is only one bus or only one type of bus.

[0053] The memory is used to store the program. Specifically, the program may include a program code, and the program code includes a computer operation instruction. The memory may include a memory and a non-volatile memory, and provides instructions and data to the processor.

[0054] The processor reads the corresponding computer program from the non-volatile memory into the memory and then runs it, forming a data processing device at the logical level. The processor executes the program stored in the memory and is specifically used to execute the long test case generation method provided in this embodiment.

[0055] Of course, in addition to software implementation methods, the electronic device of the present application does not exclude other implementation methods, such as logic devices or a combination of software and hardware, etc. That is to say, the execution subject of the following processing flow is not limited to each logic unit, but can also be hardware or logic devices.

[0056] An embodiment of the present application also proposes a computer-readable storage medium, which stores one or more programs, and the one or more programs include instructions, which, when executed by a portable electronic device including multiple applications, can enable the portable electronic device to execute the test case generation method provided by the present application.

[0057] In short, the above description is only a preferred embodiment of the present application and is not intended to limit the protection scope of the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.

[0058] The systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer. Specifically, the computer may be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.

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

[0060] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.

[0061] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

Claims

1. A test case generation method, characterized in that: include: Slice the target document recursively and semantically to obtain semantically coherent requirement document slices; Performing slice and slide window processing on the document slices by using a preset large language model to obtain multiple test cases; The multiple test cases are merged according to the functional relevance contained in the multiple test cases to obtain a test case set.

2. The method according to claim 1, characterized in that: The step of recursively slicing the target document to obtain semantically coherent target document slices includes: Segmenting sentences in the target document according to preset punctuation marks in the target document to obtain a sentence list of the target document; Input the sentences in the sentence list into a preset embedding model for quantization processing, and obtain an embedding vector corresponding to each sentence; Calculate the similarity between adjacent sentences based on the embedding vectors to obtain a similarity list; The target document is sliced ​​according to the similarity list to obtain semantically coherent target document slices.

3. The method according to claim 2, characterized in that The calculating the similarity between adjacent sentences based on the embedding vectors includes: The similarity between adjacent sentences is calculated according to the following formula: ; in, D i Indicates i Sentences and i+1 The similarity between sentences, X i Indicates i The embedding vector of the sentence, X i+1 Indicates i+1 The embedding vector of each sentence.

4. The method according to claim 3, characterized in that: The calculating the similarity between adjacent sentences based on the embedding vector to obtain a similarity list includes: The similarities are arranged in ascending order to obtain a similarity list.

5. The method according to claim 3, characterized in that: The slicing of the target document according to the similarity list to obtain semantically coherent target document slices includes: Calculate the position index corresponding to the p quantile according to the similarity list; Determine a segmentation threshold for performing segmentation processing on the target document according to the position index; The target document is segmented based on the segmentation threshold to obtain semantically coherent target document slices.

6. The method according to claim 5, characterized in that The step of determining a segmentation threshold for performing segmentation processing on the target document according to the position index includes: When the position index is an integer, the segmentation threshold of the slicing process is the position index value; When the position index is a decimal, the segmentation threshold of the slicing process is the average value of the values ​​on both sides of the position index.

7. The method according to claim 5, characterized in that The step of segmenting the target document based on the segmentation threshold to obtain semantically coherent target document slices includes: Using the segmentation threshold as a segmentation point to segment sentences whose length is greater than or equal to the segmentation threshold; merging sentences whose length is less than the segmentation threshold, and then using the segmentation threshold as a segmentation point to segment the merged sentences; Recursively slice the segmentation results and terminate the recursion when the length of all sentences is less than the preset slice length.

8. The method according to any one of claims 1 to 7, characterized in that: The document slices are subjected to a slice sliding window process by using a preset large language model to obtain a plurality of test cases, including: Determining prompt words for generating test cases for the large language model; The large language model is controlled to slide from the first slice with a window of a preset size, so that the large language model uses the current slice as a generation segment and generates a test case based on the prompt word.

9. An electronic device, characterized in that: include: processor; a memory for storing instructions executable by the processor; The processor is configured to execute the instructions to implement the steps of the test case generation method as described in any one of claims 1 to 8.

10. A computer-readable storage medium, characterized in that: When the instructions in the computer-readable storage medium are executed by a processor, the steps of the test case generation method according to any one of claims 1 to 8 are implemented.

Citation Information

Cited By

  • Text semantic partitioning method and device, equipment, medium and product

    CN120031046A

  • Text semantic chunking method, device, equipment, medium and product

    CN120031046B

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

    CN120277002A

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

    CN120277002B