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

By extracting regular information from the original requirements document and generating test cases using the BILSTM-CRF model and preset factor library, the problem of incomplete coverage of test cases in the existing technology is solved, and automated and accurate test case generation is realized, which improves test efficiency and coverage.

CN114238089BActive Publication Date: 2025-08-29CHINA CITIC BANK CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111483139.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-07
Publication Date
2025-08-29
Estimated Expiration
2041-12-07

AI Technical Summary

Technical Problem

When generating test cases, the existing technology has the problem of incomplete case coverage when new demands are added.

Method used

By obtaining the original requirement document, extracting regular requirement information, classifying and vectorizing, standardized test cases are generated using the BILSTM-CRF mathematical model, and scene expansion is combined with the preset factor library to finally generate the final test case.

Benefits of technology

It realizes the precise conversion of requirements documents into test cases, reduces manual operations, improves test coverage and efficiency, and reduces the incidence of missed tests for projects.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114238089B_ABST
    Figure CN114238089B_ABST
Patent Text Reader

Abstract

The present invention provides a test case generation method, device, equipment and readable storage medium, which relate to the field of software testing technology, including obtaining an original requirement document; extracting the test requirements in the original requirement document to obtain regularized requirement information; classifying the regularized requirement information to obtain standardized test cases; expanding the standardized test cases to obtain final test cases, and the final test case is a case after the scenario of the standardized test case is expanded. The present invention can accurately convert the requirement document into a test case at one time, without the need for manual writing of test cases, thereby reducing labor.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of software testing, and in particular to a test case generation method, apparatus, device and readable storage medium. Background Art

[0002] During the product development and testing process, product developers often need some test cases for development and testing. Currently, automatically generated cases are generated through neural network methods. When new requirements are added, there is a problem of incomplete coverage of the cases themselves. Summary of the Invention

[0003] The present invention aims to provide a test case generation method, apparatus, device, and readable storage medium to improve the above-mentioned problems. To achieve the above-mentioned objectives, the present invention adopts the following technical solutions:

[0004] In a first aspect, the present application provides a test case generation method, comprising:

[0005] Obtain the original requirements document;

[0006] Extracting test requirements from the original requirement document to obtain regularized requirement information;

[0007] Classifying the regularized demand information to obtain standardized test cases;

[0008] The standardized test case is expanded to obtain a final test case, where the final test case is a case obtained by scenario expansion of the standardized test case.

[0009] Furthermore, extracting the test requirements from the original requirement document to obtain regularized requirement information includes:

[0010] Calling the python-docx module to split the content in the original requirement file to obtain first information, where the first information is at least one case function point;

[0011] The first information is segmented to obtain regularized demand information.

[0012] Furthermore, the classifying the regularized requirement information to obtain standardized test cases includes:

[0013] Vectorizing the regularized demand information to obtain a feature vector set;

[0014] Annotating the feature vector set to obtain the annotated feature vector set;

[0015] Establishing a BILSTM-CRF mathematical model, using the labeled feature vector set as input information of the BILSTM-CRF mathematical model, and solving the BILSTM-CRF mathematical model to obtain case factor information, wherein the case factor information includes precondition information, action condition information, and expected result information;

[0016] The case factor information is combined to obtain a standardized test case.

[0017] Furthermore, the step of expanding the standardized test case to obtain a final test case includes:

[0018] Splitting the preset factor library into second information, wherein the second information includes at least one factor text, wherein the factor text is a text centered on the event factor and associated with the second-order factors, wherein the second-order factors are a condition factor, a result factor, and a time factor;

[0019] According to the standardized test case, matching the second information to obtain a first scene text and a matching status, wherein the matching status includes failure or success, and the second scene text is recorded as empty;

[0020] If the matching status is failure, a first control command is sent and a second scene text input by the tester is obtained, wherein the first control command includes a command for controlling the display to display a scene expansion failure, and the first scene text is recorded as empty;

[0021] If the second scenario text is empty, combining the first scenario text with the standardized test case to obtain a final test case;

[0022] If the first scenario text is empty, the second scenario text is combined with the standardized test case to obtain a final test case.

[0023] Furthermore, the matching of the first scene text and the matching status in the second information according to the standardized test case includes:

[0024] According to the standardized test case, the distance value with each factor text is calculated by the TF-IDF algorithm, and the largest distance value is recorded as the matching value;

[0025] If the matching value is greater than a preset threshold, the factor text corresponding to the matching value is recorded as the first scene text, and the matching status is recorded as successful;

[0026] If the matching value is less than the preset threshold, the matching status is recorded as failed.

[0027] Furthermore, the sending of the first control command and obtaining the second scenario text input by the tester includes:

[0028] Sending a second control command, the second control command including a command to control the display to display at least one first object, the first objects being arranged vertically in sequence, the first object including a first sub-object and a second sub-object, the first sub-object being used to display a factor text;

[0029] Obtain a filling operation, which includes filling artificial factor text information into the second sub-object, wherein the artificial factor text information is revision information of the factor text information in the first sub-object corresponding to the second sub-object, and the artificial factor text information of the filling operation is recorded as the second scene text.

[0030] In a second aspect, the present application also provides a test case generation device, comprising: a first acquisition unit, a first extraction unit, a first classification unit and an expansion unit; wherein

[0031] A first acquisition unit is used to acquire an original requirement document;

[0032] A first extraction unit is used to extract the test requirements in the original requirement document to obtain regularized requirement information;

[0033] A first classification unit, configured to classify the regularized requirement information to obtain standardized test cases;

[0034] The expansion unit is configured to expand the standardized test case to obtain a final test case, where the final test case is a case obtained by scenario expansion of the standardized test case.

[0035] Furthermore, the first extraction unit includes:

[0036] A first splitting unit is configured to call a python-docx module to split the content in the original requirement file to obtain first information, where the first information is at least one case function point;

[0037] The word segmentation document is used to segment the first information to obtain regularized demand information.

[0038] Furthermore, the first classification unit includes:

[0039] A vectorization unit, configured to vectorize the regularized demand information to obtain a feature vector set;

[0040] A standard unit, configured to label the feature vector set to obtain the labeled feature vector set;

[0041] a classification unit, configured to establish a BILSTM-CRF mathematical model, use the labeled feature vector set as input information of the BILSTM-CRF mathematical model, and solve the BILSTM-CRF mathematical model to obtain case factor information, wherein the case factor information includes precondition information, action condition information, and expected result information;

[0042] The combining unit is used to combine the case factor information to obtain a standardized test case.

[0043] Furthermore, the expansion unit includes:

[0044] A second splitting unit is configured to split the preset factor library into second information, wherein the second information includes at least one factor text, wherein the factor text is a text centered on the event factor and associated with second-order factors, wherein the second-order factors are a condition factor, a result factor, and a time factor;

[0045] a matching unit, configured to match the first scene text and a matching status in the second information according to the standardized test case, wherein the matching status includes failure or success, and the second scene text is recorded as empty;

[0046] a first judgment unit, configured to, if the matching status is failure, send a first control command and obtain a second scene text input by a tester, wherein the first control command includes a command for controlling a display to display a scene expansion failure, and record the first scene text as empty;

[0047] a second judgment unit, configured to combine the first scenario text with the standardized test case to obtain a final test case if the second scenario text is empty;

[0048] The third judgment unit is configured to combine the second scenario text with the standardized test case to obtain a final test case if the first scenario text is empty.

[0049] Furthermore, the matching unit includes:

[0050] A first calculation unit is configured to calculate the distance value between the first and second factor texts using the TF-IDF algorithm according to the standardized test case, and record the largest distance value as a matching value;

[0051] a fourth judgment unit, configured to record the factor text corresponding to the matching value as the first scene text and record the matching status as successful if the matching value is greater than a preset threshold;

[0052] The fifth judgment unit is configured to record the matching status as failed if the matching value is less than a preset threshold.

[0053] Furthermore, the third judgment unit includes:

[0054] a first command unit, configured to send a second control command, wherein the second control command includes a command for controlling the display to display at least one first object, wherein the first objects are arranged vertically in sequence, the first object includes a first sub-object and a second sub-object, and the first sub-object is used to display a factor text;

[0055] The second acquisition unit is used to obtain a filling operation, wherein the filling operation includes filling artificial factor text information into the second sub-object, and the artificial factor text information is the revision information of the factor text information in the first sub-object corresponding to the above-mentioned second sub-object. The artificial factor text information of the filling operation is recorded as the second scene text.

[0056] In a third aspect, the present application further provides a test case generation device, comprising:

[0057] Memory for storing computer programs;

[0058] A processor is configured to implement the steps of the test case generating method when executing the computer program.

[0059] In a fourth aspect, the present application further provides a readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps of the above-mentioned test case-based generation method are implemented.

[0060] The beneficial effects of the present invention are:

[0061] 1. This invention can accurately convert the requirement document into test cases at one time, eliminating the need to manually write test cases and reducing labor costs;

[0062] 2. This invention generates test cases through text segmentation and BILSTM-CRF (Bidirectional Long Short-Term Memory Network-Conditional Random Field Model), and then performs secondary processing through factor tools to achieve comprehensive coverage of case test points, thereby reducing the incidence of project omissions due to testers' incomplete understanding of the business.

[0063] Other features and advantages of the present invention will be described in the following description, and in part will become apparent from the description, or understood by practicing the embodiments of the present invention. The purposes and other advantages of the present invention can be realized and obtained by the structures particularly pointed out in the written description, claims, and drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0064] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for use in the embodiments. It should be understood that the following drawings only illustrate certain embodiments of the present invention and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other relevant drawings can be obtained based on these drawings without paying any creative work.

[0065] Figure 1 A flow chart of a test case generation method according to an embodiment of the present invention;

[0066] Figure 2 Schematic diagram of the structure of the test case generating device described in an embodiment of the present invention;

[0067] Figure 3 A schematic diagram of a device structure for generating a test case described in an embodiment of the present invention. DETAILED DESCRIPTION

[0068] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. The components of the embodiments of the present invention generally described and shown in the drawings herein can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present invention provided in the drawings is not intended to limit the scope of the claimed invention, but merely represents selected embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.

[0069] It should be noted that similar reference numerals and letters represent similar items in the following drawings. Therefore, once an item is defined in one drawing, it does not need to be further defined or explained in subsequent drawings. At the same time, in the description of the present invention, the terms "first", "second", etc. are used only to distinguish the description and should not be understood as indicating or implying relative importance. Example

[0070] This embodiment provides a test case generation method.

[0071] See also Figure 1 , the figure shows that the method includes step S100, step S200, step S300 and step S400.

[0072] S100. Obtain the original requirement document.

[0073] It should be noted that the original requirement text mentioned in this step is the requirement document for product development.

[0074] S200: Extract test requirements from the original requirement document to obtain regularized requirement information.

[0075] S300: Classify the regularized demand information to obtain standardized test cases.

[0076] S400: Expand the standardized test case to obtain a final test case, where the final test case is a case obtained by scenario expansion of the standardized test case.

[0077] This method improves the coverage of cases by expanding the scenarios of standardized test cases, reducing the problem of incomplete cases expanded manually or relying on a single algorithm.

[0078] In some specific embodiments, step S200 also includes step S210 and step S220.

[0079] S210. Call the python-docx module to split the content in the original requirement file to obtain first information, where the first information is at least one case function point.

[0080] It should be noted that the splitting method mentioned in this step is to separate each use case-level function point with a ";". The use case-level function points are the requirements in the requirements document. Example of processing results: Enter the Quanfutong payment page, select payment, and enter the face recognition page; face recognition is successful, enter the payment password verification code, and payment is successful.

[0081] S220: Segment the first information to obtain regularized demand information.

[0082] It should be noted that the word segmentation mentioned in this step refers to the word segmentation of the first information using the Jieba precise mode, so as to achieve the purpose of removing stop words and punctuation marks.

[0083] In some specific embodiments, step S300 also includes step S310, step S320, step S330 and step S340.

[0084] S310: vectorize the regularized demand information to obtain a feature vector set.

[0085] It should be noted that the vectorization method mentioned in this step is to use CBOW word vectors to convert them into feature vectors.

[0086] S320: Label the feature vector set to obtain a labeled feature vector set.

[0087] It should be noted that the annotation method used in this step is the BIO annotation standard annotation, which includes P: precondition; A: action; E: expected result specification.

[0088] S330: Establish a BILSTM-CRF mathematical model, use the labeled feature vector set as input information of the BILSTM-CRF mathematical model, and solve the BILSTM-CRF mathematical model to obtain case factor information, where the case factor information includes precondition information, action condition information, and expected result information.

[0089] S340. Combine case factor information to obtain standardized test cases.

[0090] Through the above steps, this method completes the generation of test cases by automatically generating according to the requirement documents, saving a lot of time costs for testers, thereby improving the overall testing efficiency and allowing testers to devote more energy to test execution.

[0091] In some specific embodiments, step S400 includes step S410, step S420, step S430, step S440 and step S450.

[0092] S410: Split the preset factor library into second information, where the second information includes at least one factor text. The factor text is a text centered on the event factor and associated with second-order factors. The second-order factors are condition factors, result factors, and time factors.

[0093] It should be noted that the preset factor library mentioned in this step is based on previous test results and includes event factors, condition factors, product factors, channel factors, outcome factors, time factors, and user factors. These factors are essentially key test information, i.e., the event factors, or the reason for the event.

[0094] It should also be noted that in this step, a factor text is the previous test case.

[0095] S420: According to the standardized test case, the first scenario text and the matching status are matched in the second information, where the matching status includes failure or success, and the second scenario text is recorded as empty.

[0096] S430: If the matching status is failure, send a first control command and obtain the second scenario text input by the tester, the first control command includes a command to control the display to display the scenario expansion failure, and the first scenario text is recorded as empty.

[0097] S440: If the second scenario text is empty, combine the first scenario text with the standardized test case to obtain a final test case.

[0098] S450: If the first scenario text is empty, combine the second scenario text with the standardized test case to obtain a final test case.

[0099] In this application, manual supplementary recording will be performed based on the automation expansion situation.

[0100] Specifically, in this method, S440 also includes step S441, step S442 and step S443.

[0101] S441. Based on the standardized test case, calculate the distance value with each factor text using the TF-IDF algorithm, and record the largest distance value as the matching value.

[0102] S442: If the matching value is greater than the preset threshold, the factor text corresponding to the matching value is recorded as the first scene text, and the matching status is recorded as successful.

[0103] S443: If the matching value is less than the preset threshold, the matching status is recorded as failed.

[0104] It should be noted that the preset threshold mentioned in this step is 0.4.

[0105] In this method, the TF-IDF algorithm is used to aggregate multiple business scenarios, time scenarios, and conditional scenarios in complex systems of the banking and financial industry, avoiding missed test scenarios due to incomplete description of business scenarios in requirements, thereby better ensuring test quality.

[0106] Specifically, in this method, S450 also includes step S451 and step S452.

[0107] S451. Send a second control command, where the second control command includes a command to control the display to display at least one first object, where the first objects are arranged vertically in sequence, and the first object includes a first sub-object and a second sub-object, and the first sub-object is used to display a factor text.

[0108] Specifically, in this embodiment, there are two first objects, each of which displays a factor text. The factor texts in the two first sub-objects are complementary and identical. The distance value of the factor text in one of the first sub-objects is the maximum value among the distance values ​​between all factor texts and standardized test cases. The distance value of the factor text in the other first sub-object is the second largest value among the distance values ​​between all factor texts and standardized test cases.

[0109] S452. Obtain a fill-in operation, which includes filling artificial factor text information into a second sub-object. The artificial factor text information is revision information of the factor text information in the first sub-object corresponding to the second sub-object. The artificial factor text information of the fill-in operation is recorded as the second scene text.

[0110] It should be noted that in this step, the closest factor text is manually selected from the two and modified.

[0111] In this step, manually selecting the most appropriate factor text from multiple results for modification can minimize manual modification costs and improve overall test efficiency.

[0112] In this method, a preset factor library is introduced into the generated test cases, and the business knowledge and requirements of multiple business scenarios in complex systems of the banking and financial industry are automatically combined to achieve automatic case generation with full coverage of business scenarios, avoiding missed test scenarios due to incomplete description of business scenarios in the requirements, thereby better ensuring the test quality. Example

[0113] like Figure 3 As shown, this embodiment provides a test case generation device, see Figure 3 , the device comprises:

[0114] The first acquiring unit 1 is used to acquire the original requirement document.

[0115] The first extraction unit 2 is used to extract the test requirements in the original requirement document to obtain regularized requirement information.

[0116] The first classification unit 333 is configured to classify the regularized requirement information to obtain standardized test cases.

[0117] The expansion unit 4 is configured to expand the standardized test case to obtain a final test case, where the final test case is a case obtained by scenario expansion of the standardized test case.

[0118] In some specific embodiments, the first extraction unit 2 includes:

[0119] The first splitting unit 21 is used to call the python-docx module to split the content in the original demand file to obtain first information, where the first information is at least one case function point.

[0120] The word segmentation document 22 is used to perform word segmentation on the first information to obtain regularized demand information.

[0121] In some specific embodiments, the first classification unit 333 includes:

[0122] The vectorization unit 31 is used to vectorize the regularized demand information to obtain a feature vector set.

[0123] The standard unit 32 is used to label the feature vector set to obtain a labeled feature vector set.

[0124] The classification unit 33 is used to establish a BILSTM-CRF mathematical model, use the labeled feature vector set as the input information of the BILSTM-CRF mathematical model, and solve the BILSTM-CRF mathematical model to obtain case factor information. The case factor information includes precondition information, action condition information, and expected result information.

[0125] The combining unit 34 is used to combine case factor information to obtain standardized test cases.

[0126] In some specific embodiments, the extension unit 4 includes:

[0127] The second splitting unit 41 is used to split the preset factor library into second information, where the second information includes at least one factor text. The factor text is a text centered on the event factor and associated with the second-order factors. The second-order factors are condition factors, result factors, and time factors.

[0128] The matching unit 42 is configured to match the second information according to the standardized test case to obtain the first scenario text and a matching status, where the matching status includes failure or success, and the second scenario text is recorded as empty.

[0129] The first judgment unit 43 is configured to send a first control command and obtain a second scenario text input by a tester if the matching status is failure. The first control command includes a command for controlling the display to display a scenario expansion failure, and the first scenario text is recorded as empty.

[0130] The second judgment unit 44 is configured to combine the first scenario text with the standardized test case to obtain a final test case if the second scenario text is empty.

[0131] The third judgment unit 45 is configured to combine the second scenario text with the standardized test case to obtain a final test case if the first scenario text is empty.

[0132] In some specific embodiments, the matching unit 42 includes:

[0133] The first calculation unit 411 is used to calculate the distance value with each factor text by using the TF-IDF algorithm according to the standardized test case, and record the largest distance value as the matching value.

[0134] The fourth judgment unit 412 is configured to record the factor text corresponding to the matching value as the first scene text and the matching status as successful if the matching value is greater than a preset threshold.

[0135] The fifth judgment unit 413 is configured to record the matching status as failed if the matching value is less than a preset threshold.

[0136] In some specific embodiments, the third determination unit 45 includes:

[0137] The first command unit 451 is used to send a second control command, which includes a command to control the display to display at least one first object. The first objects are arranged vertically in sequence. The first object includes a first sub-object and a second sub-object. The first sub-object is used to display a factor text.

[0138] The second acquisition unit 452 is used to obtain a filling operation, which includes filling in artificial factor text information into a second sub-object. The artificial factor text information is the revision information of the factor text information in the first sub-object corresponding to the above-mentioned second sub-object. The artificial factor text information of the filling operation is recorded as the second scene text.

[0139] It should be noted that, regarding the apparatus in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated on here. Example

[0140] Corresponding to the above method embodiment, this embodiment further provides a test case generating device. The test case generating device described below and the test case generating method described above can refer to each other.

[0141] Figure 3 FIG. 8 is a block diagram of a test case generating device 800 according to an exemplary embodiment. Figure 3 As shown, the test case generating device 800 may include: a processor 801 and a memory 802. The test case generating device 800 may also include one or more of a multimedia component 803, an I / O interface 804, and a communication component 805.

[0142] The processor 801 is used to control the overall operation of the test case generation device 800 to complete all or part of the steps in the above-mentioned test case generation method. The memory 802 is used to store various types of data to support the operation of the test case generation device 800. For example, these data may include instructions for any application or method operating on the test case generation device 800, as well as application-related data, such as contact data, sent and received messages, pictures, audio, video, etc. The memory 802 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk or optical disk. The multimedia component 803 may include a screen and an audio component. The screen may be, for example, a touch screen, and the audio component is used to output and / or input audio signals. For example, the audio component may include a microphone for receiving external audio signals. The received audio signal may be further stored in the memory 802 or sent via the communication component 805. The audio component also includes at least one speaker for outputting audio signals. The I / O interface 804 provides an interface between the processor 801 and other interface modules. The above-mentioned other interface modules may be a keyboard, a mouse, buttons, etc. These buttons may be virtual buttons or physical buttons. The communication component 805 is used for wired or wireless communication between the test case generation device 800 and other devices. Wireless communication, such as Wi-Fi, Bluetooth, Near Field Communication (NFC), 2G, 3G or 4G, or a combination of one or more thereof, so the corresponding communication component 805 may include: a Wi-Fi module, a Bluetooth module, an NFC module.

[0143] In an exemplary embodiment, the test case generation device 800 can be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to execute the above-mentioned test case generation method.

[0144] In another exemplary embodiment, a computer-readable storage medium including program instructions is also provided. When executed by a processor, the program instructions implement the steps of the test case generation method described above. For example, the computer-readable storage medium may be the memory 802 including the program instructions described above. The program instructions may be executed by the processor 801 of the test case generation device 800 to perform the test case generation method described above. Example

[0145] Corresponding to the above method embodiment, this embodiment further provides a readable storage medium. The readable storage medium described below and the test case generation method described above can refer to each other.

[0146] A readable storage medium stores a computer program, which, when executed by a processor, implements the steps of the test case generation method of the above method embodiment.

[0147] The readable storage medium may specifically be any readable storage medium that can store program code, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.

[0148] The above are merely preferred embodiments of the present invention and are not intended to limit the present invention. Those skilled in the art will readily appreciate that various modifications and variations of the present invention are possible. Any modifications, equivalent substitutions, or improvements made within the spirit and principles of the present invention shall be included within the scope of protection of the present invention.

[0149] The above are merely specific embodiments of the present invention, but the scope of protection of the present invention is not limited thereto. Any modifications or substitutions that can be easily conceived by a person skilled in the art within the technical scope disclosed in the present invention should be included in the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be based on the scope of protection of the claims.

Claims

1. A test case generation method, characterized in that: include: Obtain the original requirements document; Extracting test requirements from the original requirement document to obtain regularized requirement information; Classifying the regularized demand information to obtain standardized test cases; Expanding the standardized test case to obtain a final test case, wherein the final test case is a case after the scenario of the standardized test case is expanded; The step of expanding the standardized test case to obtain a final test case includes: Splitting the preset factor library into second information, wherein the second information includes at least one factor text, wherein the factor text is a text centered on the event factor and associated with the second-order factors, wherein the second-order factors are a condition factor, a result factor, and a time factor; According to the standardized test case, matching the second information to obtain a first scene text and a matching status, wherein the matching status includes failure or success, and the second scene text is recorded as empty; If the matching status is failure, a first control command is sent and a second scene text input by the tester is obtained, wherein the first control command includes a command for controlling the display to display a scene expansion failure, and the first scene text is recorded as empty; If the second scenario text is empty, combining the first scenario text with the standardized test case to obtain a final test case; If the first scenario text is empty, combining the second scenario text with the standardized test case to obtain a final test case; The sending of the first control command and obtaining the second scenario text input by the tester includes: Sending a second control command, the second control command including a command to control the display to display at least one first object, the first objects being arranged vertically in sequence, the first object including a first sub-object and a second sub-object, the first sub-object being used to display a factor text; Obtain a filling operation, which includes filling artificial factor text information into the second sub-object, wherein the artificial factor text information is revision information of the factor text information in the first sub-object corresponding to the second sub-object, and the artificial factor text information of the filling operation is recorded as the second scene text.

2. The test case generation method according to claim 1, characterized in that ,The extraction of the test requirements in the original requirement document to obtain regularized requirement information includes: Calling the python-docx module to split the content in the original requirement file to obtain first information, where the first information is at least one case function point; The first information is segmented to obtain regularized demand information.

3. The test case generation method according to claim 1, characterized in that , the categorization of the regularized demand information to obtain standardized test cases includes: Vectorizing the regularized demand information to obtain a feature vector set; Annotating the feature vector set to obtain the annotated feature vector set; Establishing a BILSTM-CRF mathematical model, using the labeled feature vector set as input information of the BILSTM-CRF mathematical model, and solving the BILSTM-CRF mathematical model to obtain case factor information, wherein the case factor information includes precondition information, action condition information, and expected result information; The case factor information is combined to obtain a standardized test case.

4. The test case generation method according to claim 1, characterized in that , said matching the first scene text and the matching status in the second information according to the standardized test case, including: According to the standardized test case, the distance value with each factor text is calculated by the TF-IDF algorithm, and the largest distance value is recorded as the matching value; If the matching value is greater than a preset threshold, the factor text corresponding to the matching value is recorded as the first scene text, and the matching status is recorded as successful; If the matching value is less than the preset threshold, the matching status is recorded as failed.

5. A test case generating device, characterized in that: include: A first acquisition unit is used to acquire an original requirement document; A first extraction unit is used to extract the test requirements in the original requirement document to obtain regularized requirement information; A first classification unit, configured to classify the regularized requirement information to obtain standardized test cases; An expansion unit, configured to expand the standardized test case to obtain a final test case, wherein the final test case is a case obtained by scenario expansion of the standardized test case; The expansion unit includes: A second splitting unit is configured to split the preset factor library into second information, wherein the second information includes at least one factor text, wherein the factor text is a text centered on the event factor and associated with second-order factors, wherein the second-order factors are a condition factor, a result factor, and a time factor; a matching unit, configured to match the first scene text and a matching status in the second information according to the standardized test case, wherein the matching status includes failure or success, and the second scene text is recorded as empty; a first judgment unit, configured to, if the matching status is failure, send a first control command and obtain a second scene text input by a tester, wherein the first control command includes a command for controlling a display to display a scene expansion failure, and record the first scene text as empty; a second judgment unit, configured to combine the first scenario text with the standardized test case to obtain a final test case if the second scenario text is empty; a third judgment unit, configured to combine the second scenario text with the standardized test case to obtain a final test case if the first scenario text is empty; The third judgment unit includes: a first command unit, configured to send a second control command, wherein the second control command includes a command for controlling the display to display at least one first object, wherein the first objects are arranged vertically in sequence, the first object includes a first sub-object and a second sub-object, and the first sub-object is used to display a factor text; The second acquisition unit is used to obtain a filling operation, wherein the filling operation includes filling artificial factor text information into the second sub-object, and the artificial factor text information is the revision information of the factor text information in the first sub-object corresponding to the above-mentioned second sub-object. The artificial factor text information of the filling operation is recorded as the second scene text.

6. The test case generating device according to claim 5, characterized in that: The first extraction unit includes: A first splitting unit is configured to call a python-docx module to split the content in the original requirement file to obtain first information, where the first information is at least one case function point; The word segmentation document is used to segment the first information to obtain regularized demand information.

7. The test case generating device according to claim 5, characterized in that: The first classification unit includes: A vectorization unit, configured to vectorize the regularized demand information to obtain a feature vector set; A standard unit, configured to label the feature vector set to obtain the labeled feature vector set; a classification unit, configured to establish a BILSTM-CRF mathematical model, use the labeled feature vector set as input information of the BILSTM-CRF mathematical model, and solve the BILSTM-CRF mathematical model to obtain case factor information, wherein the case factor information includes precondition information, action condition information, and expected result information; The combining unit is used to combine the case factor information to obtain a standardized test case.

8. The test case generating device according to claim 5, characterized in that: The matching unit includes: A first calculation unit is configured to calculate the distance value between the first and second factor texts using the TF-IDF algorithm according to the standardized test case, and record the largest distance value as a matching value; a fourth judgment unit, configured to record the factor text corresponding to the matching value as the first scene text and record the matching status as successful if the matching value is greater than a preset threshold; The fifth judgment unit is configured to record the matching status as failed if the matching value is less than a preset threshold.

9. A test case generating device, characterized in that: include: memory for storing computer programs; A processor, configured to implement the steps of the test case generation method according to any one of claims 1 to 4 when executing the computer program.

10. A readable storage medium, characterized in that: The readable storage medium stores a computer program, which, when executed by a processor, implements the steps of the test case generation method according to any one of claims 1 to 4.

Citation Information

Patent Citations

  • Test case generation method based on slot filling

    CN111159017A

  • Test case reusing system and method based on demand item extraction

    CN113687826A