CN114595158A - Test case generation method, device, equipment and medium based on artificial intelligence - Google Patents

Test case generation method, device, equipment and medium based on artificial intelligence Download PDF

Info

Publication number
CN114595158A
CN114595158A CN202210281718.7A CN202210281718A CN114595158A CN 114595158 A CN114595158 A CN 114595158A CN 202210281718 A CN202210281718 A CN 202210281718A CN 114595158 A CN114595158 A CN 114595158A
Authority
CN
China
Prior art keywords
test case
keyword
target
keywords
scoring
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210281718.7A
Other languages
Chinese (zh)
Inventor
王雪霏
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An Securities Co Ltd
Original Assignee
Ping An Securities Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ping An Securities Co Ltd filed Critical Ping An Securities Co Ltd
Priority to CN202210281718.7A priority Critical patent/CN114595158A/en
Publication of CN114595158A publication Critical patent/CN114595158A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3684Test management for test design, e.g. generating new test cases
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3676Test management for coverage analysis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/368Test management for test version control, e.g. updating test cases to a new software version
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/044Recurrent networks, e.g. Hopfield networks

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Quality & Reliability (AREA)
  • Computer Hardware Design (AREA)
  • General Health & Medical Sciences (AREA)
  • Biomedical Technology (AREA)
  • Evolutionary Computation (AREA)
  • Computational Linguistics (AREA)
  • Molecular Biology (AREA)
  • Computing Systems (AREA)
  • Biophysics (AREA)
  • Data Mining & Analysis (AREA)
  • Mathematical Physics (AREA)
  • Software Systems (AREA)
  • Artificial Intelligence (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Health & Medical Sciences (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application relates to the technical field of artificial intelligence, and discloses a test case generation method, a device, equipment and a medium based on artificial intelligence, wherein the method comprises the following steps: acquiring a requirement document; extracting keywords from the requirement document to obtain a candidate keyword set; screening the keywords of the candidate keyword set to obtain a target keyword set; performing test case matching according to the target keyword set and a preset general test case library to obtain a hit test case set; and updating the hit test case set according to the target keyword set to obtain a target test case set. Therefore, the target test case set required by the required document is automatically determined, the target test case set is determined by adopting a unified standard, the accuracy of the determined target test case set is improved, and the coverage of the determined target test case set is improved.

Description

Test case generation method, device, equipment and medium based on artificial intelligence
Technical Field
The present application relates to the field of artificial intelligence technologies, and in particular, to a method, an apparatus, a device, and a medium for generating a test case based on artificial intelligence.
Background
The test plays an important role in ensuring the quality in the development of a software system, and the design of a test case is an important link in the test execution process. Conventionally, design test cases need to be accumulated manually according to experience, and the execution range of a regression case needs to be determined in the version upgrading process. The existing method depends on experience of testers and grasp of a business process in an implementation process, and in a manual design process, the accuracy and the coverage of a determined test case are low due to insufficient scene coverage and non-uniform scene subdivision dimension standards.
Disclosure of Invention
The application mainly aims to provide a test case generation method, a test case generation device, test case generation equipment and a test case generation medium based on artificial intelligence, and aims to solve the technical problems that in the design of test cases in the prior art, the accuracy of the determined test cases is not sufficient and the coverage is not high.
In order to achieve the above object, the present application provides a test case generation method based on artificial intelligence, including:
acquiring a requirement document;
extracting keywords from the requirement document to obtain a candidate keyword set;
screening the keywords of the candidate keyword set to obtain a target keyword set;
performing test case matching according to the target keyword set and a preset general test case library to obtain a hit test case set;
and updating the hit test case set according to the target keyword set to obtain a target test case set.
Further, the step of extracting the keywords from the requirement document to obtain a candidate keyword set includes:
inputting the requirement document into a preset keyword extraction model for extracting the keywords, and taking each extracted keyword as the candidate keyword set;
the keyword extraction model is a model obtained based on bidirectional LSTM model training.
Further, the step of performing the keyword screening on the candidate keyword set to obtain a target keyword set includes:
scoring each keyword in the candidate keyword set by adopting a preset keyword scoring rule to obtain a keyword scoring result;
sorting the grading results of the keywords in a reverse order;
extracting a preset number of keyword scoring results from the ranked keyword scoring results in a mode of extracting from the beginning to obtain a target scoring result set;
further, the step of scoring each keyword in the candidate keyword set by using a preset keyword scoring rule to obtain a keyword scoring result includes:
performing part-of-speech score matching on each keyword in the candidate keyword set in a preset part-of-speech score library to obtain a keyword part-of-speech score;
according to the requirement document, determining the attribution function of each keyword in the candidate keyword set;
performing function weight matching on the attribution function corresponding to each keyword in a function weight list corresponding to the requirement document to obtain keyword function weight;
and multiplying the part-of-speech scores of the keywords corresponding to the same keyword by the function weight of the keywords to obtain a scoring result of the keywords.
Further, the step of performing test case matching according to the target keyword set and a preset general test case library to obtain a hit test case set includes:
determining a keyword combination from the target keyword set;
searching in each scene combination of the universal test case library by adopting each keyword combination;
if the search is successful, taking the test case corresponding to the searched scene combination as a hit test case;
and taking each hit test case as the hit test case set.
Further, the step of updating the hit test case set according to the target keyword set to obtain a target test case set includes:
taking any one test case in the hit test case set as a case to be replaced;
adopting the keyword combination corresponding to the case to be replaced to replace the information of the case to be replaced to obtain a first test case;
replacing the first test case by adopting the product information corresponding to the requirement document to obtain a second test case;
and determining the target test case set according to each second test case.
Further, after the step of updating the hit test case set according to the target keyword set to obtain the target test case set, the method further includes:
taking any one test case in the target test case set as a case to be analyzed;
combining the keywords corresponding to the cases to be analyzed to serve as combinations to be calculated;
adding the scoring results of the keywords corresponding to the combination to be calculated to obtain case scores;
and determining the case priority of each test case in the target test case set according to the case scores.
The application also provides a test case generation device based on artificial intelligence, the device includes:
the data acquisition module is used for acquiring a requirement document;
the keyword extraction module is used for extracting keywords from the requirement document to obtain a candidate keyword set;
the keyword screening module is used for screening the keywords of the candidate keyword set to obtain a target keyword set;
the test case matching module is used for matching test cases according to the target keyword set and a preset general test case library to obtain a hit test case set;
and the target test case set determining module is used for updating the hit test case set according to the target keyword set to obtain the target test case set.
The present application further proposes a computer device comprising a memory and a processor, the memory storing a computer program, the processor implementing the steps of any of the above methods when executing the computer program.
The present application also proposes a computer-readable storage medium having stored thereon a computer program which, when being executed by a processor, carries out the steps of the method of any of the above.
According to the test case generation method, device, equipment and medium based on artificial intelligence, the method obtains a candidate keyword set by extracting keywords from the requirement document; screening the keywords of the candidate keyword set to obtain a target keyword set; performing test case matching according to the target keyword set and a preset general test case library to obtain a hit test case set; and updating the hit test case set according to the target keyword set to obtain a target test case set. The method comprises the steps of conducting test case matching on a universal test case library according to a target keyword set extracted from a requirement document, then updating the matched test cases, automatically determining the target test case set required by the requirement document, determining the target test case set by adopting a unified standard, improving the accuracy of the determined target test case set and improving the coverage of the determined target test case set.
Drawings
Fig. 1 is a schematic flowchart of a test case generation method based on artificial intelligence according to an embodiment of the present application;
fig. 2 is a schematic block diagram of a structure of an artificial intelligence-based test case generation apparatus according to an embodiment of the present application;
fig. 3 is a block diagram illustrating a structure of a computer device according to an embodiment of the present application.
The implementation, functional features and advantages of the objectives of the present application will be further explained with reference to the accompanying drawings.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
Referring to fig. 1, an embodiment of the present application provides a test case generation method based on artificial intelligence, where the method includes:
s1: acquiring a requirement document;
s2: extracting keywords from the requirement document to obtain a candidate keyword set;
s3: performing the keyword screening on the candidate keyword set to obtain a target keyword set;
s4: performing test case matching according to the target keyword set and a preset general test case library to obtain a hit test case set;
s5: and updating the hit test case set according to the target keyword set to obtain a target test case set.
According to the embodiment, the target test case set required by the requirement document is automatically determined by performing test case matching on the general test case library according to the target keyword set extracted from the requirement document and then updating the matched test case, and the target test case set is determined by adopting a unified standard, so that the accuracy of the determined target test case set is improved, and the coverage of the determined target test case set is improved.
For S1, the requirement document input by the user may be obtained, the requirement document may be obtained from a database, or the requirement document may be obtained from a third-party application.
The requirement document is a description document of the requirement of software development.
For step S2, keyword extraction is performed on the requirement document, and each extracted keyword is used as a candidate keyword set.
It is understood that keywords include, but are not limited to: name, verb.
Optionally, when the present application is applied to a trading system, the keywords include, but are not limited to: product, transaction type, and wind control type.
And S3, generating scores for all keywords in the candidate keyword set, screening the keywords according to the scores corresponding to all the keywords, and taking all the screened keywords as a target keyword set.
And S4, matching the target keyword set in each scene combination of the universal test case library, taking the test case corresponding to the matched scene combination as a hit test case, and taking each hit test case as a hit test case set.
The universal test case library comprises: scene combination and test cases. A scene combination, which is a combination of one or more phrases. The test case is a description of a test task performed on a specific software product, and embodies a test scheme, a method, a technology and a strategy, and the content of the test case comprises a test target, a test environment, input data, a test step, an expected result, a test script and the like, and finally forms a document.
The universal test case library is extracted based on the existing software system.
Optionally, the general test case library is a test case library common to the service scenarios.
And S5, carrying out placeholder replacement on each hit test case in the hit test case set according to the target keyword set, thereby obtaining the test case which accords with the application scene of the requirement document. And taking each hit test case which is subjected to replacement as a target test case set.
In an embodiment, the step of extracting the keyword from the requirement document to obtain the candidate keyword set includes:
s21: inputting the requirement document into a preset keyword extraction model for extracting the keywords, and taking each extracted keyword as the candidate keyword set;
the keyword extraction model is a model obtained based on bidirectional LSTM model training.
According to the method and the device, the keyword extraction is performed by adopting the model obtained based on the bidirectional LSTM model training, and the accuracy and the coverage of the determined keyword are improved.
For S21, the requirement document is input into a preset keyword extraction model for keyword extraction, and each extracted keyword is used as the candidate keyword set, thereby providing a basis for test case matching.
Optionally, a bidirectional LSTM model is used as an initial model; and training the initial model by adopting a plurality of training samples until a preset model training end condition is reached, and taking the initial model reaching the model training end condition as the keyword extraction model.
LSTM, a long-short term memory artificial neural network, is a time-recurrent neural network, and is designed specifically to solve the long-term dependence problem of general RNNs (recurrent neural networks), all RNNs having a chain form of repetitive neural network modules.
The training samples include: a text sample and a set of keyword designations. The text sample is one or more words of a description document of the requirements of software development. The keyword calibration set is a set of accurate keywords in the text sample.
In another embodiment of the present application, a BERT model and conditional random fields are employed as the initial model. The BERT model of the initial model is used for feature extraction, and the conditional random field of the initial model is used for BIO labeling. BIO notation, each element is labeled as any of "B-X", "I-X", "O". Where "B-X" indicates the beginning of a keyword, "I-X" indicates the middle of a keyword, and "O" indicates not belonging to a keyword.
BERT, collectively referred to as Bidirective Encoder retrieval from transformations, is a pre-trained language characterization model.
In an embodiment, the step of performing the keyword screening on the candidate keyword set to obtain the target keyword set includes:
s31: scoring each keyword in the candidate keyword set by adopting a preset keyword scoring rule to obtain a keyword scoring result;
s32: sorting the grading results of the keywords in a reverse order;
s33: extracting a preset number of keyword scoring results from the ranked keyword scoring results in a mode of extracting from the beginning to obtain a target scoring result set;
s34: and taking each keyword corresponding to the target scoring result set as the target keyword set.
According to the embodiment, the keywords are scored firstly, then the scoring results of the keywords in the preset number are extracted from the ranked scoring results of the keywords, and the keywords corresponding to the extracted scoring results of the keywords are used as the target keyword set, so that the keywords which are the most matched are screened out, and the accuracy of the determined target test case set is improved.
And S31, scoring each keyword in the candidate keyword set by adopting a preset keyword scoring rule, and taking data obtained by scoring as a keyword scoring result.
That is, the keyword scoring results correspond one-to-one to the keywords in the candidate keyword set.
For S32, the scoring results of the keywords are sorted in reverse order, so that the scoring results of the keywords are ranked from high to low.
For step S33, a preset number of keyword scoring results are extracted from the ranked keyword scoring results in a manner of extracting from the beginning, and each extracted keyword scoring result is used as a target scoring result set.
When the number of the ranked keyword scoring results is greater than or equal to a preset number, the number of the keyword scoring results in a target scoring result set is equal to the preset number; when the number of the ranked keyword scoring results is smaller than a preset number, the number of the keyword scoring results in a target scoring result set is equal to the preset number;
for S34, the keywords corresponding to the target scoring result set are used as the target keyword set. Thus, a set of keywords that can be used for test case matching is determined.
In an embodiment, the step of scoring each keyword in the candidate keyword set by using a preset keyword scoring rule to obtain a keyword scoring result includes:
s311: performing part-of-speech score matching on each keyword in the candidate keyword set in a preset part-of-speech score library to obtain a keyword part-of-speech score;
s312: according to the requirement document, determining the attribution function of each keyword in the candidate keyword set;
s313: performing function weight matching on the attribution function corresponding to each keyword in a function weight list corresponding to the requirement document to obtain keyword function weight;
s314: and multiplying the part-of-speech scores of the keywords corresponding to the same keyword by the function weight of the keywords to obtain a scoring result of the keywords.
In the embodiment, the part-of-speech score and the attribution function corresponding to the same keyword are multiplied to serve as the keyword scoring result, so that the importance of the keyword in the application and the importance of the attribution function are fully considered, the accuracy of the determined keyword scoring result is improved, and the accuracy of the determined target test case set is improved.
For step S311, each keyword in the candidate keyword set is matched in each phrase in a preset part of speech score library, and a part of speech score corresponding to the matched phrase in the part of speech score library is used as a keyword part of speech score.
The part of speech scoring library comprises: phrases and part-of-speech scores. The part-of-speech score is a score determined according to the part of speech. Part of speech refers to the basis of dividing parts of speech by the characteristics of words. Parts of speech include, but are not limited to: nouns, verbs.
Optionally, the part-of-speech score corresponding to the noun is greater than the part-of-speech score corresponding to the verb.
For S312, the software function corresponding to the segment corresponding to each keyword in the candidate keyword set in the requirement document is used as the attribution function of the keyword.
And S313, performing software function matching on the attribution function corresponding to each keyword in a function weight list corresponding to the requirement document, and taking the function weight corresponding to the matched software function in the function weight list as the keyword function weight.
The list of functional weights includes: software functions and functional weights.
Optionally, the function weight corresponding to the software function related to the business process is greater than the function weight corresponding to the software function unrelated to the business process; the functional weight corresponding to the software function corresponding to the core function of the business process is greater than the functional weight corresponding to the software function corresponding to the non-core function of the business process.
For example, when the application is applied to a transaction system, the function weight corresponding to a normal order, the function weight corresponding to a strategy, the function weight corresponding to an account, the function weight corresponding to a wind control and the function weight corresponding to system setting can be arranged from high to low.
For step S314, the part-of-speech scores of the keywords corresponding to the same keyword are multiplied by the keyword function weights, and the result obtained by the multiplication is used as the keyword score result corresponding to the keyword.
In an embodiment, the step of performing test case matching according to the target keyword set and a preset general test case library to obtain a hit test case set includes:
s41: determining a keyword combination from the target keyword set;
s42: searching in each scene combination of the universal test case library by adopting each keyword combination;
s43: if the search is successful, taking the test case corresponding to the searched scene combination as a hit test case;
s44: and taking each hit test case as the hit test case set.
In the embodiment, the keyword combination determined from the target keyword set is adopted to perform test case matching in the general test case library, so that the coverage of the determined target test case set is improved.
For S41, permutation and combination are performed from the target keyword set, and each combination is taken as a keyword combination.
For example, the keywords in the target keyword set include: a1, A2, A3, A1, A2, A3, A1A2, A1A3, A2A3, and A1A2A3 are all keyword combinations.
For S43, if the search is successful, that is, a scene combination identical to the keyword combination is searched for in each scene combination of the general test case library, and the test case corresponding to the searched scene combination in the general test case library is used as a hit test case.
For S44, each hit test case is used as the hit test case set, so that a target test case set with the widest coverage is determined.
In an embodiment, the step of updating the hit test case set according to the target keyword set to obtain the target test case set includes:
s51: taking any one test case in the hit test case set as a case to be replaced;
s52: adopting the keyword combination corresponding to the case to be replaced to replace the information of the case to be replaced to obtain a first test case;
s53: replacing the first test case by adopting the product information corresponding to the requirement document to obtain a second test case;
s54: and determining the target test case set according to the second test cases.
In this embodiment, the placeholders in the case to be replaced are replaced by adopting the keyword combination, so that the test case of the application scene conforming to the requirement document is obtained.
For step S52, replacing the first placeholder in the case to be replaced with the keyword in the keyword combination corresponding to the case to be replaced, and taking the replaced case to be replaced as the first test case.
And S53, replacing the first test case by adopting the product information corresponding to the requirement document to obtain a second test case, replacing a second replacer in the first test case, and taking the replaced case as the second test case.
For S54, each second test case is taken as the target test case set.
In an embodiment, after the step of updating the hit test case set according to the target keyword set to obtain the target test case set, the method further includes:
s61: taking any one test case in the target test case set as a case to be analyzed;
s62: combining the keywords corresponding to the cases to be analyzed to be used as combinations to be calculated;
s63: adding the scoring results of the keywords corresponding to the combination to be calculated to obtain case scores;
s64: and determining the case priority of each test case in the target test case set according to the case scores.
According to the embodiment, the case priority of the test case is automatically determined by adding the keyword scoring results of the keyword combinations corresponding to the test cases in the target test case set and determining the case priority of the test case according to the adding result, so that the test efficiency and the test accuracy are improved.
And S62, combining the keywords corresponding to the cases to be analyzed to serve as a combination to be calculated, and providing a basis for calculating the case scores.
And S63, adding the scoring results of the keywords corresponding to the combination to be calculated, and taking the data obtained by the addition as case scoring.
For S64, sorting each of the case scores in reverse order; performing set division on the sorted case scores by adopting a preset priority division ratio to obtain a plurality of case score sets; and taking the priority corresponding to the score segment corresponding to the case scoring set as the case priority of each test case in the case scoring set.
Optionally, the priority high level corresponds to a proportion of 0% -20% (greater than 0%, and less than or equal to 20%) high level, the priority medium level corresponds to a proportion of 20% -50% (greater than 20%, and less than or equal to 50%) medium level, and the priority low level corresponds to a proportion of 50% -100% (greater than 50%, and less than or equal to 100%) low level.
Referring to fig. 2, the present application further provides an artificial intelligence-based test case generation apparatus, including:
a data acquisition module 100, configured to acquire a requirement document;
a keyword extraction module 200, configured to perform keyword extraction on the requirement document to obtain a candidate keyword set;
a keyword screening module 300, configured to perform the keyword screening on the candidate keyword set to obtain a target keyword set;
the test case matching module 400 is used for matching test cases according to the target keyword set and a preset general test case library to obtain a hit test case set;
and the target test case set determining module 500 is configured to update the hit test case set according to the target keyword set to obtain a target test case set.
According to the method and the device, the test case matching is carried out on the universal test case library according to the target keyword set extracted from the requirement document, then the matched test case is updated, so that the target test case set required by the requirement document is automatically determined, the target test case set is determined by adopting a unified standard, the accuracy of the determined target test case set is improved, and the coverage of the determined target test case set is improved.
In one embodiment, the keyword extraction module 200 includes: a candidate keyword set determining submodule;
and the candidate keyword set determining submodule is used for inputting the requirement document into a preset keyword extraction model to extract the keywords, and taking each extracted keyword as the candidate keyword set, wherein the keyword extraction model is a model obtained based on two-way LSTM model training.
In one embodiment, the keyword screening module 300 includes: a keyword scoring result determining submodule, a sorting submodule and a target scoring result set determining submodule;
the keyword scoring result determining submodule is used for scoring each keyword in the candidate keyword set by adopting a preset keyword scoring rule to obtain a keyword scoring result;
the sorting submodule is used for sorting the grading results of the keywords in a reverse order;
the target scoring result set determining submodule is used for extracting a preset number of keyword scoring results from the ranked keyword scoring results in a mode of extracting from the beginning to obtain a target scoring result set;
in one embodiment, the keyword scoring result determining sub-module includes: the system comprises a part-of-speech scoring unit, an attribution function determining unit, a keyword function weight determining unit and a keyword scoring result determining unit;
the part-of-speech scoring unit is used for matching part-of-speech scoring of each keyword in the candidate keyword set in a preset part-of-speech scoring library to obtain a keyword part-of-speech score;
the attribution function determining unit is used for determining the attribution function of each keyword in the candidate keyword set according to the requirement document;
the keyword function weight determining unit is used for matching the attribution function corresponding to each keyword with the function weight in the function weight list corresponding to the required document to obtain the keyword function weight;
and the keyword scoring result determining unit is used for multiplying the part-of-speech scores of the keywords corresponding to the same keyword by the keyword function weights to obtain the keyword scoring result.
In one embodiment, the test case matching module 400 includes: a keyword combination determining submodule and a hit test case set determining submodule;
the keyword combination determining submodule is used for determining a keyword combination from the target keyword set;
and the hit test case set determining submodule is used for searching in each scene combination of the general test case library by adopting each keyword combination, if the search is successful, using the test case corresponding to the searched scene combination as a hit test case, and using each hit test case as the hit test case set.
In one embodiment, the target test case set determining module 500 includes: the system comprises a to-be-replaced case determining submodule, a first test case determining submodule, a second test case determining submodule and a target test case set determining submodule;
the to-be-replaced case determining submodule is used for taking any one test case in the hit test case set as a to-be-replaced case;
the first test case determining submodule is used for performing information replacement on the case to be replaced by adopting the keyword combination corresponding to the case to be replaced to obtain a first test case;
the second test case determining submodule is used for replacing the first test case by adopting the product information corresponding to the requirement document to obtain a second test case;
and the target test case set determining submodule is used for determining the target test case set according to each second test case.
In one embodiment, the above apparatus further comprises: a combination determining module to be calculated and a case priority determining module;
the to-be-calculated combination determining module is used for taking any one test case in the target test case set as a to-be-analyzed case, and combining the keywords corresponding to the to-be-analyzed case as a to-be-calculated combination;
the case priority determining module is used for adding the keyword scoring results corresponding to the combination to be calculated to obtain case scores, and determining the case priority of each test case in the target test case set according to the case scores.
Referring to fig. 3, a computer device, which may be a server and whose internal structure may be as shown in fig. 3, is also provided in the embodiment of the present application. The computer device includes a processor, a memory, a network interface, and a database connected by a system bus. Wherein the computer designed processor is used to provide computational and control capabilities. The memory of the computer device comprises a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer equipment is used for storing data such as a test case generation method based on artificial intelligence. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program is executed by a processor to implement an artificial intelligence based test case generation method. The test case generation method based on artificial intelligence comprises the following steps: acquiring a requirement document; extracting keywords from the requirement document to obtain a candidate keyword set; screening the keywords of the candidate keyword set to obtain a target keyword set; performing test case matching according to the target keyword set and a preset general test case library to obtain a hit test case set; and updating the hit test case set according to the target keyword set to obtain a target test case set.
According to the method and the device, the test case matching is carried out on the universal test case library according to the target keyword set extracted from the requirement document, then the matched test case is updated, so that the target test case set required by the requirement document is automatically determined, the target test case set is determined by adopting a unified standard, the accuracy of the determined target test case set is improved, and the coverage of the determined target test case set is improved.
In an embodiment, the step of extracting the keyword from the requirement document to obtain the candidate keyword set includes:
inputting the requirement document into a preset keyword extraction model for extracting the keywords, and taking each extracted keyword as the candidate keyword set;
the keyword extraction model is a model obtained based on bidirectional LSTM model training.
In an embodiment, the step of performing the keyword screening on the candidate keyword set to obtain the target keyword set includes:
scoring each keyword in the candidate keyword set by adopting a preset keyword scoring rule to obtain a keyword scoring result;
sorting the grading results of the keywords in a reverse order;
extracting a preset number of keyword scoring results from the ranked keyword scoring results in a mode of extracting from the beginning to obtain a target scoring result set;
in an embodiment, the step of scoring each keyword in the candidate keyword set by using a preset keyword scoring rule to obtain a keyword scoring result includes:
performing part-of-speech score matching on each keyword in the candidate keyword set in a preset part-of-speech score library to obtain a keyword part-of-speech score;
according to the requirement document, determining the attribution function of each keyword in the candidate keyword set;
performing function weight matching on the attribution function corresponding to each keyword in a function weight list corresponding to the requirement document to obtain keyword function weight;
and multiplying the part-of-speech scores of the keywords corresponding to the same keyword by the function weight of the keywords to obtain a scoring result of the keywords.
In an embodiment, the step of performing test case matching according to the target keyword set and a preset general test case library to obtain a hit test case set includes:
determining a keyword combination from the target keyword set;
searching in each scene combination of the universal test case library by adopting each keyword combination;
if the search is successful, taking the test case corresponding to the searched scene combination as a hit test case;
and taking each hit test case as the hit test case set.
In an embodiment, the step of updating the hit test case set according to the target keyword set to obtain the target test case set includes:
taking any one test case in the hit test case set as a case to be replaced;
adopting the keyword combination corresponding to the case to be replaced to replace the information of the case to be replaced to obtain a first test case;
replacing the first test case by adopting the product information corresponding to the requirement document to obtain a second test case;
and determining the target test case set according to the second test cases.
In an embodiment, after the step of updating the hit test case set according to the target keyword set to obtain the target test case set, the method further includes:
taking any one test case in the target test case set as a case to be analyzed;
combining the keywords corresponding to the cases to be analyzed to serve as combinations to be calculated;
adding the scoring results of the keywords corresponding to the combination to be calculated to obtain case scores;
and determining the case priority of each test case in the target test case set according to the case scores.
An embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the method for generating a test case based on artificial intelligence is implemented, including: acquiring a requirement document; extracting keywords from the requirement document to obtain a candidate keyword set; screening the keywords of the candidate keyword set to obtain a target keyword set; performing test case matching according to the target keyword set and a preset general test case library to obtain a hit test case set; and updating the hit test case set according to the target keyword set to obtain a target test case set.
According to the executed artificial intelligence-based test case generation method, the test case matching is carried out on the general test case library according to the target keyword set extracted from the requirement document, then the matched test case is updated, so that the target test case set required by the requirement document is automatically determined, the target test case set is determined by adopting a unified standard, the accuracy of the determined target test case set is improved, and the coverage of the determined target test case set is improved.
In an embodiment, the step of extracting the keyword from the requirement document to obtain the candidate keyword set includes:
inputting the requirement document into a preset keyword extraction model for extracting the keywords, and taking each extracted keyword as the candidate keyword set;
the keyword extraction model is a model obtained based on bidirectional LSTM model training.
In an embodiment, the step of performing the keyword screening on the candidate keyword set to obtain the target keyword set includes:
scoring each keyword in the candidate keyword set by adopting a preset keyword scoring rule to obtain a keyword scoring result;
sorting the grading results of the keywords in a reverse order;
extracting a preset number of keyword scoring results from the sorted keyword scoring results in a manner of extracting from the beginning to obtain a target scoring result set;
in an embodiment, the step of scoring each keyword in the candidate keyword set by using a preset keyword scoring rule to obtain a keyword scoring result includes:
performing part-of-speech score matching on each keyword in the candidate keyword set in a preset part-of-speech score library to obtain a keyword part-of-speech score;
according to the requirement document, determining the attribution function of each keyword in the candidate keyword set;
performing function weight matching on the attribution function corresponding to each keyword in a function weight list corresponding to the requirement document to obtain keyword function weight;
and multiplying the part-of-speech scores of the keywords corresponding to the same keyword by the function weight of the keywords to obtain a scoring result of the keywords.
In an embodiment, the step of performing test case matching according to the target keyword set and a preset general test case library to obtain a hit test case set includes:
determining a keyword combination from the target keyword set;
searching in each scene combination of the universal test case library by adopting each keyword combination;
if the search is successful, taking the test case corresponding to the searched scene combination as a hit test case;
and taking each hit test case as the hit test case set.
In an embodiment, the step of updating the hit test case set according to the target keyword set to obtain the target test case set includes:
taking any one test case in the hit test case set as a case to be replaced;
adopting the keyword combination corresponding to the case to be replaced to replace the information of the case to be replaced to obtain a first test case;
replacing the first test case by adopting product information corresponding to the requirement document to obtain a second test case;
and determining the target test case set according to the second test cases.
In an embodiment, after the step of updating the hit test case set according to the target keyword set to obtain the target test case set, the method further includes:
taking any one test case in the target test case set as a case to be analyzed;
combining the keywords corresponding to the cases to be analyzed to be used as combinations to be calculated;
adding the scoring results of the keywords corresponding to the combination to be calculated to obtain case scores;
and determining the case priority of each test case in the target test case set according to the case scores.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware instructions of a computer program, which can be stored in a non-volatile computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. Any reference to memory, storage, database, or other medium provided herein and used in the examples may include non-volatile and/or volatile memory. Non-volatile memory can include read-only memory (ROM), Programmable ROM (PROM), Electrically Programmable ROM (EPROM), Electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), Dynamic RAM (DRAM), Synchronous DRAM (SDRAM), double-rate SDRAM (SSRSDRAM), Enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), Rambus Direct RAM (RDRAM), direct bus dynamic RAM (DRDRAM), and bus dynamic RAM (RDRAM).
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, apparatus, article, or method that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, apparatus, article, or method. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, apparatus, article, or method that includes the element.
The above description is only a preferred embodiment of the present application, and not intended to limit the scope of the present application, and all modifications of equivalent structures and equivalent processes, which are made by the contents of the specification and the drawings of the present application, or which are directly or indirectly applied to other related technical fields, are also included in the scope of the present application.

Claims (10)

1. A test case generation method based on artificial intelligence is characterized by comprising the following steps:
acquiring a requirement document;
extracting keywords from the requirement document to obtain a candidate keyword set;
screening the keywords of the candidate keyword set to obtain a target keyword set;
performing test case matching according to the target keyword set and a preset general test case library to obtain a hit test case set;
and updating the hit test case set according to the target keyword set to obtain a target test case set.
2. The method for generating test cases based on artificial intelligence according to claim 1, wherein the step of extracting keywords from the requirement documents to obtain candidate keyword sets comprises:
inputting the requirement document into a preset keyword extraction model for extracting the keywords, and taking each extracted keyword as the candidate keyword set;
the keyword extraction model is a model obtained based on bidirectional LSTM model training.
3. The method for generating test cases based on artificial intelligence according to claim 1, wherein the step of performing the keyword screening on the candidate keyword set to obtain a target keyword set comprises:
scoring each keyword in the candidate keyword set by adopting a preset keyword scoring rule to obtain a keyword scoring result;
sorting the grading results of the keywords in a reverse order;
extracting a preset number of keyword scoring results from the ranked keyword scoring results in a mode of extracting from the beginning to obtain a target scoring result set;
and taking each keyword corresponding to the target scoring result set as the target keyword set.
4. The artificial intelligence based test case generation method according to claim 3, wherein the step of scoring each keyword in the candidate keyword set by using a preset keyword scoring rule to obtain a keyword scoring result comprises:
performing part-of-speech score matching on each keyword in the candidate keyword set in a preset part-of-speech score library to obtain a keyword part-of-speech score;
according to the requirement document, determining the attribution function of each keyword in the candidate keyword set;
performing function weight matching on the attribution function corresponding to each keyword in a function weight list corresponding to the requirement document to obtain keyword function weight;
and multiplying the part-of-speech scores of the keywords corresponding to the same keyword by the function weight of the keywords to obtain a scoring result of the keywords.
5. The artificial intelligence-based test case generation method according to claim 1, wherein the step of performing test case matching according to the target keyword set and a preset general test case library to obtain a hit test case set comprises:
determining a keyword combination from the target keyword set;
searching in each scene combination of the universal test case library by adopting each keyword combination;
if the search is successful, taking the test case corresponding to the searched scene combination as a hit test case;
and taking each hit test case as the hit test case set.
6. The artificial intelligence-based test case generation method according to claim 5, wherein the step of updating the hit test case set according to the target keyword set to obtain a target test case set comprises:
taking any one test case in the hit test case set as a case to be replaced;
adopting the keyword combination corresponding to the case to be replaced to replace the information of the case to be replaced to obtain a first test case;
replacing the first test case by adopting the product information corresponding to the requirement document to obtain a second test case;
and determining the target test case set according to the second test cases.
7. The method for generating a test case based on artificial intelligence according to claim 5, wherein after the step of updating the hit test case set according to the target keyword set to obtain a target test case set, the method further comprises:
taking any one test case in the target test case set as a case to be analyzed;
combining the keywords corresponding to the cases to be analyzed to serve as combinations to be calculated;
adding the scoring results of the keywords corresponding to the combination to be calculated to obtain case scores;
and determining the case priority of each test case in the target test case set according to the case scores.
8. An artificial intelligence based test case generation apparatus, the apparatus comprising:
the data acquisition module is used for acquiring a requirement document;
the keyword extraction module is used for extracting keywords from the requirement document to obtain a candidate keyword set;
the keyword screening module is used for screening the keywords of the candidate keyword set to obtain a target keyword set;
the test case matching module is used for matching test cases according to the target keyword set and a preset general test case library to obtain a hit test case set;
and the target test case set determining module is used for updating the hit test case set according to the target keyword set to obtain the target test case set.
9. A computer device comprising a memory and a processor, the memory storing a computer program, wherein the processor implements the steps of the method of any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the method of any one of claims 1 to 7.
CN202210281718.7A 2022-03-21 2022-03-21 Test case generation method, device, equipment and medium based on artificial intelligence Pending CN114595158A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210281718.7A CN114595158A (en) 2022-03-21 2022-03-21 Test case generation method, device, equipment and medium based on artificial intelligence

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210281718.7A CN114595158A (en) 2022-03-21 2022-03-21 Test case generation method, device, equipment and medium based on artificial intelligence

Publications (1)

Publication Number Publication Date
CN114595158A true CN114595158A (en) 2022-06-07

Family

ID=81819705

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210281718.7A Pending CN114595158A (en) 2022-03-21 2022-03-21 Test case generation method, device, equipment and medium based on artificial intelligence

Country Status (1)

Country Link
CN (1) CN114595158A (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115080851A (en) * 2022-06-25 2022-09-20 平安银行股份有限公司 Case recommendation method based on database, computer equipment and storage medium
CN115269437A (en) * 2022-08-24 2022-11-01 上海复深蓝软件股份有限公司 Test case recommendation method and device, computer equipment and storage medium
CN115344504A (en) * 2022-10-19 2022-11-15 广州软件应用技术研究院 Software test case automatic generation method and tool based on requirement specification
CN117494693A (en) * 2023-12-25 2024-02-02 广东省科技基础条件平台中心 Evaluation document generation method, device and equipment

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115080851A (en) * 2022-06-25 2022-09-20 平安银行股份有限公司 Case recommendation method based on database, computer equipment and storage medium
CN115269437A (en) * 2022-08-24 2022-11-01 上海复深蓝软件股份有限公司 Test case recommendation method and device, computer equipment and storage medium
CN115344504A (en) * 2022-10-19 2022-11-15 广州软件应用技术研究院 Software test case automatic generation method and tool based on requirement specification
CN117494693A (en) * 2023-12-25 2024-02-02 广东省科技基础条件平台中心 Evaluation document generation method, device and equipment
CN117494693B (en) * 2023-12-25 2024-03-15 广东省科技基础条件平台中心 Evaluation document generation method, device and equipment

Similar Documents

Publication Publication Date Title
CN114595158A (en) Test case generation method, device, equipment and medium based on artificial intelligence
CN111563051B (en) Crawler-based data verification method and device, computer equipment and storage medium
CN111581229A (en) SQL statement generation method and device, computer equipment and storage medium
CN112380840A (en) Text error correction method, device, equipment and medium
CN111079429A (en) Entity disambiguation method and device based on intention recognition model and computer equipment
CN111460149B (en) Text classification method, related device and readable storage medium
CN111382570B (en) Text entity recognition method, device, computer equipment and storage medium
CN112286934A (en) Database table importing method, device, equipment and medium
CN117271792A (en) Method for constructing enterprise domain knowledge base based on large model
CN114416984A (en) Text classification method, device and equipment based on artificial intelligence and storage medium
CN113536735A (en) Text marking method, system and storage medium based on keywords
CN113886531A (en) Intelligent question and answer determining method and device, computer equipment and storage medium
CN112541739B (en) Method, device, equipment and medium for testing question-answer intention classification model
US11379527B2 (en) Sibling search queries
CN113486140A (en) Knowledge question-answer matching method, device, equipment and storage medium
CN117112850A (en) Address standardization method, device, equipment and storage medium
CN114896382A (en) Artificial intelligent question-answering model generation method, question-answering method, device and storage medium
CN113656575B (en) Training data generation method and device, electronic equipment and readable medium
CN117725182A (en) Data retrieval method, device, equipment and storage medium based on large language model
CN111552810B (en) Entity extraction and classification method, entity extraction and classification device, computer equipment and storage medium
CN113268564A (en) Method, device and equipment for generating similar problems and storage medium
CN114385808A (en) Text classification model construction method and text classification method
CN116932694A (en) Intelligent retrieval method, device and storage medium for knowledge base
CN116820960A (en) Software testing method and electronic equipment
CN112559671B (en) ES-based text search engine construction method, device, equipment and medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination