Test case generation method and system
By vectorizing historical business data and establishing a vector database, AI large models can automatically generate test cases, solving the problems of low efficiency, insufficient coverage and poor adaptability in the existing technology, and achieving more efficient and targeted test case generation.
Patent Information
- Application Number
- CN202510164943.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-14
- Publication Date
- 2025-06-13
AI Technical Summary
In the prior art, the test case generation efficiency, insufficient coverage and poor adaptability are not effectively solved, and the problem of writing test cases during software development and testing is not effective.
By vectorizing historical business data and establishing a vector database, AI models can make relevant matches based on historical data and automatically write test cases.
It improves the efficiency of writing test cases, ensures that the generated test cases are more targeted and effective, and improves the reliability and quality of tests.
Smart Images

Figure CN120144440A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data processing, and particularly to a test case generation method and system. Background Art
[0002] In the process of software development and testing, the writing of test cases is an important link to ensure the quality of the system. Traditional test case generation methods usually rely on manual experience, with low efficiency and prone to missing important scenarios. As the complexity of software systems increases, the limitations of manually writing test cases become more obvious, resulting in problems such as low efficiency, insufficient coverage, and poor adaptability.
[0003] For the above problems in the prior art, there is currently no effective solution. Summary of the Invention
[0004] To solve the above problems, the present invention provides a test case generation method and system. By vectorizing historical business data and establishing a vector database, the AI large model can perform relevant matching based on historical data, and automatically generate test cases based on the matched data, so as to solve the problems of low efficiency, insufficient coverage, and poor adaptability of test cases in the prior art.
[0005] To achieve the above object, the present invention provides a test case generation method, including: obtaining initial historical business data; performing data preprocessing on the initial historical business data to obtain processed historical business data; converting the processed historical business data into a vector form to obtain vectorized historical business data, and storing the vectorized historical business data in a vector database; when receiving the current business requirement input by the user, matching the vectorized historical business data in the vector database according to the current business requirement through the AI large model, and determining the matched vectorized historical business data as relevant historical business data; generating a test case framework to be reviewed according to the relevant historical business data, reviewing the test case framework to be reviewed, if the review fails, updating the test case framework to be reviewed according to the review opinion; if the review passes, generating a test case according to the test case framework to be reviewed.
[0006] Further optionally, the converting the processed historical business data into a vector form includes: using the historical business requirements and defect records in the processed historical business data as description texts respectively; performing word segmentation processing and stop word processing on each description text to obtain processed description texts; calculating the TF-IDF value of each word in the processed description texts, and calculating the TF-IDF vector corresponding to the processed description texts according to all the TF-IDF values.
[0007] Further optionally, matching relevant vectorized historical business data in the vector database through the AI large model according to the current business requirement, and determining the matched vectorized historical business data as relevant historical business data includes: performing word segmentation processing and stop word processing on the current business requirement to obtain a processed business requirement; converting the processed business requirement into a vectorized business requirement through the AI large model; through the AI large model, matching the TF-IDF vectors of relevant historical business requirements and the TF-IDF vectors of relevant defect records from the vector database according to the vectorized business requirement, and taking the TF-IDF vectors of relevant historical business requirements and the TF-IDF vectors of relevant defect records as relevant historical business data.
[0008] Further optionally, matching the TF-IDF vectors of relevant historical business requirements and the TF-IDF vectors of relevant defect records from the vector database according to the vectorized business requirement, and taking the TF-IDF vectors of relevant historical business requirements and the TF-IDF vectors of relevant defect records as relevant historical business data includes: calculating the similarity between the vectorized business requirement and all vectorized historical business data in the vector database; filtering out the vectorized historical business data with a corresponding similarity lower than the preset similarity threshold from all vectorized historical business data to obtain relevant historical business data; wherein, the historical business requirements in the relevant historical business data are relevant historical business requirements, and the defect records in the relevant historical business data are relevant defect records.
[0009] Further optionally, generating a test case framework to be reviewed according to the relevant historical business data includes: determining a test scenario according to the relevant historical business data; generating test points corresponding to each test scenario; for each test point, generating corresponding preconditions, test steps, expected results, and priorities, and combining them into a test case framework to be reviewed.
[0010] On the other hand, the present invention also provides a test case generation system, including: a data acquisition module for acquiring initial historical business data; a data preprocessing module for preprocessing the initial historical business data to obtain processed historical business data; a vector database establishment module for converting the processed historical business data into a vector form to obtain vectorized historical business data and storing the vectorized historical business data in a vector database; a matching module for, when receiving the current business requirements input by a user, matching relevant vectorized historical business data in the vector database according to the current business requirements through an AI large model and determining the matched vectorized historical business data as relevant historical business data; an auditing module for generating a test case framework to be audited according to the relevant historical business data, auditing the test case framework to be audited, and if the audit fails, updating the test case framework to be audited according to the audit opinions; and if the audit passes, generating a test case according to the test case framework to be audited.
[0011] Further optionally, the vector database establishment module includes: a text extraction sub-module for respectively using the historical business requirements and defect records in the processed historical business data as description texts; a text processing sub-module for performing word segmentation processing and stop word processing on each description text to obtain processed description texts; and a vectorization sub-module for calculating the TF-IDF value of each word in the processed description text and calculating the TF-IDF vector corresponding to the processed description text according to all the TF-IDF values.
[0012] Further optionally, the matching module includes: a requirements processing sub-module for performing word segmentation processing and stop word processing on the current business requirements to obtain processed business requirements; a vector conversion sub-module for converting the processed business requirements into vectorized business requirements through the AI large model; and a matching sub-module for, through the AI large model, matching the TF-IDF vectors of relevant historical business requirements and the TF-IDF vectors of relevant defect records from the vector database according to the vectorized business requirements and using the TF-IDF vectors of relevant historical business requirements and the TF-IDF vectors of relevant defect records as relevant historical business data.
[0013] Further optionally, the matching sub-module includes: a similarity calculation unit for calculating the similarity between the vectorized business requirements and all the vectorized historical business data in the vector database; and a filtering unit for filtering out the vectorized historical business data with a corresponding similarity lower than a preset similarity threshold from all the vectorized historical business data to obtain relevant historical business data; wherein the historical business requirements in the relevant historical business data are relevant historical business requirements, and the defect records in the relevant historical business data are relevant defect records.
[0014] Further optionally, the audit module includes: a scenario determination submodule, used to determine the test scenario based on the relevant historical business data; a test point generation submodule, used to generate test points corresponding to each test scenario; a framework generation submodule, used to generate corresponding preconditions, test steps, expected results and priorities for each test point, and combine them into a test case framework to be audited.
[0015] The above technical solution has the following beneficial effects: by extracting historical business data and establishing a corresponding vector database, the AI big model can quickly call and identify the data therein to generate test cases, thereby improving the efficiency of test case writing; the AI big model can intelligently extract relevant historical business data based on the input new business needs, ensuring that the generated test cases are more targeted and improving the effectiveness of the test cases; setting audit nodes to timely adjust and optimize test cases, and improving the final output test cases to meet actual needs, thereby improving the reliability of the test; in addition, the AI big model can generate test cases in a targeted manner based on defect records, reduce the occurrence rate of bugs, and improve the quality of test cases. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0017] Figure 1 is a flow chart of a test case generation method provided by an embodiment of the present invention;
[0018] Figure 2 is a flow chart of a vector conversion method provided by an embodiment of the present invention;
[0019] Figure 3 is a flow chart of a data matching method provided by an embodiment of the present invention;
[0020] Figure 4 is a flowchart of extracting relevant historical business data provided by an embodiment of the present invention;
[0021] Figure 5 is a flow chart of a method for generating a test case framework to be reviewed provided by an embodiment of the present invention;
[0022] Figure 6 It is a structural diagram of a test case generation system provided by an embodiment of the present invention;
[0023] Figure 7It is a schematic structural diagram of the vector database establishment module provided by an embodiment of the present invention;
[0024] Figure 8 It is a schematic structural diagram of the matching module provided by an embodiment of the present invention;
[0025] Figure 9 It is a schematic structural diagram of the matching sub-module provided by an embodiment of the present invention;
[0026] Figure 10 It is a schematic structural diagram of the review module provided by an embodiment of the present invention.
[0027] Reference numerals: 100 - data acquisition module; 200 - data preprocessing module; 300 - vector database establishment module; 3001 - text extraction sub-module; 3002 - text processing sub-module; 3003 - vectorization sub-module; 400 - matching module; 4001 - requirement processing sub-module; 4002 - vector conversion sub-module; 4003 - matching sub-module; 40031 - similarity calculation unit; 40032 - filtering unit; 500 - review module; 5001 - scenario determination sub-module; 5002 - test point generation sub-module; 5003 - framework generation sub-module. Detailed implementation manners
[0028] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.
[0029] To solve the problems of low efficiency, insufficient coverage, and poor adaptability in manually writing test cases in the prior art, an embodiment of the present invention provides a test case generation method. Figure 1 It is a flowchart of the test case generation method provided by an embodiment of the present invention. As Figure 1 shown, the method includes:
[0030] S1. Obtain initial historical business data.
[0031] For a certain project, there are various data related to the project, such as business requirements, historical test cases, defect records, etc. These data are the basis for subsequent data processing, that is, the original data.
[0032] Business requirements refer to the business goals, functional requirements, and user requirements proposed by enterprises or customers. For example: The user login function must support login through both email and mobile phone numbers.
[0033] Historical test cases refer to test scenarios written for aspects such as the functionality, performance, and security of a system or product, and have been executed in the past.
[0034] Defect records refer to problems found in a system or product during the testing process and are documents for tracking and management.
[0035] There are problems such as redundancy and duplication in the original data. For these problems, the original data can be cleaned to ensure that the data is more representative.
[0036] As an optional implementation method, intelligent data cleaning technology of machine learning can be adopted to perform semantic analysis on the collected original data using a natural language processing (NLP) model. By identifying similar or duplicate content, automatically removing duplicates and retaining the most representative data. At the same time, combined with context understanding, ensure that key information is not accidentally deleted during the cleaning process to obtain initial historical business data. For example, among the collected business requirements, there may be multiple requirements with similar descriptions (such as "user login function" and "user login function via email"). After analyzing the semantics through the NLP model, the similarity of these requirements is identified, and duplicates are automatically removed, retaining the most representative requirement description (such as "the user login function must support login via email and mobile phone").
[0037] To improve the data coverage, as an optional implementation method, by analyzing the generation effect and actual test results of historical test cases, automatically adjust the weights of different data sources (such as business requirements, defect records, etc.) in the preprocessing. For example, if a certain business requirement is not fully covered in multiple tests, the system will automatically increase its weight to ensure more attention in subsequent test case generation.
[0038] S2. Perform data preprocessing on the initial historical business data to obtain processed historical business data.
[0039] To improve the data quality and ensure the accuracy of subsequent retrieval, it is necessary to perform preprocessing on the initial historical business data after obtaining it, and processed historical business data is obtained after preprocessing.
[0040] Preprocessing includes: data cleaning, formatting, and data splitting.
[0041] Data cleaning includes:
[0042] 1) Remove noise data: Use regular expressions or rule engines to filter out irrelevant characters (such as special symbols, garbled characters, etc.); Identify and remove meaningless text (such as advertising content, unimportant comments, etc.) through NLP technology.
[0043] 2) Duplicate removal: Use semantic similarity algorithms (such as cosine similarity, Jaccard similarity) or pre-training to calculate the similarity between texts. Set a similarity threshold (such as 0.9), consider data with similarity higher than the threshold as duplicate data, and retain the most representative one among the duplicate data.
[0044] 3) Error correction: Use a spelling checker tool (such as PySpellChecker) to correct spelling mistakes in the text. Correct issues of inconsistent term usage through a rule engine or a domain dictionary.
[0045] 4) Missing value handling: For missing fields, fill in default values according to the context or historical data. If the missing value cannot be filled, mark it as "unknown" or directly remove it.
[0046] The main task of formatting the data is to convert the cleaned data into a unified format for subsequent processing and analysis, which includes:
[0047] 1) Unify text format: Convert all text to lowercase or uppercase to ensure consistency; use regular expressions or NLP tools to unify the formats of dates, times, numbers, etc. For example, when unifying the time format, modify the business requirement "The user login function must be completed before 2025 / 1 / 01" to "The user login function must be completed before 2025-01-01".
[0048] 2) Structured data: Convert unstructured data (such as free text) into structured data (such as JSON, XML); use templates or rule engines to extract key fields (such as requirement descriptions, defect steps, expected results, etc.).
[0049] For example, the original text: "Defect description: User login failed. Steps: 1. Open the login page; 2. Enter the mobile phone number and password; 3. Click the login button. Expected result: Login successful. Actual result: Login failed."
[0050] After structuring, the following content is obtained:
[0051] {
[0052] "defect description": "User login failed",
[0053] "steps":
[0054] "Open the login page",
[0055] "Enter the mobile phone number and password",
[0056] "Click the login button"
[0057] ,
[0058] "Expected result": "Login successful",
[0059] "Actual result": "Login failed"
[0060] }
[0061] 3) Data segmentation: Split long texts into smaller semantic units (such as sentences, paragraphs). This process uses NLP tools (such as sentence segmentation models) to ensure the accuracy of chunking.
[0062] For example, the original text: "The user login function must support login via both email and mobile phone numbers. After successful login, it should redirect to the user's personal homepage." After data segmentation, the following content is obtained:
[0064] "The user login function must support login via both email and mobile phone numbers.",
[0065] "After successful login, it should redirect to the user's personal homepage."
[0066] .
[0067] S3. Convert the processed historical business data into vector form to obtain vectorized historical business data, and store the vectorized historical business data in a vector database.
[0068] The processed historical business data is converted into vector form through a specific vectorization method, and the converted vectorized historical business data is stored in a vector database. Among them, the vectorized historical business data can be stored in a structured format (such as NumPy arrays, CSV files, or databases) for subsequent calls by AI large models.
[0069] S4. When receiving the current business requirements input by the user, match the relevant vectorized historical business data in the vector database according to the current business requirements, and determine the matched vectorized historical business data as the relevant historical business data.
[0070] The user manually inputs a new business requirement as the current business requirement. This is usually a text describing the function or requirement, which may include specific business goals, operation processes, expected system responses, etc.
[0071] AI large models (such as pre-trained language models like BERT, GPT, Transformer, etc.) are used to vectorize the current business requirements, that is, convert the user's input into vector form. Then, the similarity between the vectorized current business requirements and the vectorized historical business data stored in the vector database is calculated, and the vectorized historical business data with a higher similarity is found as the relevant historical business data.
[0072] S5. Generate a test case framework to be reviewed based on relevant historical business data, and review the test case framework to be reviewed. If the review fails, update the test case framework to be reviewed according to the review comments; if the review passes, generate test cases based on the test case framework to be reviewed.
[0073] Generate a test case framework to be reviewed based on relevant historical business data. This framework includes scenarios to be tested, test points, steps, priorities, etc. This step can be implemented through an AI large model combined with a vector database, or through a template engine. The following is an example of a test case framework:
[0074] Scenario 1: User registers via email
[0075] **Test Point 1**: Verify whether the email format is correct.
[0076] - Precondition: None.
[0077] - Test steps:
[0078] 1. Open the registration page.
[0079] 2. Enter a correctly formatted email (e.g., test@example.com).
[0080] 3. Click the "Register" button.
[0081] - Expected result: The system accepts the email and proceeds to the next step.
[0082] - Priority: High.
[0083] After generating the test case framework to be reviewed, it needs to be reviewed by manual or automated review software set based on experience (such as models obtained from training historical test case frameworks, etc.) to check whether it comprehensively and accurately reflects the new requirements and the situation of historical business data.
[0084] As an alternative implementation method, the review content includes: integrity review, accuracy review, executability review, priority rationality review, and consistency review.
[0085] Integrity review: Whether the test case framework covers all key scenarios and test points. Specifically, judge whether all function points of the new requirements are covered; whether boundary conditions and abnormal scenarios are considered; whether scenarios related to historical high-frequency bugs are covered.
[0086] Accuracy review: Whether the description of the test case is accurate. Specifically, judge whether the test steps are clear and unambiguous; whether the expected results meet the requirement definitions; whether the preconditions are reasonable and necessary.
[0087] Executability review: Whether the test cases are easy to execute. Specifically, judge whether the test steps are specific and operable; whether additional test data or environment configuration is required; whether overly complex or redundant steps are avoided.
[0088] Priority rationality review: Whether the priorities of the test cases are reasonable. Specifically, judge whether the high-priority test cases cover the core functions; whether the medium- and low-priority test cases cover the secondary functions or edge scenarios.
[0089] Consistency review: Whether the test case framework is consistent with the requirement document and historical data. Specifically, judge whether the test cases are consistent with the current business requirement description; whether historical business data is referenced.
[0090] If the test case framework to be reviewed passes the review, detailed test cases are generated according to this test case framework. If it does not pass the review, the reviewer can give specific review opinions and feedback them to the AI large model, so that it can modify the test case framework to be reviewed according to this opinion until it passes the review.
[0091] As an optional implementation method, generating detailed test cases according to the test case framework includes:
[0092] 1. Refine the test steps: Further refine the test steps in the framework to ensure that each step is specific and operable.
[0093] For example:
[0094] The step in the framework: "Enter a correctly formatted email (such as test@example.com)";
[0095] The refined step: Enter test@example.com in the email input box.
[0096] 2. Supplement test data: Provide specific test data for each test case.
[0097] For example: Email: test@example.com; Mobile phone number: 13800138000; Password: Test@1234.
[0098] 3. Define the expected results: Ensure that the expected results are specific and verifiable.
[0099] For example: The expected result in the framework: "The system accepts the email and proceeds to the next step";
[0100] The refined expected result: "The page jumps to the verification code input page, and the prompt message 'Verification code has been sent to test@example.com' is displayed."
[0101] 4. Generate detailed test cases: Organize the refined test steps, test data, and expected results into detailed test cases.
[0102] Then, for test point 1 of the above test case framework, the detailed test cases are generated as follows:
[0103] Test scenario 1: User registers via email
[0104] - **Test point 1**: Verify whether the email format is correct.
[0105] - Prerequisite: None.
[0106] - Test steps:
[0107] 1. Open the registration page.
[0108] 2. Enter test@example.com in the email input box.
[0109] 3. Click the "Register" button.
[0110] - Expected result: The page jumps to the verification code input page, and the prompt message "Verification code has been sent to test@example.com" is displayed.
[0111] - Priority: High.
[0112] If the test case framework fails the review, the framework needs to be adjusted and optimized. Analyze the review comments to identify the problems in the framework and optimize according to the specific problems. For example, after manual review, the review comment is to optimize the original test point "Verify whether the email format is correct" to "Verify whether the email format is correct, including complex formats such as with dots and plus signs", then the test case framework to be reviewed after adjustment is as follows:
[0113] Test scenario 1: User registers via email
[0114] - **Test point 1**: Verify whether the email format is correct, including complex formats such as with dots and plus signs.
[0115] - Prerequisite: None.
[0116] - Test steps:
[0117] 1. Open the registration page.
[0118] 2. Enter (such as test@example.com) in the email input box.
[0119] 3. Click the "Register" button.
[0120] - Expected result: The system accepts the email and proceeds to the next step.
[0121] - Priority: High.
[0122] As an alternative implementation Figure 2 is the flowchart of the vector conversion method provided by the embodiments of the present invention. As shown in Figure 2 the figure, converting the processed historical business data into vector form includes:
[0123] S301. Respectively use the historical business requirements and defect records in the processed historical business data as descriptive texts.
[0124] Historical business requirements: Organize the text descriptions of all business requirements.
[0125] Defect records: Organize the text descriptions of all bug records, including defect descriptions, reproduction steps, expected results, actual results, etc.
[0126] Use these two types of data as the basis for data processing to facilitate subsequent vectorization processing.
[0127] S302. Perform word segmentation processing and stop word processing on each descriptive text to obtain processed descriptive texts.
[0128] Perform word segmentation processing on the descriptive text. Word segmentation means dividing the text into smaller semantic units.
[0129] Perform stop word processing on the descriptive text. Stop words refer to words that appear very frequently in text analysis but have no actual meaning for analysis (such as "of", "is", "in", etc.). Remove these words to reduce the amount of data processing.
[0130] After the above two processes on the descriptive text, processed descriptive texts are obtained.
[0131] S303. Calculate the TF-IDF value of each word in the processed descriptive text, and calculate the TF-IDF vector corresponding to the processed descriptive text based on all TF-IDF values.
[0132] TF-IDF (Term Frequency - Inverse Document Frequency) is a commonly used text feature extraction method, which is used to measure the importance of each word in the processed descriptive text. This method comprehensively considers the term frequency and the rarity of the word in the entire corpus, and can assign an importance weight, that is, the TF-IDF value, to each word.
[0133] The TF-IDF values of all words in each processed descriptive text form the TF-IDF vector of this text, and this vector is used to represent the features of the text.
[0134] As an alternative implementation Figure 3 is the flowchart of the data matching method provided by the embodiments of the present invention. As shown inFigure 3 As shown, according to the current business requirements, relevant vectorized historical business data is matched in the vector database, and the matched vectorized historical business data is determined as relevant historical business data, including:
[0135] S401. Perform word segmentation processing and stop word processing on the current business requirements to obtain processed business requirements.
[0136] Perform data preprocessing on the current business requirements using the same word segmentation processing method and stop word processing method as the historical business requirements to obtain processed business requirements. Input the processed business requirements into the AI large model.
[0137] S402. Convert the processed business requirements into vectorized business requirements through the AI large model.
[0138] The AI large model converts the new business requirements into high-dimensional vectors (Embedding) to obtain vectorized business requirements. The vector conversion method here should be consistent with the conversion method of the above-described text.
[0139] S403. Through the AI large model, match the TF-IDF vectors of relevant historical business requirements and the TF-IDF vectors of relevant defect records from the vector database according to the vectorized business requirements, and use the TF-IDF vectors of relevant historical business requirements and the TF-IDF vectors of relevant defect records as relevant historical business data.
[0140] Match the vectorized business requirements with the vectorized historical business requirements and defect records in the vector database to obtain historical business requirements and defect records with high similarity, and use them as relevant historical business data.
[0141] As an optional implementation manner, Figure 4 is the flowchart of extracting relevant historical business data provided by the embodiments of the present invention. As Figure 4 shown, match the TF-IDF vectors of relevant historical business requirements and the TF-IDF vectors of relevant defect records from the vector database according to the vectorized business requirements, and use the TF-IDF vectors of relevant historical business requirements and the TF-IDF vectors of relevant defect records as relevant historical business data, including:
[0142] S4031. Calculate the similarity between the vectorized business requirements and all vectorized historical business data in the vector database.
[0143] Calculate the similarity between the vectorized business requirements and all vectorized historical business data in the vector database. The vectorized historical business data includes vectorized historical business requirements and vectorized defect records.
[0144] As an alternative implementation, the cosine similarity method is used to calculate the similarity between two vectors.
[0145] Cosine similarity = (A·B) / (||A||*||B||), where A and B are two vectors.
[0146] S4032. Filter out the vectorized historical business data with corresponding similarity lower than the preset similarity threshold from all the vectorized historical business data to obtain relevant historical business data; wherein, the historical business requirements in the relevant historical business data are relevant historical business requirements, and the defect records in the relevant historical business data are relevant defect records.
[0147] Set a similarity threshold in advance, i.e., the preset similarity threshold. Filter out the vectorized historical business data with similarity lower than the preset similarity threshold. Retain the vectorized historical business data with similarity greater than or equal to the preset similarity threshold to obtain relevant historical business data. The historical business requirements in the relevant historical business data are relevant historical business requirements, and the defect records therein are relevant defect records.
[0148] Illustrative example:
[0149] The vector database includes:
[0150] Historical business requirement 1: "The user login function must support login via both email and mobile phone number.", corresponding vector: [0.2, 0.4, 0.6,...];
[0151] Historical business requirement 2: "The user registration function must support registration via email, and a verification email should be sent after successful registration.", corresponding vector: [0.1, 0.3, 0.5,...];
[0152] Defect record 1: "When the user registers, the email verification email is not sent.", corresponding vector: [0.1, 0.2, 0.4,...];
[0153] Defect record 2: "When the user logs in, the system prompts login failure after entering the correct mobile phone number and password.", corresponding vector: [0.3, 0.5, 0.7,...].
[0154] The current business requirement entered by the user is: "The user registration function must support registration via both email and mobile phone number, and a welcome email should be sent after successful registration.", corresponding vector: [0.1, 0.3, 0.5,...].
[0155] Calculate the similarity, and the results are as follows:
[0156] Current business requirement vs historical business requirement 1: 0.75;
[0157] Current business requirements vs historical business requirements 2: 0.95;
[0158] Current business requirements vs defect records 1: 0.85;
[0159] Current business requirements vs defect records 2: 0.60.
[0160] The preset similarity threshold is 0.8. Defect record 2 is filtered out, and historical business requirement 1, historical business requirement 2, and defect record 1 are retained as relevant historical business data. Among them, historical business requirement 1 and historical business requirement 2 are relevant historical business requirements, and defect record 1 is a relevant defect record.
[0161] As an optional implementation method, a test case framework to be reviewed is generated based on the relevant historical business data, including:
[0162] S501. Determine the test scenarios according to the relevant historical business data.
[0163] S502. Generate test points corresponding to each test scenario.
[0164] S503. For each test point, generate the corresponding preconditions, test steps, expected results, and priorities, and combine them into a test case framework to be reviewed.
[0165] A complete test case framework usually includes the following parts:
[0166] (1) Test scenario: Describe the specific situation of the test.
[0167] (2) Test point: Specific test items for each scenario.
[0168] (3) Preconditions: Conditions that need to be met before executing the test.
[0169] (4) Test steps: Describe in detail the execution steps of the test.
[0170] (5) Expected results: The correct results that the system should produce under the input data and execution conditions.
[0171] (6) Priority: The importance level of the test case (such as high, medium, low).
[0172] The test case framework to be reviewed can be generated by an AI large model or a template engine. When generating the test case framework to be reviewed, first determine the main scenarios to be tested according to the relevant historical business data (relevant historical business requirements and relevant defect records), and this process can be intelligently identified by the large model.
[0173] For example, for the new requirement "The user registration function must support registration via email and mobile phone number, and a welcome email should be sent after successful registration.", extract the following scenarios:
[0174] Scenario 1: The user registers via email.
[0175] Scenario 2: The user registers via mobile phone number.
[0176] Scenario 3: A welcome email is sent after successful registration.
[0177] After that, for each scenario, list the specific test points to be verified:
[0178] For example:
[0179] Scenario 1: The user registers via email
[0180] Test point 1: Verify whether the email format is correct.
[0181] Test point 2: Verify whether the email has been registered.
[0182] Test point 3: Verify whether the welcome page is redirected after successful registration.
[0183] Scenario 2: The user registers via mobile phone number
[0184] Test point 1: Verify whether the mobile phone number format is correct.
[0185] Test point 2: Verify whether the mobile phone number has been registered.
[0186] Test point 3: Verify whether the welcome page is redirected after successful registration.
[0187] Scenario 3: A welcome email is sent after successful registration
[0188] Test point 1: Verify whether the welcome email is sent.
[0189] Test point 2: Verify whether the email content is correct.
[0190] Test point 3: Verify whether the email is sent to the correct email address.
[0191] For each test point in the test scenarios, determine the preconditions, test steps, expected results, and priorities, so as to organize these conditions into a structured test case framework. For example:
[0192] **Test point 1**: Verify whether the email format is correct.
[0193] - Preconditions: None.
[0194] - Test steps:
[0195] 1. Open the registration page.
[0196] 2. Enter a correctly formatted email address (e.g., test@example.com).
[0197] 3. Click the "Register" button.
[0198] - Expected result: The system accepts the email address and proceeds to the next step.
[0199] - Priority: High.
[0200] - **Test Point 2**: Verify whether the email address has been registered.
[0201] - Precondition: The email address test@example.com has been registered.
[0202] - Test steps:
[0203] 1. Open the registration page.
[0204] 2. Enter the registered email address (e.g., test@example.com).
[0205] 3. Click the "Register" button.
[0206] - Expected result: The system prompts "This email address has been registered".
[0207] - Priority: Medium.
[0208] An embodiment of the present invention also provides a test case generation system. Figure 6 It is a structural schematic diagram of the test case generation system provided by the embodiment of the present invention, as Figure 6 shown, including:
[0209] A data acquisition module 100, configured to acquire initial historical service data.
[0210] For a certain project, there are various data related to the project, such as business requirements, historical test cases, defect records, etc. These data are the basis for subsequent data processing, that is, raw data.
[0211] Business requirements refer to the business goals, functional requirements, and user requirements proposed by enterprises or customers. For example: The user login function must support login through both email address and mobile phone number.
[0212] Historical test cases refer to the test plans written for aspects such as the functions, performance, and security of a system or product, and the test cases that have been executed in the past.
[0213] Defect records refer to the problems found in the system or product during the test process, and the documents for tracking and management.
[0214] The original data has problems such as redundancy and duplication. To address these issues, the original data can be cleaned to ensure that the data is more representative.
[0215] As an alternative implementation, intelligent data cleaning techniques of machine learning can be adopted to perform semantic analysis on the collected original data using a natural language processing (NLP) model. By identifying similar or duplicate content, duplicates are automatically removed and the most representative data is retained. At the same time, combined with context understanding, it is ensured that key information is not accidentally deleted during the cleaning process, and initial historical business data is obtained. For example, among the collected business requirements, there may be multiple requirements with similar descriptions (such as "user login function" and "user login function via email"). After analyzing the semantics through the NLP model, the similarity of these requirements is identified, and duplicates are automatically removed, retaining the most representative requirement description (such as "the user login function must support login via both email and mobile phone").
[0216] To improve the data coverage, as an alternative implementation, by analyzing the generation effect of historical test cases and the actual test results, the weights of different data sources (such as business requirements, defect records, etc.) in the preprocessing are automatically adjusted. For example, if a certain business requirement is not fully covered in multiple tests, the system will automatically increase its weight to ensure more attention in subsequent test case generation.
[0217] The data preprocessing module 200 is used to perform data preprocessing on the initial historical business data to obtain processed historical business data.
[0218] To improve the data quality and ensure the accuracy of subsequent retrieval, it is necessary to perform preprocessing on the initial historical business data after obtaining it, and processed historical business data is obtained after preprocessing.
[0219] The preprocessing includes: data cleaning, formatting, and data splitting.
[0220] The data cleaning includes:
[0221] 1) Removing noise data: Using regular expressions or rule engines to filter out irrelevant characters (such as special symbols, garbled codes, etc.); Identifying and removing meaningless text (such as advertising content, unconcerned annotations, etc.) through NLP technology.
[0222] 2) Duplicate removal processing: Using semantic similarity algorithms (such as cosine similarity, Jaccard similarity) or pre-training to calculate the similarity between texts. Set a similarity threshold (such as 0.9), and consider data with a similarity higher than the threshold as duplicate data, and retain the most representative one among the duplicate data.
[0223] 3) Error correction: Use a spelling checker (such as PySpellChecker) to correct spelling mistakes in the text. Correct inconsistent term usage through a rule engine or a domain dictionary.
[0224] 4) Missing value handling: For missing fields, fill in default values based on the context or historical data. If the missing values cannot be filled, mark them as "unknown" or directly remove them.
[0225] The main task of formatting the data is to convert the cleaned data into a unified format for subsequent processing and analysis, which includes:
[0226] 1) Unify text format: Convert all text to lowercase or uppercase to ensure consistency; use regular expressions or NLP tools to unify the formats of dates, times, numbers, etc. For example, when unifying the time format, modify the business requirement "The user login function must be completed before 2025 / 1 / 01" to "The user login function must be completed before 2025-01-01".
[0227] 2) Structured data: Convert unstructured data (such as free text) into structured data (such as JSON, XML); use templates or rule engines to extract key fields (such as requirement descriptions, defect steps, expected results, etc.).
[0228] For example, the original text: "Defect description: User login failed. Steps: 1. Open the login page; 2. Enter the mobile phone number and password; 3. Click the login button. Expected result: Login successful. Actual result: Login failed."
[0229] After structuring, the following content is obtained:
[0230] {
[0231] "Defect description": "User login failed",
[0232] "Steps":
[0233] "Open the login page",
[0234] "Enter the mobile phone number and password",
[0235] "Click the login button"
[0236] ,
[0237] "Expected result": "Login successful",
[0238] "Actual result": "Login failed"
[0239] }
[0240] 3) Data segmentation: Split the long text into smaller semantic units (such as sentences, paragraphs). This process uses NLP tools (such as sentence segmentation models) to ensure the accuracy of chunking.
[0241] For example, the original text: "The user login function must support login via both email and mobile phone. After successful login, it should redirect to the user's personal homepage." After data segmentation, the following content is obtained:
[0243] "The user login function must support login via both email and mobile phone.",
[0244] "After successful login, it should redirect to the user's personal homepage."
[0245] .
[0246] The vector database building module 300 is used to convert the processed historical business data into vector form to obtain vectorized historical business data, and store the vectorized historical business data in the vector database.
[0247] The processed historical business data is converted into vector form through a specific vectorization method, and the converted vectorized historical business data is stored in the vector database. Among them, the vectorized historical business data can be stored in a structured format (such as NumPy array, CSV file or database) for subsequent calls by the AI large model.
[0248] The matching module 400 is used to, when receiving the current business requirement input by the user, match the relevant vectorized historical business data in the vector database according to the current business requirement, and determine the matched vectorized historical business data as the relevant historical business data.
[0249] The user manually inputs a new business requirement as the current business requirement. This is usually a text describing the function or requirement, which may include specific business goals, operation processes, expected system responses, etc.
[0250] AI large models (such as pre-trained language models like BERT, GPT, Transformer, etc.) are used to perform vectorization processing on the current business requirement, that is, convert the user's input into vector form. Then, calculate the similarity between the vectorized current business requirement and the vectorized historical business data stored in the vector database, and find the vectorized historical business data with a higher similarity as the relevant historical business data.
[0251] The review module 500 is used to generate a test case framework to be reviewed based on the relevant historical business data, review the test case framework to be reviewed. If the review fails, update the test case framework to be reviewed according to the review opinions; if the review passes, generate test cases according to the test case framework to be reviewed.
[0252] Generate a test case framework to be reviewed based on relevant historical business data. This framework includes scenarios to be tested, test points, steps, priorities, etc. This step can be implemented through an AI large model combined with a vector database, or through a template engine. The following is an example of a test case framework:
[0253] Scenario 1: User registers via email
[0254] **Test Point 1**: Verify whether the email format is correct.
[0255] - Precondition: None.
[0256] - Test steps:
[0257] 1. Open the registration page.
[0258] 2. Enter a correctly formatted email (e.g., test@example.com).
[0259] 3. Click the "Register" button.
[0260] - Expected result: The system accepts the email and proceeds to the next step.
[0261] - Priority: High.
[0262] After generating the test case framework to be reviewed, it needs to be reviewed by manual or automated review software set based on experience (such as models obtained from training historical test case frameworks, etc.) to check whether it comprehensively and accurately reflects the new requirements and the situation of historical business data.
[0263] As an optional implementation method, the review content includes: integrity review, accuracy review, executability review, priority rationality review, and consistency review.
[0264] Integrity review: Whether the test case framework covers all key scenarios and test points. Specifically, judge whether all function points of the new requirements are covered; whether boundary conditions and abnormal scenarios are considered; whether the scenarios related to historical high-frequency bugs are covered.
[0265] Accuracy review: Whether the description of the test case is accurate. Specifically, judge whether the test steps are clear and unambiguous; whether the expected results meet the requirement definition; whether the preconditions are reasonable and necessary.
[0266] Executability review: Whether the test case is easy to execute. Specifically, judge whether the test steps are specific and operable; whether additional test data or environment configurations are required; whether overly complex or redundant steps are avoided.
[0267] Priority Rationality Review: Check whether the priorities of test cases are reasonable. Specifically, determine whether high-priority test cases cover core functions; whether medium- and low-priority test cases cover secondary functions or edge scenarios.
[0268] Consistency Review: Check whether the test case framework is consistent with the requirements document and historical data. Specifically, determine whether the test cases are consistent with the current business requirements description; whether historical business data is referenced.
[0269] If the test case framework to be reviewed passes the review, detailed test cases are generated based on this test case framework. If it fails the review, the reviewer can give specific review comments and feedback them to the AI large model, enabling it to modify the test case framework to be reviewed according to this comment until it passes the review.
[0270] As an optional implementation method, generating detailed test cases based on the test case framework includes:
[0271] 1. Refine test steps: Further refine the test steps in the framework to ensure that each step is specific and operable.
[0272] For example:
[0273] Step in the framework: "Enter a correctly formatted email (such as test@example.com)";
[0274] Refined step: Enter test@example.com in the email input box.
[0275] 2. Supplement test data: Provide specific test data for each test case.
[0276] For example: Email: test@example.com; Mobile phone number: 13800138000; Password: Test@1234.
[0277] 3. Define expected results: Ensure that the expected results are specific and verifiable.
[0278] For example: Expected result in the framework: "The system accepts the email and proceeds to the next step";
[0279] Refined expected result: "The page jumps to the verification code input page, and a prompt message 'Verification code has been sent to test@example.com' is displayed."
[0280] 4. Generate detailed test cases: Organize the refined test steps, test data, and expected results into detailed test cases.
[0281] Then, for test point 1 of the above test case framework, the detailed test cases are generated as follows:
[0282] Test Scenario 1: User registers via email
[0283] - **Test Point 1**: Verify whether the email format is correct.
[0284] - Prerequisite: None.
[0285] - Test Steps:
[0286] 1. Open the registration page.
[0287] 2. Enter test@example.com in the email input box.
[0288] 3. Click the "Register" button.
[0289] - Expected Result: The page jumps to the verification code input page and displays the prompt message "Verification code has been sent to test@example.com".
[0290] - Priority: High.
[0291] If the test case framework fails the review, the framework needs to be adjusted and optimized. Analyze the review comments to identify the problems in the framework and optimize according to the specific problems. For example, after manual review, the review comment is to optimize the original test point "Verify whether the email format is correct" to "Verify whether the email format is correct, including complex formats such as with dots and plus signs", then the adjusted test case framework to be reviewed is as follows:
[0292] Test Scenario 1: User registers via email
[0293] - **Test Point 1**: Verify whether the email format is correct, including complex formats such as with dots and plus signs.
[0294] - Prerequisite: None.
[0295] - Test Steps:
[0296] 1. Open the registration page.
[0297] 2. Enter (such as test@example.com) in the email input box.
[0298] 3. Click the "Register" button.
[0299] - Expected Result: The system accepts the email and proceeds to the next step.
[0300] - Priority: High.
[0301] As an alternative implementation, the vector database building module 300 includes:
[0302] The text extraction sub-module 3001 is used to take the historical business requirements and defect records in the processed historical business data as description texts respectively.
[0303] Historical business requirements: Organize the text descriptions of all business requirements.
[0304] Defect records: Organize the text descriptions of all bug records, including defect descriptions, reproduction steps, expected results, actual results, etc.
[0305] Take these two types of data as the basis for data processing to facilitate subsequent vectorization processing.
[0306] The text processing sub-module 3002 is used to perform word segmentation processing and stop word processing on each description text to obtain the processed description text.
[0307] Perform word segmentation processing on the description text. Word segmentation means dividing the text into smaller semantic units.
[0308] Perform stop word processing on the description text. Stop words refer to words that appear very frequently in text analysis but have no actual meaning for analysis (such as "de", "shi", "zai", etc.). Remove these words to reduce the amount of data processing.
[0309] After the description text undergoes the above two processes, the processed description text is obtained.
[0310] The vectorization sub-module 3003 is used to calculate the TF-IDF value of each word in the processed description text, and calculate the TF-IDF vector corresponding to the processed description text based on all TF-IDF values.
[0311] TF-IDF (Term Frequency-Inverse Document Frequency) is a commonly used text feature extraction method, which is used to measure the importance of each word in the processed description text. This method comprehensively considers the term frequency and the rarity of the word in the entire corpus, and can assign an importance weight to each word, that is, the TF-IDF value.
[0312] The TF-IDF values of all words in each processed description text form the TF-IDF vector of this text, and this vector is used to represent the features of the text.
[0313] As an optional implementation manner, the matching module 400 includes:
[0314] The requirement processing sub-module 4001 is used to perform word segmentation processing and stop word processing on the current business requirement to obtain the processed business requirement.
[0315] Perform data preprocessing on the current business requirement using the same word segmentation processing method and stop word processing method as the historical business requirement to obtain the processed business requirement. Input the processed business requirement into the AI large model.
[0316] The vector conversion sub-module 4002 is used to convert the processed business requirements into vectorized business requirements through the AI large model.
[0317] The AI large model converts the new business requirements into high-dimensional vectors (Embedding) to obtain vectorized business requirements. The vector conversion method here should be consistent with the conversion method of the above-described text.
[0318] The matching sub-module 4003 is used to match the TF-IDF vectors of relevant historical business requirements and the TF-IDF vectors of relevant defect records from the vector database according to the vectorized business requirements through the AI large model, and use the TF-IDF vectors of relevant historical business requirements and the TF-IDF vectors of relevant defect records as relevant historical business data.
[0319] Match the vectorized business requirements with the vectorized historical business requirements and defect records in the vector database to obtain historical business requirements and defect records with high similarity, and use them as relevant historical business data.
[0320] As an optional implementation manner, the matching sub-module 4003 includes:
[0321] The similarity calculation unit 40031 is used to calculate the similarity between the vectorized business requirements and all vectorized historical business data in the vector database.
[0322] Calculate the similarity between the vectorized business requirements and all vectorized historical business data in the vector database. The vectorized historical business data includes vectorized historical business requirements and vectorized defect records.
[0323] As an optional implementation manner, the cosine similarity method is used to calculate the similarity between two vectors.
[0324] Cosine similarity = (A·B) / (||A||*||B||), where A and B are two vectors.
[0325] The filtering unit 40032 is used to filter out the vectorized historical business data with corresponding similarity lower than the preset similarity threshold from all vectorized historical business data to obtain relevant historical business data; among them, the historical business requirements in the relevant historical business data are relevant historical business requirements, and the defect records in the relevant historical business data are relevant defect records.
[0326] Set a similarity threshold in advance, that is, a preset similarity threshold. Filter out the vectorized historical business data with a similarity lower than the preset similarity threshold. Retain the vectorized historical business data greater than or equal to the preset similarity threshold to obtain relevant historical business data. The historical business requirements in the relevant historical business data are relevant historical business requirements, and the defect records therein are relevant defect records.
[0327] Illustrate with an example:
[0328] The vector database includes:
[0329] Historical business requirement 1: "The user login function must support login via both email and mobile phone number.", corresponding vector: [0.2, 0.4, 0.6,...];
[0330] Historical business requirement 2: "The user registration function must support registration via email, and a verification email should be sent after successful registration.", corresponding vector: [0.1, 0.3, 0.5,...];
[0331] Defect record 1: "When the user registers, the email verification email is not sent.", corresponding vector: [0.1, 0.2, 0.4,...];
[0332] Defect record 2: "When the user logs in, the system prompts login failure after entering the correct mobile phone number and password.", corresponding vector: [0.3, 0.5, 0.7,...].
[0333] The current business requirement entered by the user is: "The user registration function must support registration via both email and mobile phone number, and a welcome email should be sent after successful registration.", corresponding vector: [0.1, 0.3, 0.5,...].
[0334] Calculate the similarity, and the results are as follows:
[0335] Current business requirement vs historical business requirement 1: 0.75;
[0336] Current business requirement vs historical business requirement 2: 0.95;
[0337] Current business requirement vs defect record 1: 0.85;
[0338] Current business requirement vs defect record 2: 0.60.
[0339] The preset similarity threshold is 0.8. Filter out defect record 2, and retain historical business requirement 1, historical business requirement 2, and defect record 1 as relevant historical business data. Among them, historical business requirement 1 and historical business requirement 2 are relevant historical business requirements, and defect record 1 is a relevant defect record.
[0340] As an alternative implementation, the audit module 500 includes:
[0341] A scenario determination sub-module 5001 for determining a test scenario based on relevant historical business data.
[0342] A test point generation sub-module 5002 for generating test points corresponding to each test scenario.
[0343] A framework generation sub-module 5003 for generating corresponding preconditions, test steps, expected results, and priorities for each test point and combining them into a test case framework to be audited.
[0344] A complete test case framework typically includes the following parts:
[0345] (1) Test scenario: Describes the specific context of the test.
[0346] (2) Test point: Specific test items for each scenario.
[0347] (3) Precondition: Conditions that need to be met before executing the test.
[0348] (4) Test steps: Describe in detail the execution steps of the test.
[0349] (5) Expected result: The correct result that the system should produce under the input data and execution conditions.
[0350] (6) Priority: The importance level of the test case (such as high, medium, low).
[0351] The test case framework to be audited can be generated through an AI large model or a template engine. When generating the test case framework to be audited, first determine the main scenarios to be tested based on relevant historical business data (relevant historical business requirements and relevant defect records), and this process can be intelligently identified through the large model.
[0352] For example, for the new requirement "The user registration function must support registration through both email and mobile phone numbers, and a welcome email should be sent after successful registration.", the following scenarios are extracted:
[0353] Scenario 1: The user registers through email.
[0354] Scenario 2: The user registers through mobile phone number.
[0355] Scenario 3: A welcome email is sent after successful registration.
[0356] After that, for each scenario, list the specific test points to be verified:
[0357] For example:
[0358] Scenario 1: The user registers through email
[0359] Test Point 1: Verify whether the email format is correct.
[0360] Test Point 2: Verify whether the email has been registered.
[0361] Test Point 3: Verify whether it jumps to the welcome page after successful registration.
[0362] Scenario 2: The user registers by mobile phone
[0363] Test Point 1: Verify whether the mobile phone number format is correct.
[0364] Test Point 2: Verify whether the mobile phone number has been registered.
[0365] Test Point 3: Verify whether it jumps to the welcome page after successful registration.
[0366] Scenario 3: Send a welcome email after successful registration
[0367] Test Point 1: Verify whether a welcome email is sent.
[0368] Test Point 2: Verify whether the email content is correct.
[0369] Test Point 3: Verify whether the email is sent to the correct email address.
[0370] Determine the preconditions, test steps, expected results, and priorities for the test points in each test scenario, and thus organize these conditions into a structured test case framework. For example:
[0371] **Test Point 1**: Verify whether the email format is correct.
[0372] - Precondition: None.
[0373] - Test Steps:
[0374] 1. Open the registration page.
[0375] 2. Enter a correctly formatted email (such as test@example.com).
[0376] 3. Click the "Register" button.
[0377] - Expected Result: The system accepts the email and proceeds to the next step.
[0378] - Priority: High.
[0379] - **Test Point 2**: Verify whether the email has been registered.
[0380] - Precondition: The email test@example.com has been registered.
[0381] -Testing steps:
[0382] 1. Open the registration page.
[0383] 2. Enter the registered email address (such as test@example.com).
[0384] 3. Click on the 'Register' button.
[0385] -Expected result: The system prompts "This email address has been registered."
[0386] -Priority: Medium.
[0387] The above technical solution has the following beneficial effects: by extracting historical business data and establishing a corresponding vector database, the AI big model can quickly call and identify the data therein to generate test cases, thereby improving the efficiency of test case writing; the AI big model can intelligently extract relevant historical business data based on the input new business needs, ensuring that the generated test cases are more targeted and improving the effectiveness of the test cases; setting audit nodes to timely adjust and optimize test cases, and improving the final output test cases to meet actual needs, thereby improving the reliability of the test; in addition, the AI big model can generate test cases in a targeted manner based on defect records, reduce the occurrence rate of bugs, and improve the quality of test cases.
[0388] The specific implementation methods of the above invention further illustrate the objectives, technical solutions and beneficial effects of the present invention in detail. It should be understood that the above content is only the specific implementation methods of the present invention and is not intended to limit the protection scope of the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the protection scope of the present invention.
Claims
1. A test case generation method, characterized in that: include: Obtain initial historical business data; Performing data preprocessing on the initial historical business data to obtain processed historical business data; Converting the processed historical business data into vector form to obtain vectorized historical business data, and storing the vectorized historical business data in a vector database; When receiving the current business demand input by the user, matching the relevant vectorized historical business data in the vector database through the AI big model according to the current business demand, and determining that the matched vectorized historical business data is the relevant historical business data; Generate a test case framework to be reviewed based on relevant historical business data, review the test case framework to be reviewed, and if it fails the review, update the test case framework to be reviewed based on the review opinion; If the review is passed, a test case is generated according to the test case framework to be reviewed.
2. The test case generation method according to claim 1, characterized in that: The converting the processed historical business data into a vector form includes: Using the historical business requirements and defect records in the processing historical business data as description texts respectively; Perform word segmentation and stop word processing on each description text to obtain a processed description text; The TF-IDF value of each word in the processing description text is calculated, and the TF-IDF vector corresponding to the processing description text is obtained according to all the TF-IDF values.
3. The test case generation method according to claim 2, characterized in that: The matching of relevant vectorized historical business data in the vector database by using the AI big model according to the current business demand, and determining that the matched vectorized historical business data is relevant historical business data, includes: Perform word segmentation and stop word processing on the current business demand to obtain the processing business demand; Convert the processing business requirements into vectorized business requirements through the AI big model; Through the AI big model, the TF-IDF vectors of relevant historical business needs and the TF-IDF vectors of relevant defect records are matched from the vector database according to the vectorized business needs, and the TF-IDF vectors of relevant historical business needs and the TF-IDF vectors of relevant defect records are used as relevant historical business data.
4. The test case generation method according to claim 3, characterized in that: The matching of the TF-IDF vector of the relevant historical business demand and the TF-IDF vector of the relevant defect record from the vector database according to the vectorized business demand, and taking the TF-IDF vector of the relevant historical business demand and the TF-IDF vector of the relevant defect record as the relevant historical business data, includes: Calculating the similarity between the vectorized business demand and all vectorized historical business data in the vector database; From all the vectorized historical business data, the vectorized historical business data whose corresponding similarity is lower than a preset similarity threshold is filtered out to obtain relevant historical business data; wherein, the historical business needs in the relevant historical business data are relevant historical business needs, and the defect records in the relevant historical business data are relevant defect records.
5. The test case generation method according to claim 4, characterized in that: The generating of a test case framework to be reviewed according to the relevant historical business data includes: Determine a test scenario based on the relevant historical business data; Generate test points corresponding to each test scenario; For each test point, the corresponding preconditions, test steps, expected results and priorities are generated and combined into a test case framework to be reviewed.
6. A test case generation system, characterized in that: include: A data acquisition module is used to acquire initial historical business data; A data preprocessing module, used to perform data preprocessing on the initial historical business data to obtain processed historical business data; A vector database establishment module, used for converting the processed historical business data into vector form to obtain vectorized historical business data, and storing the vectorized historical business data in a vector database; A matching module, for, when receiving a current business requirement input by a user, matching relevant vectorized historical business data in the vector database through an AI big model according to the current business requirement, and determining that the matched vectorized historical business data is relevant historical business data; The audit module is used to generate a test case framework to be audited based on the relevant historical business data, and audit the test case framework to be audited. If it fails the audit, the test case framework to be audited is updated according to the audit opinion; if it passes the audit, a test case is generated according to the test case framework to be audited.
7. The test case generation system according to claim 6, characterized in that: The vector database establishment module includes: A text extraction submodule, used to use the historical business requirements and defect records in the processing historical business data as description texts respectively; The text processing submodule is used to perform word segmentation and stop word processing on each description text to obtain a processed description text; The vectorization submodule is used to calculate the TF-IDF value of each word in the processing description text, and obtain the TF-IDF vector corresponding to the processing description text according to all TF-IDF values.
8. The test case generation system according to claim 7, characterized in that: The matching module comprises: The demand processing submodule is used to perform word segmentation and stop word processing on the current business demand to obtain the processed business demand; A vector conversion submodule, used to convert the processing business requirements into vectorized business requirements through the AI big model; A matching submodule is used to match the TF-IDF vectors of relevant historical business requirements and the TF-IDF vectors of relevant defect records from the vector database according to the vectorized business requirements through the AI big model, and use the TF-IDF vectors of relevant historical business requirements and the TF-IDF vectors of relevant defect records as relevant historical business data.
9. The test case generation system according to claim 8, characterized in that: The matching submodule includes: A similarity calculation unit, used to calculate the similarity between the vectorized business demand and all vectorized historical business data in the vector database; A filtering unit is used to filter out the vectorized historical business data whose corresponding similarity is lower than a preset similarity threshold from all the vectorized historical business data, so as to obtain relevant historical business data; wherein, the historical business requirements in the relevant historical business data are relevant historical business requirements, and the defect records in the relevant historical business data are relevant defect records.
10. The test case generation system according to claim 9, characterized in that: The audit module includes: A scenario determination submodule, used to determine a test scenario based on the relevant historical business data; A test point generation submodule is used to generate test points corresponding to each test scenario; The framework generation submodule is used to generate corresponding preconditions, test steps, expected results and priorities for each test point, and combine them into a test case framework to be reviewed.