WO2021253904A1 - Test case set generation method, apparatus and device, and computer readable storage medium - Google Patents

Test case set generation method, apparatus and device, and computer readable storage medium Download PDF

Info

Publication number
WO2021253904A1
WO2021253904A1 PCT/CN2021/081873 CN2021081873W WO2021253904A1 WO 2021253904 A1 WO2021253904 A1 WO 2021253904A1 CN 2021081873 W CN2021081873 W CN 2021081873W WO 2021253904 A1 WO2021253904 A1 WO 2021253904A1
Authority
WO
WIPO (PCT)
Prior art keywords
test case
case set
training
test
knowledge base
Prior art date
Application number
PCT/CN2021/081873
Other languages
French (fr)
Chinese (zh)
Inventor
袁文静
周杰
卢道和
方镇举
翁玉萍
陈文龙
黄涛
韩海燕
Original Assignee
深圳前海微众银行股份有限公司
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 深圳前海微众银行股份有限公司 filed Critical 深圳前海微众银行股份有限公司
Publication of WO2021253904A1 publication Critical patent/WO2021253904A1/en

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
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/35Clustering; Classification
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/36Creation of semantic tools, e.g. ontology or thesauri
    • G06F16/367Ontology
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/30Semantic analysis

Definitions

  • This application relates to the technical field of financial technology (Fintech), and in particular to a method, device, device, and computer-readable storage medium for generating a test case set.
  • test cases usually include usage scenarios and their corresponding test results.
  • test cases are mainly written and maintained manually, which is inefficient and consumes a lot of manpower.
  • the existing automated case writing solutions need to save historical cases in the database first, and generate test case sets through database search and matching.
  • the database retrieval process can only retrieve existing cases, and the database cannot automatically produce new cases.
  • the input of historical cases in the database needs to be manually entered and the scope of case retrieval is very limited, which is inefficient and impossible Realize the automatic generation of test cases.
  • the main purpose of this application is to provide a test case generation method, device, equipment, and computer-readable storage medium, aiming to realize the automatic generation of test cases and improve the efficiency of test case generation.
  • the present application provides a method for generating a test case set, and the method for generating a test case set includes:
  • test case set knowledge base is generated by training a preset training model constructed by combining the BERT model and the knowledge graph;
  • the knowledge graph is used to analyze the case keywords and the target similar case set to inferentially generate a test case set.
  • the method before the step of obtaining case keywords, performing semantic analysis on the case keywords, and obtaining a semantic analysis result, the method further includes:
  • the first training test case set and the second training test case set are classified by the language representation model, and a test case set knowledge base is generated according to the classification result.
  • the step of performing preprocessing training on the preset training model according to the unlabeled first training test case set to obtain the initial training model includes:
  • the step of performing fine-tuning training on the initial training model according to the labeled second training test case set, and obtaining a trained language representation model includes:
  • the step of classifying the first training test case set and the second training test case set according to the language representation model, and generating a test case set knowledge base according to the classification result includes:
  • the case set generates a test case set knowledge base.
  • the step of retrieving the test case collection knowledge base to obtain the retrieval result includes:
  • the target test case set is retrieved according to the semantic analysis result to obtain the similarity between the case keywords and the test cases in the target test case set, and the retrieval result is obtained.
  • the step of retrieving the target test case set according to the semantic analysis result to obtain the similarity between the case keywords and the test cases in the target test case set, and obtaining the retrieval result further include:
  • the similarity is greater than or equal to the first preset threshold, it is determined that the same case set corresponding to the case keyword exists in the test case set knowledge base, and the target same case set is obtained and output.
  • the method further includes:
  • the similarity is less than the first preset threshold, detecting whether the similarity is greater than a second preset threshold, where the second preset threshold is less than the first preset threshold;
  • the step is performed: obtaining a target similar case set;
  • the method further includes:
  • test case set generating device includes:
  • the analysis module is used to obtain case keywords, perform semantic analysis on the case keywords, and obtain semantic analysis results;
  • the retrieval module is configured to retrieve the test case set knowledge base according to the semantic analysis result to obtain the retrieval result, wherein the test case set knowledge base is generated by training a preset training model constructed by combining the BERT model and the knowledge graph;
  • the first obtaining module is configured to obtain a target similar case set if it is determined that there is a similar case set in the test case set knowledge base according to the search result;
  • the first generating module is configured to analyze the case keywords and the target similar case set by using the knowledge graph to generate a test case set.
  • the present application also provides a test case set generating device, the test case set generating device including: a memory, a processor, and a test stored on the memory and running on the processor A case set generation program, when the test case set generation program is executed by the processor, the steps of the test case set generation method described above are implemented.
  • the present application also provides a computer-readable storage medium, the computer-readable storage medium stores a test case set generation program, and the test case set generation program is executed by a processor to achieve the above The steps of the test case set generation method described.
  • This application provides a test case collection method, device, equipment, and computer readable storage medium to obtain case keywords, perform semantic analysis on the case keywords, and obtain semantic analysis results; and retrieve test cases based on the semantic analysis results
  • a knowledge base to obtain retrieval results wherein the test case set knowledge base is generated by the training of a preset training model constructed by the BERT model combined with the knowledge graph; if the test case set knowledge base is determined according to the retrieval result If there is a set of similar cases, the target similar case set is obtained; the case keywords and the target similar case set are analyzed using the knowledge graph to generate a test case set.
  • the existing test case set knowledge base can be used to search in the test case set knowledge base according to the case keywords to obtain the search results.
  • the knowledge graph is used to automatically Reasoning to generate a new set of test cases. Therefore, compared with the prior art, the present application can automatically generate a new test case set based on the existing test case set knowledge base, thereby improving the generation efficiency of the test case set.
  • FIG. 1 is a schematic diagram of a device structure of a hardware operating environment involved in a solution of an embodiment of the application
  • FIG. 2 is a schematic flowchart of a first embodiment of a method for generating a test case set of this application
  • FIG. 3 is a schematic diagram of the functional modules of the first embodiment of the apparatus for generating a test case set of this application.
  • FIG. 1 is a schematic diagram of the device structure of the hardware operating environment involved in the solution of the embodiment of the application.
  • the test case set generating device in the embodiment of the present application may be a smart phone, or a terminal device such as a PC (Personal Computer, personal computer), a tablet computer, and a portable computer.
  • a terminal device such as a PC (Personal Computer, personal computer), a tablet computer, and a portable computer.
  • the test case set generating device may include: a processor 1001, such as a CPU, a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005.
  • the communication bus 1002 is used to implement connection and communication between these components.
  • the user interface 1003 may include a display screen (Display) and an input unit such as a keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface and a wireless interface.
  • the network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a Wi-Fi interface).
  • the memory 1005 may be a high-speed RAM memory, or a non-volatile memory (non-volatile memory), such as a magnetic disk memory.
  • the memory 1005 may also be a storage device independent of the aforementioned processor 1001.
  • test case set generating device does not constitute a limitation on the test case set generating device, and may include more or less components than shown in the figure, or a combination of certain components, Or different component arrangements.
  • the memory 1005 as a computer storage medium may include an operating system, a network communication module, a user interface module, and a test case set generation program.
  • the network interface 1004 is mainly used to connect to a back-end server and communicate with the back-end server;
  • the user interface 1003 is mainly used to connect to a client and communicate with the client;
  • the processor 1001 can be used to Call the test case set generation program stored in the memory 1005, and execute each step of the following test case set generation method.
  • This application provides a method for generating a test case set.
  • FIG. 2 is a schematic flowchart of a first embodiment of a method for generating a test case set of this application.
  • the method for generating a test case set includes:
  • Step S10 obtaining case keywords, performing semantic analysis on the case keywords, and obtaining semantic analysis results
  • test case set generating device which is equipped with a test case set generator.
  • the test case set is some test scenarios that may be used by developers and testers in the product development process and the corresponding expected test results.
  • it includes test information related to some abnormal scenarios, such as
  • the test case set can include different usage scenarios such as Chinese login name, English login name, and special character login name, as well as test results when tested in these different test scenarios.
  • the staff can input the case keywords of the test case set they want to generate through the corresponding software on the working end, such as "login", to trigger the test case set generation instruction.
  • the test case set When the generator receives the test case set generation instruction, it obtains the case keywords input by the staff, and then performs semantic analysis on the case keywords to use the semantic analysis to conduct context-sensitive examinations, thereby obtaining the corresponding semantic analysis results.
  • the semantic analysis method used in this application is a commonly used semantic analysis method, such as latent semantic analysis.
  • Step S20 According to the semantic analysis result, search the test case set knowledge base to obtain the search result, wherein the test case set knowledge base is generated by training a preset training model constructed by combining the BERT model and the knowledge graph;
  • test case set knowledge base is retrieved to obtain the retrieval result.
  • the test case set knowledge base contains all product-related case sets, and the test case set knowledge base is generated by training a preset training model constructed by combining the BERT model with the knowledge graph.
  • BERT Bidirectional Encoder Representations from Transformers, a natural language processing pre-training technology based on neural networks
  • Test cases require a large amount of test background knowledge support. What BERT learns is a text matching model. A large amount of test background common sense is implicit and vague, and it is difficult to reflect in the pre-training data. At the same time, it lacks semantic understanding and reasoning.
  • the knowledge map information is incorporated in the pre-training process to organize the knowledge under test.
  • the calculation model based on symbolic semantics can provide prior knowledge for BERT, so that it has certain test common sense and reasoning ability. Therefore, in this application, BERT is used in combination with the preset training model training of the knowledge graph to generate a test case set knowledge base, which can enable the test case set knowledge base to know different test common sense and use the test common sense inference to generate a new test case set.
  • the search result is the similarity between the case keywords and the existing cases in the test case set knowledge base after semantic analysis. According to the similarity, the search results generally include three different search results: identical, similar, and basically different.
  • Step S30 If it is determined according to the search result that there is a similar case set in the test case set knowledge base, then a target similar case set is obtained.
  • the target similar case set is obtained.
  • the similarity value with different test sets will be obtained at the same time. The one with the largest similarity is used as the final retrieval result, and the case set corresponding to the largest similarity value is used as the target similar case set.
  • Step S40 using the knowledge graph to analyze the case keywords and the target similar case set to generate a test case set
  • the knowledge graph is a knowledge domain visualization or a knowledge domain mapping map, which is a series of various graphs showing the relationship between the development process of knowledge and the structure.
  • the reasoning of the knowledge graph includes deductive reasoning and inductive reasoning. Since inductive reasoning can add new knowledge, inductive reasoning is mainly used in this application. Inductive reasoning can also use FOIL (First Order Inductive Learner) algorithm, association rule mining algorithm of incomplete knowledge base, and path sorting algorithm. Specifically, first use one or more of the above algorithms to learn or construct rules for the target similar case set, and then infer new entities based on the case keywords and the entities in the target similar case set according to the learned or constructed rules. The new entity can be constructed by reasoning to get the test case set. If the entered case keyword is the login password, and the existing target similar case set is the login name, the login password and login name can be used to inferentially generate a test case set related to the login password.
  • FOIL First Order Inductive Learner
  • the embodiment of the application provides a method for generating a test case set, obtaining case keywords, performing semantic analysis on the case keywords, and obtaining a semantic analysis result; according to the semantic analysis result, searching the test case set knowledge base to obtain the retrieval result ,
  • the test case set knowledge base is generated by training a preset training model constructed by the BERT model combined with the knowledge graph; if it is determined that there is a similar case set in the test case set knowledge base according to the search result, then obtain Target similar case set; use the knowledge graph to analyze the case keywords and the target similar case set, and reason to generate a test case set.
  • the existing test case set knowledge base can be used to search in the test case set knowledge base according to the case keywords to obtain the search results.
  • the knowledge graph is used to automatically Reasoning to generate a new set of test cases. Therefore, compared with the prior art, the present application can automatically generate a new test case set based on the existing test case set knowledge base, thereby improving the generation efficiency of the test case set.
  • the method for generating a test case set further includes:
  • Step A Perform preprocessing training on the preset training model according to the unlabeled first training test case set to obtain the initial training model, where the preset training model is constructed based on the BERT model combined with the knowledge graph;
  • the preset training model is preprocessed according to the unlabeled first training test case set to obtain the initial training model, where the preset training model is constructed based on the BERT model combined with the knowledge graph.
  • the unlabeled first training test case set is the test case set that has been stored before.
  • the preset training model is constructed based on the BERT model combined with the knowledge graph.
  • BERT can handle natural language semantic analysis, classification and other scenarios very well, but there are some shortcomings, such as the lack of common sense.
  • Test cases require a large amount of test background knowledge support. What BERT learns is a text matching model. A large amount of test background common sense is implicit and vague, and it is difficult to reflect in the pre-training data. At the same time, it lacks semantic understanding and reasoning. Therefore, the knowledge map information is incorporated in the pre-training process to organize the knowledge under test.
  • the calculation model based on symbolic semantics can provide prior knowledge for BERT, so that it has certain test common sense and reasoning ability.
  • BERT conducts pre-training on a large number of test case corpora to realize the understanding of the semantics of the test case text. Specifically, BERT first randomly hides some words under test, and then implements language representation through context prediction to obtain the initial training model. For example, for the sentence “Dylan wrote “Answers in the Wind” in 1962 and “Chronicles: Book One” in 2004, BERT can randomly hide “Dylan” and " 1962", “Answer is flying in the wind” and other words, but through continuous training, the model can determine the relationship between these words and can store the relationship between these words, so that the model can know the relationship between words The relationship of the linguistic representation.
  • the BERT is combined with the knowledge graph, and the multi-information entities in the knowledge graph are used (such as Dylan in the above example, "Answers in the Wind” and other specific examples) Used as external knowledge to improve language representation, so that the model can know the meaning of each word itself, not just the relationship between multiple words, and at the same time achieve structured knowledge coding and heterogeneous information fusion (among which, structured knowledge
  • the way of encoding is to transform abstract knowledge into vectors and other forms for language representation.
  • Heterogeneous information refers to different types of information such as vocabulary, syntax, and knowledge information
  • a preset training model is constructed by fusing the knowledge graph.
  • abstract knowledge information they need to be encoded so that knowledge can be used for language representation.
  • the encoding of words and the encoding of knowledge during BERT pre-training are different, although they are both converted into The vector is located in a different vector space. Therefore, it is necessary to design the model to realize the fusion of heterogeneous information such as vocabulary, syntax and knowledge information.
  • the BERT combined with the knowledge graph model can solve the above problems.
  • Step B Perform fine-tuning training on the initial training model according to the labeled second training test case set to obtain a language representation model
  • the initial training model is fine-tuned and trained according to the labeled second training test case set to obtain the language representation model.
  • the labeled second training test set is a training test set that is not in the existing first training test case set, such as a test case set of a new login name.
  • the labeled second training test case set can supplement the first training test set, so that the resulting language representation model is more comprehensive, and a test case set knowledge base that is more in line with the real test scenario can be constructed.
  • the fine-tuning training process is completed by two modules: text encoder and knowledge encoder.
  • the text encoder is responsible for obtaining the semantic information such as the morphology and syntax of the input tags of the second training test case set, and the tag vector, segmentation vector and position vector are summed to obtain the input vector, and then implemented by the multi-layer two-way conversion encoder For the extraction of semantic features.
  • the knowledge encoder integrates additional entity-oriented knowledge information into the text information from the bottom layer, so that the heterogeneous information of tags and entities can be represented in a unified feature space. Represents vector sequences labeled by ⁇ w 1, ..., w n ⁇ , with ⁇ e 1, ..., e n ⁇ be a vector representing the sequence entity. The two sequences are calculated according to the following formula:
  • MH-ATT is the attention layer.
  • h j represents the internal hidden state of the fusion mark and entity information
  • b represents the bias
  • W t represents the weight in the hidden layer
  • ⁇ () is the non-linear activation function
  • the language representation model is obtained, so that the test case set knowledge base can be obtained subsequently based on the language representation model.
  • Step C Classify the first training test case set and the second training test case set through the language representation model, and generate a test case set knowledge base according to the classification result;
  • the language representation model obtains the classification of different training test case sets based on the probability distribution calculation formula, and finally generates the test case set knowledge base, where the predicted probability distribution calculation formula is as follows:
  • linear() represents the linear layer.
  • test case set knowledge base from different types of cases, and then, for example, for the user name and password, both are It can be a landing case.
  • preprocessing training is performed on the preset training model according to the unlabeled first training test case set to obtain the initial training model, where the preset training model is constructed based on the BERT model combined with the knowledge graph; Perform fine-tuning training on the initial training model according to the labeled second training test case set to obtain a language representation model; classify the first training test case set and the second training test case set through the language representation model , According to the classification results to generate a test case set knowledge base.
  • the training model is trained to obtain the test case set knowledge base, which realizes the classification of different test case sets to facilitate subsequent retrieval, thereby improving the efficiency of subsequent test case set generation.
  • step A includes:
  • Step a1 Obtain the first attribute information of the unlabeled first training test case set
  • Step a2 dividing the first training test case set according to the first attribute information to obtain multiple first training test case subsets
  • Step a3 Perform preprocessing training on the preset training model according to a plurality of first training test case subsets to obtain corresponding multiple initial training models, wherein the preset training model is constructed based on the BERT model combined with the knowledge map of.
  • the training test case set (including the first training test case set and the second training test case set) can be divided according to the attribute information, so as to train to obtain multiple language representation models corresponding to different attribute information, and then combine the language The classification results and attribute information of the characterization model are classified, and the test case set knowledge base is constructed.
  • the training model input source is composed of four parts: the test knowledge public database, the BUG database, the business scenario database, and the training database.
  • the test knowledge public database is mainly common test cases with business commonality, such as login and password verification.
  • the BUG database is a set of BUG use cases found in production;
  • the business scenario library is a collection of test cases written in a specific business scenario, and
  • the training database is a set of test cases manually annotated on the TCTP platform.
  • the training parameter case set will be trained according to the training data of three latitudes: full product cases, specific project product cases, and personalized writing cases.
  • the first attribute information can include full product cases, specific project product cases, and personalized writing cases. And other different attributes.
  • the full product case is, for example, a set of test cases for a type of product such as insurance
  • the project product case is a set of test cases for a specific product such as login
  • a personalized insurance case can be a set of test cases associated with each writer.
  • the classification results of the same case in the initial training model formed by it may be different, and the association relationship between different entities may be different.
  • the preset training models are preprocessed according to a plurality of first training test case subsets respectively to obtain corresponding multiple initial training models, where the preset training models are constructed based on the BERT model combined with the knowledge graph.
  • step B includes:
  • Step b1 Obtain the labeled second training test case set and its second attribute information
  • Step b2 dividing according to the second attribute information and the second training test set to obtain a plurality of second training test case subsets
  • Step b3 Perform fine-tuning training on the corresponding initial training model according to a plurality of second training test case subsets, respectively, to obtain multiple language representation models corresponding to the second attribute information.
  • the initial training model that matches the second attribute information is determined, and the second training test In the case set, the second attribute information is added to the corresponding initial training model for fine-tuning training, and multiple language representation models are obtained.
  • step C includes:
  • Step c1 Classify the corresponding first training test case subset and the second training test case subset through multiple language representation models to obtain multiple test case sets corresponding to the first attribute information, and based on the Multiple test case sets generate test case set knowledge base;
  • test case set knowledge base includes cases, attributes (full product cases, specific project product cases, personalized product cases, personalized writing cases) and test sets. For different test sets, they will be classified into corresponding cases. At the same time, for the same test set, according to different attributes, different cases may correspond to different cases in the test case set sub-knowledge base of different attributes.
  • multiple speech representation models with different attributes are formed into the final test case set knowledge base, so as to ensure the integrity of the test case set knowledge base, and also enable the test case set to match more usage scenarios according to different attributes. It further improves the accuracy of the test case set generation.
  • the search range can be narrowed based on the input candidate attribute information, and the retrieval efficiency is improved, thereby improving the generation efficiency of the test case set.
  • the method for generating a test case set further includes:
  • Step D obtain candidate attribute information
  • the worker when the worker triggers the test case set generation instruction, in addition to the case keywords, he can also input candidate attribute information, where the candidate attribute information is the attribute information corresponding to the test case set to be generated At the same time, the candidate attribute information corresponds to the attribute information of each language representation model of the test case set knowledge base, that is, the candidate attribute information is used to give the associated test case set during retrieval.
  • the test case set generator can first Get candidate attribute information.
  • Step S20 includes:
  • Step E Determine a target test case set corresponding to the candidate attribute information in the test case set knowledge base
  • Step F retrieve the target test case set according to the semantic analysis result to obtain the similarity between the keyword of the case and the test case in the target test case set to obtain the retrieval result;
  • the output result gives a set of test cases that conform to the attribute according to the cases associated with the test attribute.
  • the candidate attribute is a specific project product case set
  • only the test case set knowledge base whose attribute is a specific product case set is retrieved, instead of retrieving the full product case and personalized writing case, the results can be retrieved at the same time through the efficiency of the retrieval process Also more accurate. According to the similarity between the case keywords and the test cases in the test case set of the corresponding attributes, the corresponding retrieval results are determined.
  • this embodiment can narrow the range of the test case set knowledge base that needs to be retrieved according to the candidate attribute information in the retrieval process, thereby passing the efficiency and accuracy of retrieval.
  • step S20 includes:
  • Step G detecting whether the similarity in the retrieval result is greater than or equal to a first preset threshold
  • Step H If the similarity is greater than or equal to the first preset threshold, it is determined that the same case set corresponding to the case keyword exists in the test case set knowledge base, then the target same case set is obtained, and Output
  • the similarity in the search result is greater than or equal to the first preset threshold.
  • the similarity is greater than or equal to the first preset threshold, it indicates that the current test case set knowledge base already exists and the input case keyword For the same case set, the target same case set is directly determined according to the similarity and output, and then the required test case set can be output.
  • step H it also includes:
  • Step 1 If the similarity is less than the first preset threshold, detecting whether the similarity is greater than a second preset threshold, where the second preset threshold is less than the first preset threshold;
  • the similarity is less than the first preset threshold, it means that the same test case set does not exist in the test case set knowledge base, but the test case set knowledge base generated by the BERT combined with the training model of the knowledge graph has a certain learning ability.
  • determine whether there are similar cases that is, determine whether the similarity is greater than the second preset threshold.
  • Step J If the similarity is greater than the second preset threshold, it is determined that there is a similar case set in the test case set knowledge base, and step S30 is executed: obtaining a target similar case set;
  • the knowledge graph is used for reasoning Ability reasoning generates and generates a set of test cases. If the case keyword is the user password, and it is determined that there is a similar test set in the test case set knowledge base as the user name related test set, if it does not contain special characters, the length is at least six characters, etc., it can be inferred that the user password does not contain A set of test cases with special characters and a length of at least six characters.
  • Step K If the similarity is less than or equal to the second preset threshold, output prompt information to prompt the user to manually generate a test case set;
  • test case in the test case set knowledge base differs greatly from the input case keywords.
  • the case corresponding to the input case keywords should be a brand new case. It is impossible to use the existing test case set for direct output or reasoning to generate a test case set. If the user needs to manually generate the test case set, then manually add the test case set.
  • step K it also includes:
  • Step k1 Obtain a set of labeled test cases manually generated by the user
  • Step k2 update the test case set knowledge base according to the labeled test case set
  • test case set knowledge base can learn from the labeled test case set, thereby expanding the test case set knowledge base.
  • the same test case set can be directly output according to the similarity according to the retrieval result, or the test case set can be generated by reasoning based on the similar test case set.
  • the test case set cannot be output according to the test case set knowledge base, it can be manually generated Annotated test case set is generated in the method, and then the test case set knowledge base is updated by annotated test case set to expand the test case set knowledge base.
  • the application also provides a device for generating a test case set.
  • FIG. 3 is a schematic diagram of the functional modules of the first embodiment of the apparatus for generating a test case set according to the present application.
  • the test case set generating device includes:
  • the analysis module 10 is used to obtain case keywords, perform semantic analysis on the case keywords, and obtain semantic analysis results;
  • the retrieval module 20 is configured to retrieve the test case set knowledge base according to the semantic analysis result to obtain the retrieval result, wherein the test case set knowledge base is generated by training a preset training model constructed by combining the BERT model and the knowledge graph ;
  • the first obtaining module 30 is configured to obtain a target similar case set if it is determined that there is a similar case set in the test case set knowledge base according to the search result;
  • the first generation module 40 is configured to analyze the case keywords and the target similar case set by using the knowledge graph, and generate a test case set by reasoning.
  • test case set generating device further includes:
  • the pre-training module performs pre-processing training on the preset training model according to the unlabeled first training test case set to obtain the initial training model, where the preset training model is constructed based on the BERT model combined with the knowledge map;
  • the fine-tuning training module is configured to perform fine-tuning training on the initial training model according to the labeled second training test case set to obtain a language representation model
  • the second generation module is configured to classify the first training test case set and the second training test case set through the language representation model, and generate a test case set knowledge base according to the classification result.
  • the pre-training module further includes:
  • the first acquiring unit is configured to acquire the first attribute information of the unlabeled first training test case set
  • the first dividing unit is configured to divide the first training test case set according to the first attribute information to obtain multiple first training test case subsets;
  • the pre-training unit is used to perform pre-processing training on the preset training model according to a plurality of first training test case subsets to obtain corresponding multiple initial training models, wherein the preset training model is based on the BERT model combined with knowledge
  • the map is constructed;
  • the fine-tuning training module further includes:
  • the second acquiring unit is used to acquire the labeled second training test case set and its second attribute information
  • the second dividing unit is configured to divide according to the second attribute information and the second training test set to obtain a plurality of second training test case subsets
  • the fine-tuning training unit is configured to perform fine-tuning training on the corresponding initial training model according to a plurality of second training test case subsets to obtain multiple language representation models corresponding to the second attribute information;
  • the second generating module further includes:
  • the first generating unit is configured to classify the corresponding first training test case subset and the second training test case subset through multiple language representation models to obtain multiple test case sets corresponding to the first attribute information, And generate a test case set knowledge base based on the multiple test case sets.
  • test case set generating device further includes:
  • the second obtaining unit is used to obtain candidate attribute information
  • the first acquisition module further includes:
  • a determining unit configured to determine a target test case set corresponding to the candidate attribute information in the test case set knowledge base
  • the third obtaining unit is configured to retrieve the target test case set according to the semantic analysis result to obtain the similarity between the case keywords and the test cases in the target test case set to obtain the retrieval result.
  • test case set generating device further includes:
  • the first detection module is configured to detect whether the similarity in the retrieval result is greater than or equal to a first preset threshold
  • the first output module is configured to determine that the same case set corresponding to the case keyword exists in the test case set knowledge base if the similarity is greater than or equal to the first preset threshold, and the acquisition target is the same Case collection and output.
  • test case set generating device further includes:
  • the second detection module is configured to detect whether the similarity is greater than a second preset threshold if the similarity is less than the first preset threshold, wherein the second preset threshold is less than the first preset Set threshold
  • the fourth obtaining module is configured to determine that there is a similar case set in the test case set knowledge base if the similarity is greater than the second preset threshold, and then execute the step of: obtaining a target similar case set;
  • the second generation module is configured to output prompt information to prompt the user to manually generate a test case set if the similarity is less than or equal to the second preset threshold.
  • test case set generating device further includes:
  • the fifth acquisition module is used to acquire a set of labeled test cases manually generated by the user
  • the update module is used to update the test case set knowledge base according to the labeled test case set.
  • each module in the above-mentioned test case set generation device corresponds to each step in the above-mentioned test case set generation method embodiment, and its functions and realization processes are not repeated here.
  • the present application also provides a computer-readable storage medium with a test case set generation program stored on the computer-readable storage medium.
  • the test case set generation program is executed by a processor to achieve the above The steps of the test case set generation method.

Abstract

The present application relates to the technical field of fintech. Disclosed are a test case set generation method, apparatus and device, and a computer readable storage medium. The test case set generation method comprises: obtaining a case keyword and performing semantic analysis on the case keyword to obtain the semantic analysis result; searching a test case set knowledge base according to the semantic analysis result to obtain the search result, wherein the test case set knowledge base is generated by training a preset training model obtained by construction by a BERT model by combining a knowledge map; according to the search result, if it is determined that a similar case set exists in the test case set knowledge base, obtaining a target similar case set; and using the knowledge map to analyze the case keyword and the target similar case set to generate a test case set.

Description

测试案例集生成方法、装置、设备及计算机可读存储介质Method, device, equipment and computer readable storage medium for generating test case set
优先权信息Priority information
本申请要求于2020年6月18日申请的、申请号为202010563141.X的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of the Chinese patent application filed on June 18, 2020 with the application number 202010563141.X, the entire content of which is incorporated into this application by reference.
技术领域Technical field
本申请涉及金融科技(Fintech)技术领域,尤其涉及一种测试案例集生成方法、装置、设备及计算机可读存储介质。This application relates to the technical field of financial technology (Fintech), and in particular to a method, device, device, and computer-readable storage medium for generating a test case set.
背景技术Background technique
随着计算机技术的发展,越来越多的技术应用在金融领域,传统金融业正在逐步向金融科技(Fintech)转变,但由于金融行业的安全性、实时性要求,也对技术提出了更高的要求。With the development of computer technology, more and more technologies are applied in the financial field. The traditional financial industry is gradually transforming to Fintech. However, due to the security and real-time requirements of the financial industry, higher technology is also proposed. Requirements.
在产品开发和测试过程中,产品开发人员往往需要一些测试案例来进行开发测试,测试案例通常包括使用场景及其对应的测试结果。目前,测试案例主要是由人工进行编写维护,人工编写效率低下且需消耗大量人力。同时,现有的自动化案例编写方案,需要先将历史案例保存至数据库中,通过数据库检索匹配来生成测试案例集。虽然存在一定的自动化过程,但是数据库检索过程中只能检索已有案例,同时数据库无法自动化生产新的案例,数据库中历史案例的输入需要手动输入且案例的检索范围十分有限,效率较低且无法真正实现测试案例的自动化生成。In the process of product development and testing, product developers often need some test cases for development and testing. Test cases usually include usage scenarios and their corresponding test results. At present, test cases are mainly written and maintained manually, which is inefficient and consumes a lot of manpower. At the same time, the existing automated case writing solutions need to save historical cases in the database first, and generate test case sets through database search and matching. Although there is a certain automated process, the database retrieval process can only retrieve existing cases, and the database cannot automatically produce new cases. The input of historical cases in the database needs to be manually entered and the scope of case retrieval is very limited, which is inefficient and impossible Realize the automatic generation of test cases.
发明内容Summary of the invention
本申请的主要目的在于提供一种测试案例生成方法、装置、设备及计算机可读存储介质,旨在实现自动化生成测试案例,提高测试案例的生成效率。The main purpose of this application is to provide a test case generation method, device, equipment, and computer-readable storage medium, aiming to realize the automatic generation of test cases and improve the efficiency of test case generation.
为实现上述目的,本申请提供一种测试案例集生成方法,所述测试案例集生成方法包括:In order to achieve the foregoing objective, the present application provides a method for generating a test case set, and the method for generating a test case set includes:
获取案例关键词,对所述案例关键词进行语义分析,得到语义分析结果;Obtain case keywords, perform semantic analysis on the case keywords, and obtain semantic analysis results;
根据所述语义分析结果,检索测试案例集知识库以获取检索结果,其中, 所述测试案例集知识库是由BERT模型结合知识图谱构建得到的预设训练模型训练生成的;According to the semantic analysis result, search the test case set knowledge base to obtain the retrieval result, wherein the test case set knowledge base is generated by training a preset training model constructed by combining the BERT model and the knowledge graph;
若根据所述检索结果判定所述测试案例集知识库中存在相似案例集,则获取目标相似案例集;If it is determined according to the search result that there is a similar case set in the test case set knowledge base, then obtain a target similar case set;
利用知识图谱对所述案例关键词和所述目标相似案例集进行分析以,推理生成测试案例集。The knowledge graph is used to analyze the case keywords and the target similar case set to inferentially generate a test case set.
在一实施例中,所述获取案例关键词,对所述案例关键词进行语义分析,得到语义分析结果的步骤之前,还包括:In an embodiment, before the step of obtaining case keywords, performing semantic analysis on the case keywords, and obtaining a semantic analysis result, the method further includes:
根据无标注的第一训练测试案例集,对预设训练模型进行预处理训练,得到初始训练模型,其中,所述预设训练模型是基于BERT模型结合知识图谱构建得到的;Perform preprocessing training on the preset training model according to the unlabeled first training test case set to obtain the initial training model, where the preset training model is constructed based on the BERT model combined with the knowledge graph;
根据标注的第二训练测试案例集对所述初始训练模型进行微调训练,得到语言表征模型;Performing fine-tuning training on the initial training model according to the labeled second training test case set to obtain a language representation model;
通过所述语言表征模型对所述第一训练测试案例集和所述第二训练测试案例集进行分类,根据分类结果生成测试案例集知识库。The first training test case set and the second training test case set are classified by the language representation model, and a test case set knowledge base is generated according to the classification result.
在一实施例中,所述根据无标注的第一训练测试案例集,对预设训练模型进行预处理训练,得到初始训练模型的步骤包括:In an embodiment, the step of performing preprocessing training on the preset training model according to the unlabeled first training test case set to obtain the initial training model includes:
获取无标注的第一训练测试案例集的第一属性信息;Acquiring the first attribute information of the unlabeled first training test case set;
根据所述第一属性信息对所述第一训练测试案例集进行划分,得到多个第一训练测试案例子集;Dividing the first training test case set according to the first attribute information to obtain a plurality of first training test case subsets;
分别根据多个第一训练测试案例子集对预设训练模型进行预处理训练,得到对应的多个初始训练模型,其中,所述预设训练模型是基于BERT模型结合知识图谱构建得到的;Performing preprocessing training on the preset training model according to a plurality of first training test case subsets respectively to obtain a plurality of corresponding initial training models, wherein the preset training model is constructed based on the BERT model combined with the knowledge map;
所述根据标注的第二训练测试案例集对所述初始训练模型进行微调训练,得到训练好的语言表征模型的步骤包括:The step of performing fine-tuning training on the initial training model according to the labeled second training test case set, and obtaining a trained language representation model includes:
获取标注的第二训练测试案例集及其第二属性信息;Acquiring the labeled second training test case set and its second attribute information;
根据所述第二属性信息和所述第二训练测试集进行划分,得到多个第二训练测试案例子集;Divide according to the second attribute information and the second training test set to obtain a plurality of second training test case subsets;
分别根据多个第二训练测试案例子集对对应的初始训练模型进行微调训练,得到与所述第一属性信息对应的多个语言表征模型;Performing fine-tuning training on the corresponding initial training model according to a plurality of second training test case subsets, respectively, to obtain a plurality of language representation models corresponding to the first attribute information;
所述根据所述语言表征模型对所述第一训练测试案例集和所述第二训练测试案例集进行分类,根据分类结果生成测试案例集知识库的步骤包括:The step of classifying the first training test case set and the second training test case set according to the language representation model, and generating a test case set knowledge base according to the classification result includes:
通过多个语言表征模型对对应的第一训练测试案例子集和第二训练测试案例子集进行分类,得到与所述第一属性信息对应的多个测试案例集,并基于所述多个测试案例集生成测试案例集知识库。Classify the corresponding first training test case subset and the second training test case subset through multiple language representation models to obtain multiple test case sets corresponding to the first attribute information, and based on the multiple test cases The case set generates a test case set knowledge base.
在一实施例中,获取备选属性信息;In one embodiment, obtain candidate attribute information;
所述根据所述语义分析结果,检索测试案例集知识库以获取检索结果的步骤包括:According to the semantic analysis result, the step of retrieving the test case collection knowledge base to obtain the retrieval result includes:
在所述测试案例集知识库中确定与所述备选属性信息对应的目标测试案例集;Determining a target test case set corresponding to the candidate attribute information in the test case set knowledge base;
根据所述语义分析结果检索所述目标测试案例集,以获取所述案例关键词与所述目标测试案例集中测试案例的相似度,得到检索结果。The target test case set is retrieved according to the semantic analysis result to obtain the similarity between the case keywords and the test cases in the target test case set, and the retrieval result is obtained.
在一实施例中,所述根据所述语义分析结果检索所述目标测试案例集,以获取所述案例关键词与所述目标测试案例集中测试案例的相似度,得到检索结果的步骤之后,还包括:In one embodiment, after the step of retrieving the target test case set according to the semantic analysis result to obtain the similarity between the case keywords and the test cases in the target test case set, and obtaining the retrieval result, further include:
检测所述检索结果中的相似度是否大于或等于第一预设阈值;Detecting whether the similarity in the retrieval result is greater than or equal to a first preset threshold;
若所述相似度大于或等于所述第一预设阈值,则判定所述测试案例集知识库中存在与所述案例关键词对应的相同案例集,则获取目标相同案例集,并输出。If the similarity is greater than or equal to the first preset threshold, it is determined that the same case set corresponding to the case keyword exists in the test case set knowledge base, and the target same case set is obtained and output.
在一实施例中,所述检测所述检索结果中的相似度是否大于或等于第一预设阈值的步骤之后,还包括:In an embodiment, after the step of detecting whether the similarity in the retrieval result is greater than or equal to a first preset threshold, the method further includes:
若所述相似度小于所述第一预设阈值,则检测所述相似度是否大于第二预设阈值,其中,所述第二预设阈值小于所述第一预设阈值;If the similarity is less than the first preset threshold, detecting whether the similarity is greater than a second preset threshold, where the second preset threshold is less than the first preset threshold;
若所述相似度大于所述第二预设阈值,则判定所述测试案例集知识库中存在相似案例集,则执行步骤:获取目标相似案例集;If the similarity is greater than the second preset threshold, it is determined that there is a similar case set in the test case set knowledge base, and then the step is performed: obtaining a target similar case set;
若所述相似度小于或等于所述第二预设阈值,则输出提示信息以提示用户人工生成测试案例集。If the similarity is less than or equal to the second preset threshold, output prompt information to prompt the user to manually generate a test case set.
在一实施例中,所述输出提示信息以提示用户人工生成测试案例集的步骤之后,还包括:In an embodiment, after the step of outputting prompt information to prompt the user to manually generate a test case set, the method further includes:
获取用户人工生成的标注测试案例集;Obtain a set of labeled test cases manually generated by the user;
根据所述标注测试案例集更新所述测试案例集知识库。Update the test case set knowledge base according to the labeled test case set.
此外,为实现上述目的,本申请还提供一种测试案例集生成装置,所述测试案例集生成装置包括:In addition, in order to achieve the above-mentioned purpose, the present application also provides a test case set generating device, and the test case set generating device includes:
分析模块,用于获取案例关键词,对所述案例关键词进行语义分析,得到语义分析结果;The analysis module is used to obtain case keywords, perform semantic analysis on the case keywords, and obtain semantic analysis results;
检索模块,用于根据所述语义分析结果,检索测试案例集知识库以获取检索结果,其中,所述测试案例集知识库是由BERT模型结合知识图谱构建得到的预设训练模型训练生成的;The retrieval module is configured to retrieve the test case set knowledge base according to the semantic analysis result to obtain the retrieval result, wherein the test case set knowledge base is generated by training a preset training model constructed by combining the BERT model and the knowledge graph;
第一获取模块,用于若根据所述检索结果判定所述测试案例集知识库中存在相似案例集,则获取目标相似案例集;The first obtaining module is configured to obtain a target similar case set if it is determined that there is a similar case set in the test case set knowledge base according to the search result;
第一生成模块,用于利用知识图谱对所述案例关键词和所述目标相似案例集进行分析以生成测试案例集。The first generating module is configured to analyze the case keywords and the target similar case set by using the knowledge graph to generate a test case set.
此外,为实现上述目的,本申请还提供一种测试案例集生成设备,所述测试案例集生成设备包括:存储器、处理器及存储在所述存储器上并可在所述处理器上运行的测试案例集生成程序,所述测试案例集生成程序被所述处理器执行时实现如上所述的测试案例集生成方法的步骤。In addition, in order to achieve the above object, the present application also provides a test case set generating device, the test case set generating device including: a memory, a processor, and a test stored on the memory and running on the processor A case set generation program, when the test case set generation program is executed by the processor, the steps of the test case set generation method described above are implemented.
此外,为实现上述目的,本申请还提供一种计算机可读存储介质,所述计算机可读存储介质上存储有测试案例集生成程序,所述测试案例集生成程序被处理器执行时实现如上所述的测试案例集生成方法的步骤。In addition, in order to achieve the above object, the present application also provides a computer-readable storage medium, the computer-readable storage medium stores a test case set generation program, and the test case set generation program is executed by a processor to achieve the above The steps of the test case set generation method described.
本申请提供一种测试案例集方法、装置、设备及计算机可读存储介质,获取案例关键词,对所述案例关键词进行语义分析,得到语义分析结果;根据所述语义分析结果,检索测试案例集知识库以获取检索结果,其中,所述测试案例集知识库是由BERT模型结合知识图谱构建得到的预设训练模型训练生成的;若根据所述检索结果判定所述测试案例集知识库中存在相似案例集,则获取目标相似案例集;利用知识图谱对所述案例关键词和所述目标相似案例集进行分析以生成测试案例集。通过上述方式,可以利用已有的测试 案例集知识库,根据案例关键词在测试案例集知识库中进行检索以获取检索结果,之后,再根据检索结果中的目标相似案例集,利用知识图谱自动推理生成新的测试案例集。因此,本申请相比于现有技术,可以根据已有的测试案例集知识库自动推理生成新的测试案例集,从而能够提高测试案例集的生成效率。This application provides a test case collection method, device, equipment, and computer readable storage medium to obtain case keywords, perform semantic analysis on the case keywords, and obtain semantic analysis results; and retrieve test cases based on the semantic analysis results A knowledge base to obtain retrieval results, wherein the test case set knowledge base is generated by the training of a preset training model constructed by the BERT model combined with the knowledge graph; if the test case set knowledge base is determined according to the retrieval result If there is a set of similar cases, the target similar case set is obtained; the case keywords and the target similar case set are analyzed using the knowledge graph to generate a test case set. Through the above method, the existing test case set knowledge base can be used to search in the test case set knowledge base according to the case keywords to obtain the search results. Then, according to the target similar case set in the search results, the knowledge graph is used to automatically Reasoning to generate a new set of test cases. Therefore, compared with the prior art, the present application can automatically generate a new test case set based on the existing test case set knowledge base, thereby improving the generation efficiency of the test case set.
附图说明Description of the drawings
图1为本申请实施例方案涉及的硬件运行环境的设备结构示意图;FIG. 1 is a schematic diagram of a device structure of a hardware operating environment involved in a solution of an embodiment of the application;
图2为本申请测试案例集生成方法第一实施例的流程示意图;FIG. 2 is a schematic flowchart of a first embodiment of a method for generating a test case set of this application;
图3为本申请测试案例集生成装置第一实施例的功能模块示意图。FIG. 3 is a schematic diagram of the functional modules of the first embodiment of the apparatus for generating a test case set of this application.
本申请目的的实现、功能特点及优点将结合实施例,参照附图做进一步说明。The realization, functional characteristics, and advantages of the purpose of this application will be further described in conjunction with the embodiments and with reference to the accompanying drawings.
具体实施方式detailed description
应当理解,此处所描述的具体实施例仅仅用以解释本申请,并不用于限定本申请。It should be understood that the specific embodiments described here are only used to explain the present application, and are not used to limit the present application.
参照图1,图1为本申请实施例方案涉及的硬件运行环境的设备结构示意图。Referring to FIG. 1, FIG. 1 is a schematic diagram of the device structure of the hardware operating environment involved in the solution of the embodiment of the application.
本申请实施例测试案例集生成设备可以是智能手机,也可以是PC(Personal Computer,个人计算机)、平板电脑、便携计算机等终端设备。The test case set generating device in the embodiment of the present application may be a smart phone, or a terminal device such as a PC (Personal Computer, personal computer), a tablet computer, and a portable computer.
如图1所示,该测试案例集生成设备可以包括:处理器1001,例如CPU,通信总线1002,用户接口1003,网络接口1004,存储器1005。其中,通信总线1002用于实现这些组件之间的连接通信。用户接口1003可以包括显示屏(Display)、输入单元比如键盘(Keyboard),可选用户接口1003还可以包括标准的有线接口、无线接口。网络接口1004可选的可以包括标准的有线接口、无线接口(如Wi-Fi接口)。存储器1005可以是高速RAM存储器,也可以是稳定的存储器(non-volatile memory),例如磁盘存储器。存储器1005可选的还可以是独立于前述处理器1001的存储装置。As shown in FIG. 1, the test case set generating device may include: a processor 1001, such as a CPU, a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005. Among them, the communication bus 1002 is used to implement connection and communication between these components. The user interface 1003 may include a display screen (Display) and an input unit such as a keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a Wi-Fi interface). The memory 1005 may be a high-speed RAM memory, or a non-volatile memory (non-volatile memory), such as a magnetic disk memory. Optionally, the memory 1005 may also be a storage device independent of the aforementioned processor 1001.
本领域技术人员可以理解,图1中示出的测试案例集生成设备结构并不构 成对测试案例集生成设备的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件布置。Those skilled in the art can understand that the structure of the test case set generating device shown in FIG. 1 does not constitute a limitation on the test case set generating device, and may include more or less components than shown in the figure, or a combination of certain components, Or different component arrangements.
如图1所示,作为一种计算机存储介质的存储器1005中可以包括操作系统、网络通信模块、用户接口模块以及测试案例集生成程序。As shown in FIG. 1, the memory 1005 as a computer storage medium may include an operating system, a network communication module, a user interface module, and a test case set generation program.
在图1所示的终端中,网络接口1004主要用于连接后台服务器,与后台服务器进行数据通信;用户接口1003主要用于连接客户端,与客户端进行数据通信;而处理器1001可以用于调用存储器1005中存储的测试案例集生成程序,并执行以下测试案例集生成方法的各个步骤。In the terminal shown in FIG. 1, the network interface 1004 is mainly used to connect to a back-end server and communicate with the back-end server; the user interface 1003 is mainly used to connect to a client and communicate with the client; and the processor 1001 can be used to Call the test case set generation program stored in the memory 1005, and execute each step of the following test case set generation method.
基于上述硬件结构,提出本申请测试案例集生成方法的各实施例。Based on the above hardware structure, various embodiments of the method for generating a test case set of the present application are proposed.
本申请提供一种测试案例集生成方法。This application provides a method for generating a test case set.
参照图2,图2为本申请测试案例集生成方法第一实施例的流程示意图。Referring to FIG. 2, FIG. 2 is a schematic flowchart of a first embodiment of a method for generating a test case set of this application.
在本实施例中,该测试案例集生成方法包括:In this embodiment, the method for generating a test case set includes:
步骤S10,获取案例关键词,对所述案例关键词进行语义分析,得到语义分析结果;Step S10, obtaining case keywords, performing semantic analysis on the case keywords, and obtaining semantic analysis results;
本实施例的测试案例集生成方法是由测试案例集生成设备实现的,该设备搭载有测试案例集生成器。The method for generating a test case set of this embodiment is implemented by a test case set generating device, which is equipped with a test case set generator.
在本实施例中,测试案例集是开发人员以及测试人员在产品开发过程中可能使用到的一些测试场景以及对应的预期测试结果,在一实施例中,包括一些异常场景的相关测试信息,如对于一个登陆界面,测试案例集可以包括中文登陆名、英文登录名、特殊字符登录名等不同的使用场景,同时还包括在这些不同测试场景下进行测试时的测试结果。当需要生成新的测试案例集时,工作人员可通过工作端的对应软件输入想要生成的测试案例集的案例关键词,如“登陆”,以触发测试案例集生成指令,此时,测试案例集生成器接收到该测试案例集生成指令时,获取工作人员输入的案例关键词,然后对案例关键词进行语义分析,以利用语义分析进行上下文有关性质的审查,从而得到相应的语义分析结果,其中,本申请中采用的语义分析方法为常用的语义分析方法,如潜在语义分析等。In this embodiment, the test case set is some test scenarios that may be used by developers and testers in the product development process and the corresponding expected test results. In one embodiment, it includes test information related to some abnormal scenarios, such as For a login interface, the test case set can include different usage scenarios such as Chinese login name, English login name, and special character login name, as well as test results when tested in these different test scenarios. When a new test case set needs to be generated, the staff can input the case keywords of the test case set they want to generate through the corresponding software on the working end, such as "login", to trigger the test case set generation instruction. At this time, the test case set When the generator receives the test case set generation instruction, it obtains the case keywords input by the staff, and then performs semantic analysis on the case keywords to use the semantic analysis to conduct context-sensitive examinations, thereby obtaining the corresponding semantic analysis results. , The semantic analysis method used in this application is a commonly used semantic analysis method, such as latent semantic analysis.
步骤S20,根据所述语义分析结果,检索测试案例集知识库以获取检索结果,其中,所述测试案例集知识库是由BERT模型结合知识图谱构建得到的 预设训练模型训练生成的;Step S20: According to the semantic analysis result, search the test case set knowledge base to obtain the search result, wherein the test case set knowledge base is generated by training a preset training model constructed by combining the BERT model and the knowledge graph;
然后,根据语义分析结果,检索测试案例集知识库以获取检索结果。Then, according to the semantic analysis result, the test case set knowledge base is retrieved to obtain the retrieval result.
其中,测试案例集知识库中包含所有与产品相关的案例集,测试案例集知识库由BERT模型结合知识图谱构建得到的预设训练模型训练生成。其中,BERT(Bidirectional Encoder Representations from Transformers,一种基于神经网络的自然语言处理预训练的技术)可以很好的处理自然语言语义分析、分类等场景,但也存在一些不足,例如,常识的缺失。测试案例需要大量的测试背景知识支持,BERT学习到的是文本匹配模型,大量的测试背景常识是隐式且模糊的,很难在预训练数据中体现;同时还缺乏对语义的理解,缺乏推理能力,因此在预训练过程中融入知识图谱信息,可以组织测试中的知识,基于符号语义的计算模型,可以为BERT提供先验知识,使其具备一定的测试常识和推理能力。因此在本申请中利用BERT结合知识图谱的预设训练模型训练生成测试案例集知识库,可使得测试案例集知识库能够知道不同的测试常识并利用测试常识推理生成新的测试案例集。Among them, the test case set knowledge base contains all product-related case sets, and the test case set knowledge base is generated by training a preset training model constructed by combining the BERT model with the knowledge graph. Among them, BERT (Bidirectional Encoder Representations from Transformers, a natural language processing pre-training technology based on neural networks) can handle natural language semantic analysis, classification and other scenarios very well, but there are some shortcomings, for example, the lack of common sense. Test cases require a large amount of test background knowledge support. What BERT learns is a text matching model. A large amount of test background common sense is implicit and vague, and it is difficult to reflect in the pre-training data. At the same time, it lacks semantic understanding and reasoning. Therefore, the knowledge map information is incorporated in the pre-training process to organize the knowledge under test. The calculation model based on symbolic semantics can provide prior knowledge for BERT, so that it has certain test common sense and reasoning ability. Therefore, in this application, BERT is used in combination with the preset training model training of the knowledge graph to generate a test case set knowledge base, which can enable the test case set knowledge base to know different test common sense and use the test common sense inference to generate a new test case set.
检索结果是对于案例关键词进行语义分析后与测试案例集知识库中已有案例的相似度,根据相似度,检索结果一般包括完全相同、相似、基本不相同等三种不同的检索结果。The search result is the similarity between the case keywords and the existing cases in the test case set knowledge base after semantic analysis. According to the similarity, the search results generally include three different search results: identical, similar, and basically different.
步骤S30,若根据所述检索结果判定所述测试案例集知识库中存在相似案例集,则获取目标相似案例集。Step S30: If it is determined according to the search result that there is a similar case set in the test case set knowledge base, then a target similar case set is obtained.
若根据检索结果判定测试案例集知识库中存在相似案例集,则获取目标相似案例集。具体的,对于输入的案例关键词,根据其语义分析结果,与测试案例集知识库中的测试集进行比较,获取与各测试集的相似度,其中,同时将与不同测试集的相似度值中相似度最大的作为最终的检索结果并将与最大相似度值对应的案例集作为目标相似案例集。If it is determined according to the search result that there is a similar case set in the test case set knowledge base, then the target similar case set is obtained. Specifically, for the input case keywords, according to the semantic analysis results, compare with the test set in the test case set knowledge base to obtain the similarity with each test set. Among them, the similarity value with different test sets will be obtained at the same time. The one with the largest similarity is used as the final retrieval result, and the case set corresponding to the largest similarity value is used as the target similar case set.
步骤S40,利用知识图谱对所述案例关键词和所述目标相似案例集进行分析以生成测试案例集;Step S40, using the knowledge graph to analyze the case keywords and the target similar case set to generate a test case set;
最后,利用知识图谱对案例关键词和目标相似案例集进行分析,推理生成测试案例集。知识图谱为知识域可视化或知识领域映射地图,是显示知识发展进程与结构关系的一系列各种不同的图形。知识图谱的推理包括演绎推理和归纳推理,由于归纳推理可以增加新知识,因此,本申请中主要是使用 归纳推理。归纳推理还可以使用FOIL(First Order Inductive Learner,第一顺序电感学习)算法、不完备知识库的关联规则挖掘算法以及路径排序算法。具体的,先利用上述一种或多种算法对目标相似案例集进行学习或构建规则,再根据案例关键词及目标相似案例集中的实体按照学习或构建得到的规则推理出新的实体,进而基于推理得到新的实体即可构建得到测试案例集。如输入的案例关键词为登陆密码,已有的目标相似案例集为登陆名,则利用登陆密码与登陆名可以推理生成与登陆密码相关的测试案例集。Finally, use the knowledge graph to analyze case keywords and target similar case sets, and generate test case sets by reasoning. The knowledge map is a knowledge domain visualization or a knowledge domain mapping map, which is a series of various graphs showing the relationship between the development process of knowledge and the structure. The reasoning of the knowledge graph includes deductive reasoning and inductive reasoning. Since inductive reasoning can add new knowledge, inductive reasoning is mainly used in this application. Inductive reasoning can also use FOIL (First Order Inductive Learner) algorithm, association rule mining algorithm of incomplete knowledge base, and path sorting algorithm. Specifically, first use one or more of the above algorithms to learn or construct rules for the target similar case set, and then infer new entities based on the case keywords and the entities in the target similar case set according to the learned or constructed rules. The new entity can be constructed by reasoning to get the test case set. If the entered case keyword is the login password, and the existing target similar case set is the login name, the login password and login name can be used to inferentially generate a test case set related to the login password.
本申请实施例提供一种测试案例集生成方法,获取案例关键词,对所述案例关键词进行语义分析,得到语义分析结果;根据所述语义分析结果,检索测试案例集知识库以获取检索结果,其中,所述测试案例集知识库是由BERT模型结合知识图谱构建得到的预设训练模型训练生成的;若根据所述检索结果判定所述测试案例集知识库中存在相似案例集,则获取目标相似案例集;利用知识图谱对所述案例关键词和所述目标相似案例集进行分析,推理生成测试案例集。通过上述方式,可以利用已有的测试案例集知识库,根据案例关键词在测试案例集知识库中进行检索以获取检索结果,之后,再根据检索结果中的目标相似案例集,利用知识图谱自动推理生成新的测试案例集。因此,本申请相比于现有技术,可以根据已有的测试案例集知识库自动推理生成新的测试案例集,从而能够提高测试案例集的生成效率。The embodiment of the application provides a method for generating a test case set, obtaining case keywords, performing semantic analysis on the case keywords, and obtaining a semantic analysis result; according to the semantic analysis result, searching the test case set knowledge base to obtain the retrieval result , Wherein the test case set knowledge base is generated by training a preset training model constructed by the BERT model combined with the knowledge graph; if it is determined that there is a similar case set in the test case set knowledge base according to the search result, then obtain Target similar case set; use the knowledge graph to analyze the case keywords and the target similar case set, and reason to generate a test case set. Through the above method, the existing test case set knowledge base can be used to search in the test case set knowledge base according to the case keywords to obtain the search results. Then, according to the target similar case set in the search results, the knowledge graph is used to automatically Reasoning to generate a new set of test cases. Therefore, compared with the prior art, the present application can automatically generate a new test case set based on the existing test case set knowledge base, thereby improving the generation efficiency of the test case set.
进一步地,基于图2所示的第一实施例,提出本申请测试案例集生成方法的第二实施例。Further, based on the first embodiment shown in FIG. 2, a second embodiment of the method for generating a test case set of the present application is proposed.
在本实施例中,在上述步骤S10之前,该测试案例集生成方法还包括:In this embodiment, before step S10, the method for generating a test case set further includes:
步骤A,根据无标注的第一训练测试案例集,对预设训练模型进行预处理训练,得到初始训练模型,其中,所述预设训练模型是基于BERT模型结合知识图谱构建得到的;Step A: Perform preprocessing training on the preset training model according to the unlabeled first training test case set to obtain the initial training model, where the preset training model is constructed based on the BERT model combined with the knowledge graph;
本实施例中,先根据无标注的第一训练测试案例集,对预设训练模型进行预处理训练,得到初始训练模型,其中,预设训练模型是基于BERT模型结合知识图谱构建得到的。In this embodiment, the preset training model is preprocessed according to the unlabeled first training test case set to obtain the initial training model, where the preset training model is constructed based on the BERT model combined with the knowledge graph.
其中,无标注的第一训练测试案例集是之前已经存储的测试案例集。预设训练模型是基于BERT模型结合知识图谱构建得到的,BERT可以很好的处 理自然语言语义分析、分类等场景,但也存在一些不足,例如,常识的缺失。测试案例需要大量的测试背景知识支持,BERT学习到的是文本匹配模型,大量的测试背景常识是隐式且模糊的,很难在预训练数据中体现;同时还缺乏对语义的理解,缺乏推理能力,因此在预训练过程中融入知识图谱信息,可以组织测试中的知识,基于符号语义的计算模型,可以为BERT提供先验知识,使其具备一定的测试常识和推理能力。BERT在大量的测试案例语料库上进行预训练的方式来实现对于测试案例文本语义的理解。具体地,BERT先随机隐藏掉一些测试中单词,然后再通过上下文预测的方式来实现语言表征,得到初始训练模型。例如,对于“迪伦在1962年创作了《答案在风中飘扬》,并在2004年写了《历代志:第一册》”这一语句,BERT可以随机隐藏其中的“迪伦”、“1962”、“答案在风中飘扬”等词语,但是通过不断的训练,模型可以判断这几个词之间存在关系并可以存储这几个词之间的关系,从而能够使模型可以知道词语间的关系,即语言表征。需要说明的是,在预处理训练过程之前,将BERT与知识图谱结合,利用了知识图谱中的多信息实体(如上例中的迪伦、《答案在风中飘扬》等一个个具体的实例)来作为外部知识改善语言表征,使模型能够知道每个词语本身的含义、而不只是多个词语之间的关系,同时实现了结构化的知识编码和异质信息融合(其中,结构化的知识编码的实现方式即为:将抽象的知识变为向量等形式,用于语言表征,但由于知识和文本的向量表示空间不同,通过预设效率模型将文本与知识融合在统一的特征空间中;异质信息即为词汇、句法和知识信息等不同类型的信息),实现了在BERT模型的基础上,融合知识图谱构建出预设训练模型。具体地,对于抽象的知识信息,需要将它们进行编码,这样才能够将知识用于语言表征,同时BERT预训练时对单词的编码和对知识的编码是不同的,虽然都是将其转化为向量,但是却位于不同的向量空间,因此就需要对模型进行设计,来实现对于词汇、句法和知识信息等异质信息的融合,而BERT结合知识图谱的模型可以解决上述的问题。Among them, the unlabeled first training test case set is the test case set that has been stored before. The preset training model is constructed based on the BERT model combined with the knowledge graph. BERT can handle natural language semantic analysis, classification and other scenarios very well, but there are some shortcomings, such as the lack of common sense. Test cases require a large amount of test background knowledge support. What BERT learns is a text matching model. A large amount of test background common sense is implicit and vague, and it is difficult to reflect in the pre-training data. At the same time, it lacks semantic understanding and reasoning. Therefore, the knowledge map information is incorporated in the pre-training process to organize the knowledge under test. The calculation model based on symbolic semantics can provide prior knowledge for BERT, so that it has certain test common sense and reasoning ability. BERT conducts pre-training on a large number of test case corpora to realize the understanding of the semantics of the test case text. Specifically, BERT first randomly hides some words under test, and then implements language representation through context prediction to obtain the initial training model. For example, for the sentence "Dylan wrote "Answers in the Wind" in 1962 and "Chronicles: Book One" in 2004, BERT can randomly hide "Dylan" and " 1962", "Answer is flying in the wind" and other words, but through continuous training, the model can determine the relationship between these words and can store the relationship between these words, so that the model can know the relationship between words The relationship of the linguistic representation. It should be noted that before the pre-processing training process, the BERT is combined with the knowledge graph, and the multi-information entities in the knowledge graph are used (such as Dylan in the above example, "Answers in the Wind" and other specific examples) Used as external knowledge to improve language representation, so that the model can know the meaning of each word itself, not just the relationship between multiple words, and at the same time achieve structured knowledge coding and heterogeneous information fusion (among which, structured knowledge The way of encoding is to transform abstract knowledge into vectors and other forms for language representation. However, because the vector representation spaces of knowledge and text are different, the text and knowledge are merged into a unified feature space through a preset efficiency model; Heterogeneous information refers to different types of information such as vocabulary, syntax, and knowledge information), which realizes that on the basis of the BERT model, a preset training model is constructed by fusing the knowledge graph. Specifically, for abstract knowledge information, they need to be encoded so that knowledge can be used for language representation. At the same time, the encoding of words and the encoding of knowledge during BERT pre-training are different, although they are both converted into The vector is located in a different vector space. Therefore, it is necessary to design the model to realize the fusion of heterogeneous information such as vocabulary, syntax and knowledge information. The BERT combined with the knowledge graph model can solve the above problems.
步骤B,根据标注的第二训练测试案例集对所述初始训练模型进行微调训练,得到语言表征模型;Step B: Perform fine-tuning training on the initial training model according to the labeled second training test case set to obtain a language representation model;
然后,根据标注的第二训练测试案例集对初始训练模型进行微调训练,得到语言表征模型。Then, the initial training model is fine-tuned and trained according to the labeled second training test case set to obtain the language representation model.
其中,标注的第二训练测试集是原本已有的第一训练测试案例集中没有的训练测试集,如新的登录名的测试案例集。通过标注的第二训练测试案例集可以对第一训练测试集进行补充,从而使得到的语言表征模型更加全面,构建得到更符合真正测试场景的测试案例集知识库。Among them, the labeled second training test set is a training test set that is not in the existing first training test case set, such as a test case set of a new login name. The labeled second training test case set can supplement the first training test set, so that the resulting language representation model is more comprehensive, and a test case set knowledge base that is more in line with the real test scenario can be constructed.
微调训练过程由文本编码器和知识编码器两个模块完成。文本编码器负责获取第二训练测试案例集的输入标记的词法和句法等语义信息,对标记向量、分割向量和位置向量进行求和来获得输入向量,然后通过多层的双向转换编码器来实现对于语义特征的提取。知识编码器将额外的面向实体的知识信息整合到来自底层的文本信息中,这样就可以在一个统一的特征空间中表征标记和实体的异构信息。用{w 1,…,w n}表示标记序列的向量,用{e 1,…,e n}来表示该序列中实体的向量。两序列按如下公式计算: The fine-tuning training process is completed by two modules: text encoder and knowledge encoder. The text encoder is responsible for obtaining the semantic information such as the morphology and syntax of the input tags of the second training test case set, and the tag vector, segmentation vector and position vector are summed to obtain the input vector, and then implemented by the multi-layer two-way conversion encoder For the extraction of semantic features. The knowledge encoder integrates additional entity-oriented knowledge information into the text information from the bottom layer, so that the heterogeneous information of tags and entities can be represented in a unified feature space. Represents vector sequences labeled by {w 1, ..., w n }, with {e 1, ..., e n } be a vector representing the sequence entity. The two sequences are calculated according to the following formula:
Figure PCTCN2021081873-appb-000001
Figure PCTCN2021081873-appb-000001
Figure PCTCN2021081873-appb-000002
Figure PCTCN2021081873-appb-000002
其中,MH-ATT是attention(关注)层。Among them, MH-ATT is the attention layer.
再将序列中的标记与相应的实体对齐(实体与对应的首位标记对齐),然后将这样的序列输入到信息融合层当中,信息融合层的计算步骤如下:Then align the marks in the sequence with the corresponding entities (the entities are aligned with the corresponding first mark), and then input such a sequence into the information fusion layer. The calculation steps of the information fusion layer are as follows:
Figure PCTCN2021081873-appb-000003
Figure PCTCN2021081873-appb-000003
Figure PCTCN2021081873-appb-000004
Figure PCTCN2021081873-appb-000004
Figure PCTCN2021081873-appb-000005
Figure PCTCN2021081873-appb-000005
其中,h j表示融合标记和实体信息的内部隐藏状态,b表示偏置,W t代表隐藏层中的权重,σ()为非线性激活函数。 Among them, h j represents the internal hidden state of the fusion mark and entity information, b represents the bias, W t represents the weight in the hidden layer, and σ() is the non-linear activation function.
通过上述的微调过程,得到语言表征模型,以便于后续基于语言表征模型得到测试案例集知识库。Through the above-mentioned fine-tuning process, the language representation model is obtained, so that the test case set knowledge base can be obtained subsequently based on the language representation model.
步骤C,通过所述语言表征模型对所述第一训练测试案例集和所述第二训练测试案例集进行分类,根据分类结果生成测试案例集知识库;Step C: Classify the first training test case set and the second training test case set through the language representation model, and generate a test case set knowledge base according to the classification result;
最后,通过语言表征模型对第一训练测试案例集和第二训练测试案例集进行分类,根据分类结果生成测试案例集知识库。具体的,语言表征模型是基于概率分布计算公式得到不同训练测试案例集的分类,进而最终生成测试案例集知识库,其中,预测的概率分布计算公式如下所示:Finally, the first training test case set and the second training test case set are classified through the language representation model, and the test case set knowledge base is generated according to the classification results. Specifically, the language representation model obtains the classification of different training test case sets based on the probability distribution calculation formula, and finally generates the test case set knowledge base, where the predicted probability distribution calculation formula is as follows:
Figure PCTCN2021081873-appb-000006
Figure PCTCN2021081873-appb-000006
其中,linear()代表线性层。Among them, linear() represents the linear layer.
即对不同的训练测试案例集中的各个案例分类,将属于同一类的案例合为同一类案例,进而由不同类的案例构建得到测试案例集知识库,进而,如对于用户名与密码,其都可以属于登陆案例。That is, to classify each case in different training test case sets, combine the cases belonging to the same type into the same type of case, and then construct the test case set knowledge base from different types of cases, and then, for example, for the user name and password, both are It can be a landing case.
本实施例中,根据无标注的第一训练测试案例集,对预设训练模型进行预处理训练,得到初始训练模型,其中,所述预设训练模型是基于BERT模型结合知识图谱构建得到的;根据标注的第二训练测试案例集对所述初始训练模型进行微调训练,得到语言表征模型;通过所述语言表征模型对所述第一训练测试案例集和所述第二训练测试案例集进行分类,根据分类结果生成测试案例集知识库。根据预训练过程以及微调训练过程对于训练模型进行训练得到测试案例集知识库,实现了对于不同的测试案例集进行分类,便于之后的检索,从而提高后续测试案例集生成的效率,此外,通过预训练过程和微调训练过程对模型进行训练,之后按照训练的模型对训练测试案例集进行分类,最终生成测试案例集知识库,相比于传统的人工编写测试案例本申请更加贴切实例的案例,进一步提高了测试案例生成的准确性。In this embodiment, preprocessing training is performed on the preset training model according to the unlabeled first training test case set to obtain the initial training model, where the preset training model is constructed based on the BERT model combined with the knowledge graph; Perform fine-tuning training on the initial training model according to the labeled second training test case set to obtain a language representation model; classify the first training test case set and the second training test case set through the language representation model , According to the classification results to generate a test case set knowledge base. According to the pre-training process and fine-tuning the training process, the training model is trained to obtain the test case set knowledge base, which realizes the classification of different test case sets to facilitate subsequent retrieval, thereby improving the efficiency of subsequent test case set generation. In addition, through pre-training The training process and fine-tuning the training process to train the model, and then classify the training test case set according to the trained model, and finally generate a test case set knowledge base. Compared with the traditional manual writing test case, this application is more relevant to the case of the example. Improved the accuracy of test case generation.
进一步地,基于上述各实施例,提出本申请测试案例集生成方法的第三实施例。Further, based on the foregoing embodiments, a third embodiment of the method for generating a test case set of the present application is proposed.
在本实施例中,步骤A包括:In this embodiment, step A includes:
步骤a1,获取无标注的第一训练测试案例集的第一属性信息;Step a1: Obtain the first attribute information of the unlabeled first training test case set;
步骤a2,根据所述第一属性信息对所述第一训练测试案例集进行划分,得到多个第一训练测试案例子集;Step a2, dividing the first training test case set according to the first attribute information to obtain multiple first training test case subsets;
步骤a3,分别根据多个第一训练测试案例子集对预设训练模型进行预处理训练,得到对应的多个初始训练模型,其中,所述预设训练模型是基于BERT模型结合知识图谱构建得到的。Step a3: Perform preprocessing training on the preset training model according to a plurality of first training test case subsets to obtain corresponding multiple initial training models, wherein the preset training model is constructed based on the BERT model combined with the knowledge map of.
本实施例中,可根据属性信息对训练测试案例集(包括第一训练测试案例集和第二训练测试案例集)进行划分,以训练得到多个不同属性信息对应的语言表征模型,进而结合语言表征模型的分类结果及属性信息进行分类, 并构建测试案例集知识库。In this embodiment, the training test case set (including the first training test case set and the second training test case set) can be divided according to the attribute information, so as to train to obtain multiple language representation models corresponding to different attribute information, and then combine the language The classification results and attribute information of the characterization model are classified, and the test case set knowledge base is constructed.
具体的,先获取无标注的第一训练测试案例集的第一属性信息;然后,根据第一属性信息对第一训练测试案例集进行划分,得到多个第一训练测试案例子集。Specifically, first obtain the first attribute information of the unlabeled first training test case set; then, divide the first training test case set according to the first attribute information to obtain a plurality of first training test case subsets.
本实施例中,,训练模型输入源由测试知识公共库、BUG数据库、业务场景库和训练数据库这四部分组成,测试知识公共库主要是常见的具有业务共性的测试用例,例如登录、密码校验等;BUG数据库是生产上发现的BUG用例;业务场景库是在特定业务场景下编写的测试用例集合,训练数据库是在TCTP平台人工标注的测试用例集。训练参数案例集会按照全量产品案例、特定项目产品案例、个性化编写案例三个纬度的训练数据分别进行训练,对应的,第一属性信息可以包括全量产品案例、特定项目产品案例、个性化编写案例等不同属性。全量产品案例如为保险等一类产品的测试案例集,项目产品案例为如登录等特定产品的测试案例集,个性化保险案例可为与每个编写人员关联的测试案例集。In this embodiment, the training model input source is composed of four parts: the test knowledge public database, the BUG database, the business scenario database, and the training database. The test knowledge public database is mainly common test cases with business commonality, such as login and password verification. The BUG database is a set of BUG use cases found in production; the business scenario library is a collection of test cases written in a specific business scenario, and the training database is a set of test cases manually annotated on the TCTP platform. The training parameter case set will be trained according to the training data of three latitudes: full product cases, specific project product cases, and personalized writing cases. Correspondingly, the first attribute information can include full product cases, specific project product cases, and personalized writing cases. And other different attributes. The full product case is, for example, a set of test cases for a type of product such as insurance, and the project product case is a set of test cases for a specific product such as login, and a personalized insurance case can be a set of test cases associated with each writer.
对于不同属性的第一训练测试案例子集,其形成的初始训练模型中相同案例的分类结果可能不同,同时不同实体间的关联关系可能存在差异。从而分别根据多个第一训练测试案例子集对预设训练模型进行预处理训练,得到对应的多个初始训练模型,其中,预设训练模型是基于BERT模型结合知识图谱构建得到的。For the first training test case subset with different attributes, the classification results of the same case in the initial training model formed by it may be different, and the association relationship between different entities may be different. In this way, the preset training models are preprocessed according to a plurality of first training test case subsets respectively to obtain corresponding multiple initial training models, where the preset training models are constructed based on the BERT model combined with the knowledge graph.
此时,步骤B包括:At this point, step B includes:
步骤b1,获取标注的第二训练测试案例集及其第二属性信息;Step b1: Obtain the labeled second training test case set and its second attribute information;
步骤b2,根据所述第二属性信息和所述第二训练测试集进行划分,得到多个第二训练测试案例子集;Step b2, dividing according to the second attribute information and the second training test set to obtain a plurality of second training test case subsets;
步骤b3,分别根据多个第二训练测试案例子集对对应的初始训练模型进行微调训练,得到与所述第二属性信息对应的多个语言表征模型。Step b3: Perform fine-tuning training on the corresponding initial training model according to a plurality of second training test case subsets, respectively, to obtain multiple language representation models corresponding to the second attribute information.
对于标注的第二训练测试案例集,与第一训练测试案例集类似,根据第二训练测试案例集的第二属性信息,分别确定与其第二属性信息匹配的初始训练模型,将第二训练测试案例集中根据第二属性信息添加到对应的初始训练模型中进行微调训练,得到多个语言表征模型。For the labeled second training test case set, similar to the first training test case set, according to the second attribute information of the second training test case set, the initial training model that matches the second attribute information is determined, and the second training test In the case set, the second attribute information is added to the corresponding initial training model for fine-tuning training, and multiple language representation models are obtained.
基于上述方式生成语言表征模型,根据属性信息确定不同的语言表征模 型,从而可以获取不同属性的模型,得到的语言表征模型的分类结果更加准确,同时增加语言表征模型的多样性以适应不同的测试场景。Generate a language representation model based on the above method, and determine different language representation models based on the attribute information, so that models of different attributes can be obtained, and the classification results of the obtained language representation models are more accurate, and the diversity of language representation models is increased to adapt to different tests. Scenes.
此时,步骤C包括:At this point, step C includes:
步骤c1,通过多个语言表征模型对对应的第一训练测试案例子集和第二训练测试案例子集进行分类,得到与所述第一属性信息对应的多个测试案例集,并基于所述多个测试案例集生成测试案例集知识库;Step c1: Classify the corresponding first training test case subset and the second training test case subset through multiple language representation models to obtain multiple test case sets corresponding to the first attribute information, and based on the Multiple test case sets generate test case set knowledge base;
将多个不同属性的语言表征模型一起组成装置的测试案例集知识库。测试案例集知识库包括案例、属性(全量产品案例、特定项目产品案例、个性化产品案例、个性化编写案例)以及测试集。对于不同的测试集,会分类到对应的案例中,同时对于同一测试集,根据属性的不同,可能会在不同属性的测试案例集子知识库中对应不同的案例。Multiple language representation models with different attributes are combined to form the device's test case set knowledge base. The test case set knowledge base includes cases, attributes (full product cases, specific project product cases, personalized product cases, personalized writing cases) and test sets. For different test sets, they will be classified into corresponding cases. At the same time, for the same test set, according to different attributes, different cases may correspond to different cases in the test case set sub-knowledge base of different attributes.
本实施例中,将多个不同属性的语音表征模型组成最终的测试案例集知识库,从而保证测试案例集知识库的完整,也使测试案例集能够根据不同的属性匹配更多的使用场景,更进一步提高了测试案例集生成的准确度,同时,可在工作人员进行检索时,基于输入的备选属性信息缩小检索范围,提供检索效率,进而提高测试案例集的生成效率。In this embodiment, multiple speech representation models with different attributes are formed into the final test case set knowledge base, so as to ensure the integrity of the test case set knowledge base, and also enable the test case set to match more usage scenarios according to different attributes. It further improves the accuracy of the test case set generation. At the same time, when the staff searches, the search range can be narrowed based on the input candidate attribute information, and the retrieval efficiency is improved, thereby improving the generation efficiency of the test case set.
进一步地,基于上述各实施例,提出本申请测试案例集生成方法的第四实施例。Further, based on the foregoing embodiments, a fourth embodiment of the method for generating a test case set of the present application is proposed.
在本实施例中,在上述步骤S20之后,该测试案例集生成方法还包括:In this embodiment, after the above step S20, the method for generating a test case set further includes:
步骤D,获取备选属性信息;Step D, obtain candidate attribute information;
本实施例中,工作人员在触发测试案例集生成指令时,除可输入案例关键词外,还可以输入备选属性信息,其中,备选属性信息即为待生成的测试案例集对应的属性信息,同时备选属性信息与测试案例集知识库各语言表征模型的属性信息对应,即之后在检索时利用备选属性信息给出相关联的测试案例集,对应的,测试案例集生成器可先获取备选属性信息。In this embodiment, when the worker triggers the test case set generation instruction, in addition to the case keywords, he can also input candidate attribute information, where the candidate attribute information is the attribute information corresponding to the test case set to be generated At the same time, the candidate attribute information corresponds to the attribute information of each language representation model of the test case set knowledge base, that is, the candidate attribute information is used to give the associated test case set during retrieval. Correspondingly, the test case set generator can first Get candidate attribute information.
步骤S20包括:Step S20 includes:
步骤E,在所述测试案例集知识库中确定与所述备选属性信息对应的目标测试案例集;Step E: Determine a target test case set corresponding to the candidate attribute information in the test case set knowledge base;
步骤F,根据所述语义分析结果检索所述目标测试案例集,以获取所述案 例关键词与所述目标测试案例集中测试案例的相似度,得到检索结果;Step F: Retrieve the target test case set according to the semantic analysis result to obtain the similarity between the keyword of the case and the test case in the target test case set to obtain the retrieval result;
然后,在测试案例集知识库中确定与备选属性信息对应的目标测试案例集,进而根据语义分析结果检索目标测试案例集,以获取案例关键词与目标测试案例集中测试案例的相似度,得到检索结果。Then, determine the target test case set corresponding to the candidate attribute information in the test case set knowledge base, and then retrieve the target test case set according to the semantic analysis result to obtain the similarity between the case keywords and the test cases in the target test case set, and get search result.
当选定一个或多个备选属性信息后,输出结果根据测试属性关联的案例给出符合该属性的测试案例集。同时在检索过程中,根据选定的备选属性信息,只会检索属性信息与备选属性信息相同的测试案例集知识库中的那个语言表征模型。如备选属性为特定项目产品案例集,则只检索属性为特定产品案例集的测试案例集知识库,而不用检索全量产品案例和个性化编写案例,可以通过检索过程中的效率,同时检索结果也更加准确。通过案例关键词与对应属性的测试案例集中测试案例的相似度,确定相应的检索结果。When one or more candidate attribute information is selected, the output result gives a set of test cases that conform to the attribute according to the cases associated with the test attribute. At the same time, in the retrieval process, according to the selected candidate attribute information, only the language representation model in the test case set knowledge base whose attribute information is the same as the candidate attribute information is retrieved. If the candidate attribute is a specific project product case set, only the test case set knowledge base whose attribute is a specific product case set is retrieved, instead of retrieving the full product case and personalized writing case, the results can be retrieved at the same time through the efficiency of the retrieval process Also more accurate. According to the similarity between the case keywords and the test cases in the test case set of the corresponding attributes, the corresponding retrieval results are determined.
通过上述方式,本实施例可检索过程中根据备选属性信息缩小需要检索的测试案例集知识库的范围,从而通过检索的效率以及准确性。Through the above method, this embodiment can narrow the range of the test case set knowledge base that needs to be retrieved according to the candidate attribute information in the retrieval process, thereby passing the efficiency and accuracy of retrieval.
进一步地,基于上述各实施例,提出本申请测试案例集生成方法的第五实施例。Further, based on the foregoing embodiments, a fifth embodiment of the method for generating a test case set of the present application is proposed.
在本实施例中,步骤S20之后包括:In this embodiment, step S20 includes:
步骤G,检测所述检索结果中的相似度是否大于或等于第一预设阈值;Step G, detecting whether the similarity in the retrieval result is greater than or equal to a first preset threshold;
步骤H,若所述相似度大于或等于所述第一预设阈值,则判定所述测试案例集知识库中存在与所述案例关键词对应的相同案例集,则获取目标相同案例集,并输出;Step H: If the similarity is greater than or equal to the first preset threshold, it is determined that the same case set corresponding to the case keyword exists in the test case set knowledge base, then the target same case set is obtained, and Output
本实施例中,检测检索结果中的相似度是否大于或等于第一预设阈值,当相似度大于或等于第一预设阈值时,说明当前测试案例集知识库已经存在与输入的案例关键词相同的案例集,则直接根据相似度确定目标相同案例集并输出,即可输出需要的测试案例集。In this embodiment, it is detected whether the similarity in the search result is greater than or equal to the first preset threshold. When the similarity is greater than or equal to the first preset threshold, it indicates that the current test case set knowledge base already exists and the input case keyword For the same case set, the target same case set is directly determined according to the similarity and output, and then the required test case set can be output.
进一步地,步骤H之后,还包括:Further, after step H, it also includes:
步骤I,若所述相似度小于所述第一预设阈值,则检测所述相似度是否大于第二预设阈值,其中,所述第二预设阈值小于所述第一预设阈值;Step 1: If the similarity is less than the first preset threshold, detecting whether the similarity is greater than a second preset threshold, where the second preset threshold is less than the first preset threshold;
当相似度小于第一预设阈值时,说明测试案例集知识库中不存在相同的 测试案例集,但BERT结合知识图谱的训练模型生成的测试案例集知识库本身具有一定的学习能力,因此接下来判断是否存在相似案例,即判断相似度是否大于第二预设阈值。When the similarity is less than the first preset threshold, it means that the same test case set does not exist in the test case set knowledge base, but the test case set knowledge base generated by the BERT combined with the training model of the knowledge graph has a certain learning ability. Next, determine whether there are similar cases, that is, determine whether the similarity is greater than the second preset threshold.
步骤J,若所述相似度大于所述第二预设阈值,则判定所述测试案例集知识库中存在相似案例集,则执行步骤S30:获取目标相似案例集;Step J: If the similarity is greater than the second preset threshold, it is determined that there is a similar case set in the test case set knowledge base, and step S30 is executed: obtaining a target similar case set;
当大于第二预设阈值,则测试案例集知识库中虽然不存在相同测试集,但是存在与案例关键词关联的相似案例集,则根据案例关键词以及目标相似案例集,利用知识图谱的推理能力推理生成并生成测试案例集。如案例关键词为用户密码,而判定测试案例集知识库中存在相似测试集为用户名相关的测试集如不包含特殊字符、长度至少为六个字符等,则可以推理生成用户密码中不包含特殊字符、长度至少为六个字符的测试案例集。When it is greater than the second preset threshold, although the same test set does not exist in the test case set knowledge base, but there is a similar case set associated with the case keyword, then based on the case keyword and the target similar case set, the knowledge graph is used for reasoning Ability reasoning generates and generates a set of test cases. If the case keyword is the user password, and it is determined that there is a similar test set in the test case set knowledge base as the user name related test set, if it does not contain special characters, the length is at least six characters, etc., it can be inferred that the user password does not contain A set of test cases with special characters and a length of at least six characters.
步骤K,若所述相似度小于或等于所述第二预设阈值,则输出提示信息以提示用户人工生成测试案例集;Step K: If the similarity is less than or equal to the second preset threshold, output prompt information to prompt the user to manually generate a test case set;
当相似度小于或等于第二预设阈值,则说明测试案例集知识库中的测试案例与输入的案例关键词差异都较大,输入的案例关键词对应的案例应该是全新的案例,此时无法利用已有的测试案例集进行直接输出或推理生成测试案例集。需要用户手动生成测试案例集,则手动增加测试案例集。When the similarity is less than or equal to the second preset threshold, it means that the test case in the test case set knowledge base differs greatly from the input case keywords. The case corresponding to the input case keywords should be a brand new case. It is impossible to use the existing test case set for direct output or reasoning to generate a test case set. If the user needs to manually generate the test case set, then manually add the test case set.
进一步地,步骤K之后,还包括:Further, after step K, it also includes:
步骤k1,获取用户人工生成的标注测试案例集;Step k1: Obtain a set of labeled test cases manually generated by the user;
步骤k2,根据所述标注测试案例集更新所述测试案例集知识库;Step k2, update the test case set knowledge base according to the labeled test case set;
当用户手动输入新的标注测试案例集后,记录用户人工生成的标注测试案例集,并将标注测试案例集作为新的标注的测试案例集输入,以对测试案例集知识库进行更新,从而使测试案例集知识库能够根据标注测试案例集进行学习,进而扩充测试案例集知识库。When the user manually enters a new labeled test case set, record the labeled test case set manually generated by the user, and input the labeled test case set as a new labeled test case set to update the test case set knowledge base, so that The test case set knowledge base can learn from the labeled test case set, thereby expanding the test case set knowledge base.
在本实施例中,可根据检索结果按相似度直接输出相同测试案例集,或者根据相似测试案例集推理生成测试案例集,当无法根据测试案例集知识库输出测试案例集时,可通过人工生成的方式生成标注测试案例集,进而标注测试案例集更新测试案例集知识库,以扩充测试案例集知识库。In this embodiment, the same test case set can be directly output according to the similarity according to the retrieval result, or the test case set can be generated by reasoning based on the similar test case set. When the test case set cannot be output according to the test case set knowledge base, it can be manually generated Annotated test case set is generated in the method, and then the test case set knowledge base is updated by annotated test case set to expand the test case set knowledge base.
本申请还提供一种测试案例集生成装置。The application also provides a device for generating a test case set.
参照图3,图3为本申请测试案例集生成装置第一实施例的功能模块示意图。Referring to FIG. 3, FIG. 3 is a schematic diagram of the functional modules of the first embodiment of the apparatus for generating a test case set according to the present application.
如图3所示,所述测试案例集生成装置包括:As shown in Figure 3, the test case set generating device includes:
分析模块10,用于获取案例关键词,对所述案例关键词进行语义分析,得到语义分析结果;The analysis module 10 is used to obtain case keywords, perform semantic analysis on the case keywords, and obtain semantic analysis results;
检索模块20,用于根据所述语义分析结果,检索测试案例集知识库以获取检索结果,其中,所述测试案例集知识库是由BERT模型结合知识图谱构建得到的预设训练模型训练生成的;The retrieval module 20 is configured to retrieve the test case set knowledge base according to the semantic analysis result to obtain the retrieval result, wherein the test case set knowledge base is generated by training a preset training model constructed by combining the BERT model and the knowledge graph ;
第一获取模块30,用于若根据所述检索结果判定所述测试案例集知识库中存在相似案例集,则获取目标相似案例集;The first obtaining module 30 is configured to obtain a target similar case set if it is determined that there is a similar case set in the test case set knowledge base according to the search result;
第一生成模块40,用于利用知识图谱对所述案例关键词和所述目标相似案例集进行分析,推理生成测试案例集。The first generation module 40 is configured to analyze the case keywords and the target similar case set by using the knowledge graph, and generate a test case set by reasoning.
进一步地,所述测试案例集生成装置还包括:Further, the test case set generating device further includes:
预训练模块,根据无标注的第一训练测试案例集,对预设训练模型进行预处理训练,得到初始训练模型,其中,所述预设训练模型是基于BERT模型结合知识图谱构建得到的;The pre-training module performs pre-processing training on the preset training model according to the unlabeled first training test case set to obtain the initial training model, where the preset training model is constructed based on the BERT model combined with the knowledge map;
微调训练模块,用于根据标注的第二训练测试案例集对所述初始训练模型进行微调训练,得到语言表征模型;The fine-tuning training module is configured to perform fine-tuning training on the initial training model according to the labeled second training test case set to obtain a language representation model;
第二生成模块,用于通过所述语言表征模型对所述第一训练测试案例集和所述第二训练测试案例集进行分类,根据分类结果生成测试案例集知识库。The second generation module is configured to classify the first training test case set and the second training test case set through the language representation model, and generate a test case set knowledge base according to the classification result.
进一步地,所述预训练模块还包括:Further, the pre-training module further includes:
第一获取单元,用于获取无标注的第一训练测试案例集的第一属性信息;The first acquiring unit is configured to acquire the first attribute information of the unlabeled first training test case set;
第一划分单元,用于根据所述第一属性信息对所述第一训练测试案例集进行划分,得到多个第一训练测试案例子集;The first dividing unit is configured to divide the first training test case set according to the first attribute information to obtain multiple first training test case subsets;
预训练单元,用于分别根据多个第一训练测试案例子集对预设训练模型进行预处理训练,得到对应的多个初始训练模型,其中,所述预设训练模型是基于BERT模型结合知识图谱构建得到的;The pre-training unit is used to perform pre-processing training on the preset training model according to a plurality of first training test case subsets to obtain corresponding multiple initial training models, wherein the preset training model is based on the BERT model combined with knowledge The map is constructed;
所述微调训练模块还包括:The fine-tuning training module further includes:
第二获取单元,用于获取标注的第二训练测试案例集及其第二属性信息;The second acquiring unit is used to acquire the labeled second training test case set and its second attribute information;
第二划分单元,用于根据所述第二属性信息和所述第二训练测试集进行划分,得到多个第二训练测试案例子集;The second dividing unit is configured to divide according to the second attribute information and the second training test set to obtain a plurality of second training test case subsets;
微调训练单元,用于分别根据多个第二训练测试案例子集对对应的初始训练模型进行微调训练,得到与所述第二属性信息对应的多个语言表征模型;The fine-tuning training unit is configured to perform fine-tuning training on the corresponding initial training model according to a plurality of second training test case subsets to obtain multiple language representation models corresponding to the second attribute information;
所述第二生成模块还包括:The second generating module further includes:
第一生成单元,用于通过多个语言表征模型对对应的第一训练测试案例子集和第二训练测试案例子集进行分类,得到与所述第一属性信息对应的多个测试案例集,并基于所述多个测试案例集生成测试案例集知识库。The first generating unit is configured to classify the corresponding first training test case subset and the second training test case subset through multiple language representation models to obtain multiple test case sets corresponding to the first attribute information, And generate a test case set knowledge base based on the multiple test case sets.
进一步地,所述测试案例集生成装置还包括:Further, the test case set generating device further includes:
第二获取单元,用于获取备选属性信息;The second obtaining unit is used to obtain candidate attribute information;
所述第一获取模块还包括:The first acquisition module further includes:
确定单元,用于在所述测试案例集知识库中确定与所述备选属性信息对应的目标测试案例集;A determining unit, configured to determine a target test case set corresponding to the candidate attribute information in the test case set knowledge base;
第三获取单元,用于根据所述语义分析结果检索所述目标测试案例集,以获取所述案例关键词与所述目标测试案例集中测试案例的相似度,得到检索结果。The third obtaining unit is configured to retrieve the target test case set according to the semantic analysis result to obtain the similarity between the case keywords and the test cases in the target test case set to obtain the retrieval result.
进一步地,所述测试案例集生成装置还包括:Further, the test case set generating device further includes:
第一检测模块,用于检测所述检索结果中的相似度是否大于或等于第一预设阈值;The first detection module is configured to detect whether the similarity in the retrieval result is greater than or equal to a first preset threshold;
第一输出模块,用于若所述相似度大于或等于所述第一预设阈值,则判定所述测试案例集知识库中存在与所述案例关键词对应的相同案例集,则获取目标相同案例集,并输出。The first output module is configured to determine that the same case set corresponding to the case keyword exists in the test case set knowledge base if the similarity is greater than or equal to the first preset threshold, and the acquisition target is the same Case collection and output.
进一步地,所述测试案例集生成装置还包括:Further, the test case set generating device further includes:
第二检测模块,用于若所述相似度小于所述第一预设阈值,则检测所述相似度是否大于第二预设阈值,其中,所述第二预设阈值小于所述第一预设阈值;The second detection module is configured to detect whether the similarity is greater than a second preset threshold if the similarity is less than the first preset threshold, wherein the second preset threshold is less than the first preset Set threshold
第四获取模块,用于若所述相似度大于所述第二预设阈值,则判定所述测试案例集知识库中存在相似案例集,则执行步骤:获取目标相似案例集;The fourth obtaining module is configured to determine that there is a similar case set in the test case set knowledge base if the similarity is greater than the second preset threshold, and then execute the step of: obtaining a target similar case set;
第二生成模块,用于若所述相似度小于或等于所述第二预设阈值,则输出提示信息以提示用户人工生成测试案例集。The second generation module is configured to output prompt information to prompt the user to manually generate a test case set if the similarity is less than or equal to the second preset threshold.
进一步地,所述测试案例集生成装置还包括:Further, the test case set generating device further includes:
第五获取模块,用于获取用户人工生成的标注测试案例集;The fifth acquisition module is used to acquire a set of labeled test cases manually generated by the user;
更新模块,用于根据所述标注测试案例集更新所述测试案例集知识库。The update module is used to update the test case set knowledge base according to the labeled test case set.
其中,上述测试案例集生成装置中各个模块的功能实现与上述测试案例集生成方法实施例中各步骤相对应,其功能和实现过程在此处不再一一赘述。Among them, the function realization of each module in the above-mentioned test case set generation device corresponds to each step in the above-mentioned test case set generation method embodiment, and its functions and realization processes are not repeated here.
本申请还提供一种计算机可读存储介质,该计算机可读存储介质上存储有测试案例集生成程序,所述测试案例集生成程序被处理器执行时实现如以上任一项实施例所述的测试案例集生成方法的步骤。The present application also provides a computer-readable storage medium with a test case set generation program stored on the computer-readable storage medium. The test case set generation program is executed by a processor to achieve the above The steps of the test case set generation method.
本申请计算机可读存储介质的具体实施例与上述测试案例集生成方法各实施例基本相同,在此不作赘述。The specific embodiments of the computer-readable storage medium of the present application are basically the same as the embodiments of the above-mentioned test case set generation method, and will not be repeated here.
需要说明的是,在本文中,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者系统不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者系统所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括该要素的过程、方法、物品或者系统中还存在另外的相同要素。It should be noted that in this article, the terms "include", "include" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or system including a series of elements not only includes those elements, It also includes other elements not explicitly listed, or elements inherent to the process, method, article, or system. If there are no more restrictions, the element defined by the sentence "including a..." does not exclude the existence of other identical elements in the process, method, article, or system that includes the element.
上述本申请实施例序号仅仅为了描述,不代表实施例的优劣。The serial numbers of the foregoing embodiments of the present application are for description only, and do not represent the superiority or inferiority of the embodiments.
通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到上述实施例方法可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件,但很多情况下前者是更佳的实施方式。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在如上所述的一个存储介质(如ROM/RAM、磁碟、光盘)中,包括若干指令用以使得一台终端设备(可以是手机,计算机,服务器,空调器,或者网络设备等)执行本申请各个实施例所述的方法。Through the description of the above implementation manners, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus the necessary general hardware platform. Of course, it can also be implemented by hardware, but in many cases the former is better.的实施方式。 Based on this understanding, the technical solution of this application essentially or the part that contributes to the existing technology can be embodied in the form of a software product, and the computer software product is stored in a storage medium (such as ROM/RAM) as described above. , Magnetic disk, optical disk), including several instructions to make a terminal device (which can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) execute the method described in each embodiment of the present application.
以上仅为本申请的优选实施例,并非因此限制本申请的专利范围,凡是利用本申请说明书及附图内容所作的等效结构或等效流程变换,或直接或间接运用在其他相关的技术领域,均同理包括在本申请的专利保护范围内。The above are only the preferred embodiments of this application, and do not limit the scope of this application. Any equivalent structure or equivalent process transformation made using the content of the description and drawings of this application, or directly or indirectly used in other related technical fields , The same reason is included in the scope of patent protection of this application.

Claims (10)

  1. 一种测试案例集生成方法,其中,所述测试案例集生成方法包括:A method for generating a test case set, wherein the method for generating a test case set includes:
    获取案例关键词,对所述案例关键词进行语义分析,得到语义分析结果;Obtain case keywords, perform semantic analysis on the case keywords, and obtain semantic analysis results;
    根据所述语义分析结果,检索测试案例集知识库以获取检索结果,其中,所述测试案例集知识库是由BERT模型结合知识图谱构建得到的预设训练模型训练生成的;According to the semantic analysis result, search the test case set knowledge base to obtain the search result, wherein the test case set knowledge base is generated by training a preset training model constructed by combining the BERT model and the knowledge graph;
    若根据所述检索结果判定所述测试案例集知识库中存在相似案例集,则获取目标相似案例集;If it is determined according to the search result that there is a similar case set in the test case set knowledge base, then obtain a target similar case set;
    利用知识图谱对所述案例关键词和所述目标相似案例集进行分析以生成测试案例集。Use the knowledge graph to analyze the case keywords and the target similar case set to generate a test case set.
  2. 如权利要求1所述的测试案例集生成方法,其中,所述获取案例关键词,对所述案例关键词进行语义分析,得到语义分析结果的步骤之前,还包括:The method for generating a test case set according to claim 1, wherein before the step of obtaining case keywords, performing semantic analysis on the case keywords, and obtaining a semantic analysis result, the method further comprises:
    根据无标注的第一训练测试案例集,对预设训练模型进行预处理训练,得到初始训练模型,其中,所述预设训练模型是基于BERT模型结合知识图谱构建得到的;Perform preprocessing training on the preset training model according to the unlabeled first training test case set to obtain the initial training model, where the preset training model is constructed based on the BERT model combined with the knowledge graph;
    根据标注的第二训练测试案例集对所述初始训练模型进行微调训练,得到语言表征模型;Performing fine-tuning training on the initial training model according to the labeled second training test case set to obtain a language representation model;
    通过所述语言表征模型对所述第一训练测试案例集和所述第二训练测试案例集进行分类,根据分类结果生成测试案例集知识库。The first training test case set and the second training test case set are classified by the language representation model, and a test case set knowledge base is generated according to the classification result.
  3. 权利要求2所述的测试案例集生成方法,其中,所述根据无标注的第一训练测试案例集,对预设训练模型进行预处理训练,得到初始训练模型的步骤包括:The method for generating a test case set according to claim 2, wherein the step of performing preprocessing training on a preset training model according to the unlabeled first training test case set to obtain an initial training model comprises:
    获取无标注的第一训练测试案例集的第一属性信息;Acquiring the first attribute information of the unlabeled first training test case set;
    根据所述第一属性信息对所述第一训练测试案例集进行划分,得到多个第一训练测试案例子集;Dividing the first training test case set according to the first attribute information to obtain a plurality of first training test case subsets;
    分别根据多个第一训练测试案例子集对预设训练模型进行预处理训练,得到对应的多个初始训练模型,其中,所述预设训练模型是基于BERT模型结合知识图谱构建得到的;Performing preprocessing training on the preset training model according to a plurality of first training test case subsets respectively to obtain a plurality of corresponding initial training models, wherein the preset training model is constructed based on the BERT model combined with the knowledge map;
    所述根据标注的第二训练测试案例集对所述初始训练模型进行微调训练,得到训练好的语言表征模型的步骤包括:The step of performing fine-tuning training on the initial training model according to the labeled second training test case set, and obtaining a trained language representation model includes:
    获取标注的第二训练测试案例集及其第二属性信息;Acquiring the labeled second training test case set and its second attribute information;
    根据所述第二属性信息和所述第二训练测试集进行划分,得到多个第二训练测试案例子集;Divide according to the second attribute information and the second training test set to obtain a plurality of second training test case subsets;
    分别根据多个第二训练测试案例子集对对应的初始训练模型进行微调训练,得到与所述第二属性信息对应的多个语言表征模型;Performing fine-tuning training on the corresponding initial training model according to a plurality of second training test case subsets, respectively, to obtain a plurality of language representation models corresponding to the second attribute information;
    所述根据所述语言表征模型对所述第一训练测试案例集和所述第二训练测试案例集进行分类,根据分类结果生成测试案例集知识库的步骤包括:The step of classifying the first training test case set and the second training test case set according to the language representation model, and generating a test case set knowledge base according to the classification result includes:
    通过多个语言表征模型对对应的第一训练测试案例子集和第二训练测试案例子集进行分类,得到与所述第一属性信息对应的多个测试案例集,并基于所述多个测试案例集生成测试案例集知识库。Classify the corresponding first training test case subset and the second training test case subset through multiple language representation models to obtain multiple test case sets corresponding to the first attribute information, and based on the multiple test cases The case set generates a test case set knowledge base.
  4. 如权利要求3所述的测试案例集生成方法,其中,所述根据所述语义分析结果,检索测试案例集知识库以获取检索结果的步骤之前,还包括:The method for generating a test case set according to claim 3, wherein, before the step of retrieving the test case set knowledge base to obtain the retrieval result according to the semantic analysis result, the method further comprises:
    获取备选属性信息;Obtain candidate attribute information;
    所述根据所述语义分析结果,检索测试案例集知识库以获取检索结果的步骤包括:According to the semantic analysis result, the step of retrieving the test case collection knowledge base to obtain the retrieval result includes:
    在所述测试案例集知识库中确定与所述备选属性信息对应的目标测试案例集;Determining a target test case set corresponding to the candidate attribute information in the test case set knowledge base;
    根据所述语义分析结果检索所述目标测试案例集,以获取所述案例关键词与所述目标测试案例集中测试案例的相似度,得到检索结果。The target test case set is retrieved according to the semantic analysis result to obtain the similarity between the case keywords and the test cases in the target test case set, and the retrieval result is obtained.
  5. 如权利要求4所述的测试案例集生成方法,其中,所述根据所述语义分析结果检索所述目标测试案例集,以获取所述案例关键词与所述目标测试案例集中测试案例的相似度,得到检索结果的步骤之后,还包括:4. The method for generating a test case set according to claim 4, wherein the retrieval of the target test case set according to the semantic analysis result to obtain the similarity between the case keywords and the test cases in the target test case set , After the step of obtaining the search results, it also includes:
    检测所述检索结果中的相似度是否大于或等于第一预设阈值;Detecting whether the similarity in the retrieval result is greater than or equal to a first preset threshold;
    若所述相似度大于或等于所述第一预设阈值,则判定所述测试案例集知识库中存在与所述案例关键词对应的相同案例集,则获取目标相同案例集,并输出。If the similarity is greater than or equal to the first preset threshold, it is determined that the same case set corresponding to the case keyword exists in the test case set knowledge base, and the target same case set is obtained and output.
  6. 如权利要求5所述的测试案例生成方法,其中,所述检测所述检索结果中的相似度是否大于或等于第一预设阈值的步骤之后,还包括:5. The test case generation method according to claim 5, wherein after the step of detecting whether the similarity in the retrieval result is greater than or equal to a first preset threshold, the method further comprises:
    若所述相似度小于所述第一预设阈值,则检测所述相似度是否大于第二预设阈值,其中,所述第二预设阈值小于所述第一预设阈值;If the similarity is less than the first preset threshold, detecting whether the similarity is greater than a second preset threshold, where the second preset threshold is less than the first preset threshold;
    若所述相似度大于所述第二预设阈值,则判定所述测试案例集知识库中存在相似案例集,则执行步骤:获取目标相似案例集;If the similarity is greater than the second preset threshold, it is determined that there is a similar case set in the test case set knowledge base, and then the step is performed: obtaining a target similar case set;
    若所述相似度小于或等于所述第二预设阈值,则输出提示信息以提示用户人工生成测试案例集。If the similarity is less than or equal to the second preset threshold, output prompt information to prompt the user to manually generate a test case set.
  7. 如权利要求6所述的测试案例集生成方法,其中,所述输出提示信息以提示用户人工生成测试案例集的步骤之后,还包括:8. The method for generating a test case set according to claim 6, wherein after the step of outputting prompt information to prompt the user to manually generate the test case set, the method further comprises:
    获取用户人工生成的标注测试案例集;Obtain a set of labeled test cases manually generated by the user;
    根据所述标注测试案例集更新所述测试案例集知识库。Update the test case set knowledge base according to the labeled test case set.
  8. 一种测试案例集生成装置,其中,所述测试案例集生成装置包括:A test case set generating device, wherein the test case set generating device includes:
    分析模块,用于获取案例关键词,对所述案例关键词进行语义分析,得到语义分析结果;The analysis module is used to obtain case keywords, perform semantic analysis on the case keywords, and obtain semantic analysis results;
    检索模块,用于根据所述语义分析结果,检索测试案例集知识库以获取检索结果,其中,所述测试案例集知识库是由BERT模型结合知识图谱构建得到的预设训练模型训练生成的;The retrieval module is configured to retrieve the test case set knowledge base to obtain the retrieval result according to the semantic analysis result, wherein the test case set knowledge base is generated by training a preset training model constructed by combining the BERT model with the knowledge graph;
    第一获取模块,用于若根据所述检索结果判定所述测试案例集知识库中存在相似案例集,则获取目标相似案例集;The first obtaining module is configured to obtain a target similar case set if it is determined that there is a similar case set in the test case set knowledge base according to the search result;
    第一生成模块,用于利用知识图谱对所述案例关键词和所述目标相似案例集进行分析以生成测试案例集。The first generating module is used to analyze the case keywords and the target similar case set by using the knowledge graph to generate a test case set.
  9. 一种测试案例集生成设备,其中,所述测试案例集生成设备包括:存储器、处理器及存储在所述存储器上并可在所述处理器上运行的测试案例集生成程序,所述测试案例集生成程序被所述处理器执行时实现如权利要求1至7中任一项所述的测试案例集生成方法的步骤。A test case set generating device, wherein the test case set generating device includes: a memory, a processor, and a test case set generating program stored on the memory and running on the processor, the test case When the set generation program is executed by the processor, the steps of the test case set generation method according to any one of claims 1 to 7 are realized.
  10. 一种计算机可读存储介质,其中,所述计算机可读存储介质上存储有测试案例集生成程序,所述测试案例集生成程序被处理器执行时实现如权利要求1至7中任一项所述的测试案例集生成方法的步骤。A computer-readable storage medium, wherein a test case set generation program is stored on the computer-readable storage medium, and when the test case set generation program is executed by a processor, the test case set generation program is implemented as described in any one of claims 1 to 7 The steps of the test case set generation method described.
PCT/CN2021/081873 2020-06-18 2021-03-19 Test case set generation method, apparatus and device, and computer readable storage medium WO2021253904A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202010563141.XA CN111708703A (en) 2020-06-18 2020-06-18 Test case set generation method, device, equipment and computer readable storage medium
CN202010563141.X 2020-06-18

Publications (1)

Publication Number Publication Date
WO2021253904A1 true WO2021253904A1 (en) 2021-12-23

Family

ID=72541309

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/081873 WO2021253904A1 (en) 2020-06-18 2021-03-19 Test case set generation method, apparatus and device, and computer readable storage medium

Country Status (2)

Country Link
CN (1) CN111708703A (en)
WO (1) WO2021253904A1 (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20230088970A1 (en) * 2021-09-20 2023-03-23 Salesforce.Com, Inc. Impact analysis based on api functional tesing
CN117033253A (en) * 2023-10-10 2023-11-10 北京轻松怡康信息技术有限公司 Interface testing method and device, electronic equipment and storage medium
CN117057173A (en) * 2023-10-13 2023-11-14 浙江大学 Bionic design method and system supporting divergent thinking and electronic equipment
CN117453576A (en) * 2023-12-25 2024-01-26 企迈科技有限公司 DXM model-based SaaS software test case construction method

Families Citing this family (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111708703A (en) * 2020-06-18 2020-09-25 深圳前海微众银行股份有限公司 Test case set generation method, device, equipment and computer readable storage medium
CN112256566B (en) * 2020-09-28 2024-03-05 中国建设银行股份有限公司 Fresh-keeping method and device for test cases
CN112199285B (en) * 2020-10-12 2023-08-01 中国农业银行股份有限公司 Test case optimization method and device and electronic equipment
CN112528893A (en) * 2020-12-15 2021-03-19 南京中兴力维软件有限公司 Abnormal state identification method and device and computer readable storage medium
CN112906361A (en) * 2021-02-09 2021-06-04 上海明略人工智能(集团)有限公司 Text data labeling method and device, electronic equipment and storage medium
CN113392642B (en) * 2021-06-04 2023-06-02 北京师范大学 Automatic labeling system and method for child care cases based on meta learning
CN113609011B (en) * 2021-07-30 2023-11-03 建信人寿保险股份有限公司 Testing method, device, medium and equipment of insurance product factory
CN113900954B (en) * 2021-10-28 2022-06-10 航天中认软件测评科技(北京)有限责任公司 Test case recommendation method and device using knowledge graph
CN115328813B (en) * 2022-10-11 2023-02-03 成都飞机工业(集团)有限责任公司 Test case design method, device, equipment and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20150178273A1 (en) * 2013-12-20 2015-06-25 Microsoft Corporation Unsupervised Relation Detection Model Training
CN109885823A (en) * 2017-12-01 2019-06-14 武汉楚鼎信息技术有限公司 A kind of distributed semantic recognition methods of financial industry and system and device
CN110727779A (en) * 2019-10-16 2020-01-24 信雅达系统工程股份有限公司 Question-answering method and system based on multi-model fusion
CN111160756A (en) * 2019-12-26 2020-05-15 马上游科技股份有限公司 Scenic spot assessment method and model based on secondary artificial intelligence algorithm
CN111708703A (en) * 2020-06-18 2020-09-25 深圳前海微众银行股份有限公司 Test case set generation method, device, equipment and computer readable storage medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20150178273A1 (en) * 2013-12-20 2015-06-25 Microsoft Corporation Unsupervised Relation Detection Model Training
CN109885823A (en) * 2017-12-01 2019-06-14 武汉楚鼎信息技术有限公司 A kind of distributed semantic recognition methods of financial industry and system and device
CN110727779A (en) * 2019-10-16 2020-01-24 信雅达系统工程股份有限公司 Question-answering method and system based on multi-model fusion
CN111160756A (en) * 2019-12-26 2020-05-15 马上游科技股份有限公司 Scenic spot assessment method and model based on secondary artificial intelligence algorithm
CN111708703A (en) * 2020-06-18 2020-09-25 深圳前海微众银行股份有限公司 Test case set generation method, device, equipment and computer readable storage medium

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20230088970A1 (en) * 2021-09-20 2023-03-23 Salesforce.Com, Inc. Impact analysis based on api functional tesing
CN117033253A (en) * 2023-10-10 2023-11-10 北京轻松怡康信息技术有限公司 Interface testing method and device, electronic equipment and storage medium
CN117057173A (en) * 2023-10-13 2023-11-14 浙江大学 Bionic design method and system supporting divergent thinking and electronic equipment
CN117057173B (en) * 2023-10-13 2024-01-05 浙江大学 Bionic design method and system supporting divergent thinking and electronic equipment
CN117453576A (en) * 2023-12-25 2024-01-26 企迈科技有限公司 DXM model-based SaaS software test case construction method
CN117453576B (en) * 2023-12-25 2024-04-09 企迈科技有限公司 DXM model-based SaaS software test case construction method

Also Published As

Publication number Publication date
CN111708703A (en) 2020-09-25

Similar Documents

Publication Publication Date Title
WO2021253904A1 (en) Test case set generation method, apparatus and device, and computer readable storage medium
CN111160017B (en) Keyword extraction method, phonetics scoring method and phonetics recommendation method
CN109697162B (en) Software defect automatic detection method based on open source code library
CN108829757B (en) Intelligent service method, server and storage medium for chat robot
WO2021042503A1 (en) Information classification extraction method, apparatus, computer device and storage medium
CN111026671B (en) Test case set construction method and test method based on test case set
CN110727779A (en) Question-answering method and system based on multi-model fusion
CN109033305A (en) Question answering method, equipment and computer readable storage medium
US20210117625A1 (en) Semantic parsing of natural language query
CN113094578B (en) Deep learning-based content recommendation method, device, equipment and storage medium
CN107844533A (en) A kind of intelligent Answer System and analysis method
US20210056127A1 (en) Method for multi-modal retrieval and clustering using deep cca and active pairwise queries
CN112632226B (en) Semantic search method and device based on legal knowledge graph and electronic equipment
Banerjee et al. Bengali question classification: Towards developing qa system
CN110457585B (en) Negative text pushing method, device and system and computer equipment
CN113742733A (en) Reading understanding vulnerability event trigger word extraction and vulnerability type identification method and device
CN111274822A (en) Semantic matching method, device, equipment and storage medium
CN111177402A (en) Evaluation method and device based on word segmentation processing, computer equipment and storage medium
CN113434418A (en) Knowledge-driven software defect detection and analysis method and system
CN114647713A (en) Knowledge graph question-answering method, device and storage medium based on virtual confrontation
CN109271624A (en) A kind of target word determines method, apparatus and storage medium
CN115641101A (en) Intelligent recruitment method, device and computer readable medium
CN117271767A (en) Operation and maintenance knowledge base establishing method based on multiple intelligent agents
CN116842194A (en) Electric power semantic knowledge graph system and method
CN113377844A (en) Dialogue type data fuzzy retrieval method and device facing large relational database

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 21826586

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 21826586

Country of ref document: EP

Kind code of ref document: A1