CN117130938A - Method and device for generating test cases based on knowledge graph - Google Patents

Method and device for generating test cases based on knowledge graph Download PDF

Info

Publication number
CN117130938A
CN117130938A CN202311287685.8A CN202311287685A CN117130938A CN 117130938 A CN117130938 A CN 117130938A CN 202311287685 A CN202311287685 A CN 202311287685A CN 117130938 A CN117130938 A CN 117130938A
Authority
CN
China
Prior art keywords
requirement
test
new
knowledge
service
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202311287685.8A
Other languages
Chinese (zh)
Inventor
朱峰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Postal Savings Bank of China Ltd
Original Assignee
Postal Savings Bank of China Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Postal Savings Bank of China Ltd filed Critical Postal Savings Bank of China Ltd
Priority to CN202311287685.8A priority Critical patent/CN117130938A/en
Publication of CN117130938A publication Critical patent/CN117130938A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3684Test management for test design, e.g. generating new test cases
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/28Databases characterised by their database models, e.g. relational or object models
    • G06F16/284Relational databases
    • G06F16/288Entity relationship models
    • 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

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Databases & Information Systems (AREA)
  • Quality & Reliability (AREA)
  • Computer Hardware Design (AREA)
  • Data Mining & Analysis (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Animal Behavior & Ethology (AREA)
  • Computational Linguistics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application provides a method and a device for generating a test case based on a knowledge graph. The method comprises the following steps: acquiring a newly added service requirement; constructing a case generation model; inputting the new business requirements into a case generation model to obtain new test cases corresponding to the new business requirements; and inputting the new business requirements and the corresponding new test cases into the knowledge graph to obtain an updated knowledge graph. If the new business requirement exists, generating a test case corresponding to the new business requirement according to the case generation model, so that the test case obtained when the new business requirement exists corresponds to the new business requirement, and inputting the new business requirement and the corresponding new test case into the knowledge graph, wherein the new test case corresponding to the new business requirement and the new test business requirement can be stored in the knowledge graph, so that the test case generation can be performed on the requirements outside the existing knowledge graph through the scheme.

Description

Method and device for generating test cases based on knowledge graph
Technical Field
The application relates to the technical field of software testing, in particular to a method and a device for generating a test case based on a knowledge graph, a computer readable storage medium and a case management system.
Background
Banking business has the characteristics of high complexity and quick change, and in recent years, structured or semi-structured business requirements are gradually adopted to cope with the quick change of the business, so that the business capability is improved.
One of the mainstream test analysis methods at present is to manually analyze the test requirements and comb the mind map to form test outlines and test cases, which consumes a great deal of manpower, cannot guarantee the quality of the test cases, and cannot meet the requirements for agile tests. At present, a scheme for searching test cases through a knowledge graph is also available, test requirements are input, existing knowledge or similar knowledge is searched in the knowledge graph, but the method can only realize the multiplexing of the test cases with similar requirements, and when search elements do not exist in the existing test case knowledge base, new requirements cannot be processed, and only test cases with similar requirements can be output.
Disclosure of Invention
The application aims to provide a method and a device for generating a test case based on a knowledge graph, a computer readable storage medium and a case management system, which are used for at least solving the problem that the knowledge graph in the prior art can only find similar cases and cannot process newly increased demands.
In order to achieve the above object, according to one aspect of the present application, there is provided a method for generating a test case based on a knowledge graph, including: acquiring a new added service requirement, wherein the new added service requirement is a service requirement which is not stored in a knowledge graph, and the service requirement is a requirement for handling a service; constructing a case generation model, wherein the case generation model is trained by using a plurality of sets of training data, and each set of training data in the plurality of sets of training data comprises a historical service requirement, a historical knowledge base, a historical service rule and a historical test case which are acquired in a historical time period; inputting the new business requirements to the case generation model to obtain new test cases corresponding to the new business requirements; inputting the new business requirement and the corresponding new test case into the knowledge graph to obtain an updated knowledge graph, wherein the updated knowledge graph at least comprises the business requirement, the test case corresponding to the business requirement, the new business requirement and the new test case corresponding to the new business requirement.
Optionally, inputting the new business requirement to the case generation model to obtain a new test case corresponding to the new business requirement, including: carrying out structural processing on the newly-increased business requirement by adopting a deep learning technology to obtain at least one structural requirement, wherein the structural processing is orderly and normalized splitting processing on the newly-increased business requirement, and one structural requirement corresponds to one test scene or one test step; and sequentially inputting all the structured demands into the case generation model to obtain all the new test cases corresponding to the new business demands, wherein one new business demand corresponds to at least one structured demand, and one structured demand corresponds to at least one new test case.
Optionally, the knowledge graph further includes a test key point, where the test key point is a task of testing one test case, all the structured requirements are sequentially input into the case generation model, and the new test case corresponding to all the new service requirements is obtained, including: searching whether the test key points corresponding to the structuring requirements exist in the knowledge graph; under the condition that the test key points corresponding to the structural requirements are found, the test key points corresponding to the structural requirements are extracted to serve as target test key points; under the condition that a target service with the service similarity greater than a similarity threshold value with the structuring requirement is found, updating the test key points of the target service according to the structuring requirement to obtain the target test key points; generating the target test key point according to the structuring requirement under the condition that the test key point corresponding to the structuring requirement is not found; and inputting the target test key points into the case generation model to obtain all the new test cases corresponding to the new service requirements.
Optionally, before acquiring the new service requirement, the method further includes: carrying out data cleaning on service data to obtain cleaned service data, wherein the service data comprises the service requirement and the test case corresponding to the service requirement; performing data verification on the cleaned service data to obtain a verification result, wherein the data verification comprises one or more of consistency verification, integrity verification and accuracy verification; and generating a knowledge base according to the business data which passes the verification under the condition that the verification result representation passes the verification, and generating prompt information under the condition that the verification result representation does not pass the verification.
Optionally, before constructing the case creation model, the method further comprises: constructing a basic model, wherein the basic model is obtained by training by using a plurality of sets of training data, and each set of training data in the plurality of sets of training data comprises the historical service requirements, the historical knowledge base, the historical service rules and the historical test cases which are acquired in a historical time period; and carrying out optimization processing on the basic model to obtain the case generation model, wherein the optimization processing comprises one or more of adjustment of model parameters, adjustment of coverage rate and similarity comparison.
Optionally, after obtaining the new service requirement, the method further includes: a data preparation step, namely acquiring a structured requirement and acquiring a test case generated by the case generation model; a knowledge extraction step, namely acquiring a main body for constructing the knowledge graph, wherein the main body is a central node in the knowledge graph, and acquiring an association relationship between the business requirement and the test case; a knowledge fusion step of carrying out fusion processing on the knowledge extracted in the knowledge extraction step, wherein the fusion processing comprises one or more of relationship alignment, relationship disambiguation and relationship verification; and a knowledge application step, wherein the business requirement is taken as an entity, the test case is taken as an attribute, and the association relationship is taken as a triplet to construct the knowledge graph.
Optionally, after constructing the knowledge-graph, the method further comprises: acquiring a query requirement, wherein the query requirement is a requirement for querying the business requirement and/or the test case from the knowledge graph; and carrying out keyword searching in the knowledge graph according to the keywords in the query requirement to obtain a search result, and displaying the search result in a graphical mode.
According to another aspect of the present application, there is provided a device for generating a test case based on a knowledge-graph, including: the system comprises a first acquisition unit, a second acquisition unit and a third acquisition unit, wherein the first acquisition unit is used for acquiring a new business requirement, the new business requirement is a business requirement which is not stored in a knowledge graph, and the business requirement is a business handling requirement; the first construction unit is used for constructing a case generation model, wherein the case generation model is trained by using a plurality of sets of training data, and each set of training data in the plurality of sets of training data comprises a historical service requirement, a historical knowledge base, a historical service rule and a historical test case which are acquired in a historical time period; the first processing unit is used for inputting the new business requirements into the case generation model to obtain new test cases corresponding to the new business requirements; the updating unit is used for inputting the new business requirement and the corresponding new test case into the knowledge graph to obtain an updated knowledge graph, wherein the updated knowledge graph at least comprises the business requirement, the test case corresponding to the business requirement, the new business requirement and the new test case corresponding to the new business requirement.
According to still another aspect of the present application, there is provided a computer readable storage medium, where the computer readable storage medium includes a stored program, and when the program runs, the device in which the computer readable storage medium is controlled to execute any one of the methods for generating the test cases based on the knowledge graph.
According to yet another aspect of the present application, there is provided a case management system comprising: the system comprises one or more processors, a memory, and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, the one or more programs comprising a generation method for executing any one of the knowledge-graph based test cases.
By applying the technical scheme of the application, if the new business requirement exists, the test case corresponding to the new business requirement is generated according to the case generation model, so that the test case obtained by the new business requirement corresponds to the new business requirement, and then the new business requirement and the corresponding new test case are input into the knowledge graph, so that the new test case corresponding to the new business requirement and the new test business requirement can be saved in the knowledge graph, and therefore, the test case generation can be performed on the requirements outside the existing knowledge graph through the scheme.
Drawings
The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this specification, illustrate embodiments of the application and together with the description serve to explain the application. In the drawings:
fig. 1 is a block diagram showing a hardware structure of a mobile terminal for performing a method for generating a test case based on a knowledge-graph, according to an embodiment of the present application;
fig. 2 is a flow chart of a method for generating a test case based on a knowledge-graph according to an embodiment of the application;
FIG. 3 shows a schematic flow diagram of test analysis and case generation;
FIG. 4 shows a schematic flow diagram of expert knowledge base construction;
fig. 5 shows a schematic flow diagram of test case generation model construction;
FIG. 6 shows a schematic flow diagram of knowledge graph construction of a test;
fig. 7 is a block diagram of a knowledge-graph-based test case generating apparatus according to an embodiment of the present application.
Wherein the above figures include the following reference numerals:
102. a processor; 104. a memory; 106. a transmission device; 108. and an input/output device.
Detailed Description
It should be noted that, without conflict, the embodiments of the present application and features of the embodiments may be combined with each other. The application will be described in detail below with reference to the drawings in connection with embodiments.
In order that those skilled in the art will better understand the present application, a technical solution in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in which it is apparent that the described embodiments are only some embodiments of the present application, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the present application without making any inventive effort, shall fall within the scope of the present application.
It should be noted that the terms "first," "second," and the like in the description and the claims of the present application and the above figures are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate in order to describe the embodiments of the application herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
For convenience of description, the following will describe some terms or terminology involved in the embodiments of the present application:
machine learning: the machine learns a large amount of historical data through a statistical algorithm, and then guides the service by using the generated experience model;
natural language processing: the method takes the language as an object, utilizes the computer technology to analyze, understand and process a subject of the natural language, namely takes the computer as a powerful tool of language research, quantitatively researches the language information under the support of the computer, and provides language description which can be used together between people and the computer;
knowledge graph: a series of different graphs showing knowledge development progress and structural relations are used for describing knowledge resources and carriers thereof by using a visualization technology, and knowledge and interrelationships among the knowledge resources, the carriers are mined, analyzed, constructed, drawn and displayed.
Banking business has the characteristics of high complexity and quick change, and in recent years, structured or semi-structured business requirements are gradually adopted to cope with the quick change of the business, so that the business capability is improved. In order to respond quickly to a change in demand, a set of more accurate and efficient test techniques and methods are needed to improve test efficiency and test accuracy.
At present, two main flow test analysis methods are adopted, one is to manually analyze the test requirement and comb the mind map to form a test outline and a test case, and the method consumes a great deal of manpower, can not ensure the quality of the test case and can not meet the requirement on agile test. And the other is to pre-generate a neural network model and a test case knowledge graph, input test requirements, and search whether the requirements are similar requirements or not through the neural network model. If the requirements are similar, inquiring the knowledge graph of the test case, and outputting the test case, the method can only realize the multiplexing of the test cases with similar requirements, and can not process the newly added requirements.
For the current scheme, the existing test cases are divided and marked, and a test case set knowledge base is formed after model and knowledge graph training. Acquiring case keywords, and performing semantic analysis on the case keywords to obtain semantic analysis results; according to the semantic analysis result, searching the test case set knowledge base to obtain a search result, and if the similar case set exists in the test case set knowledge base according to the search result, obtaining a target similar case set; and analyzing the case keywords and the target similar case set by using the knowledge graph to generate a test case set.
As described in the background art, in the prior art, the knowledge graph can only find similar cases and cannot process newly added requirements, so as to solve the above problem, the embodiment of the application provides a method, a device, a computer readable storage medium and a case management system for generating test cases based on the knowledge graph.
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application.
The method embodiments provided in the embodiments of the present application may be performed in a mobile terminal, a computer terminal or similar computing device. Taking the operation on a mobile terminal as an example, fig. 1 is a block diagram of a hardware structure of a mobile terminal according to an embodiment of the present application, which is a method for generating a test case based on a knowledge graph. As shown in fig. 1, a mobile terminal may include one or more (only one is shown in fig. 1) processors 102 (the processor 102 may include, but is not limited to, a microprocessor MCU or a processing device such as a programmable logic device FPGA) and a memory 104 for storing data, wherein the mobile terminal may also include a transmission device 106 for communication functions and an input-output device 108. It will be appreciated by those skilled in the art that the structure shown in fig. 1 is merely illustrative and not limiting of the structure of the mobile terminal described above. For example, the mobile terminal may also include more or fewer components than shown in fig. 1, or have a different configuration than shown in fig. 1.
The memory 104 may be used to store a computer program, for example, a software program of application software and a module, such as a computer program corresponding to a display method of device information in an embodiment of the present invention, and the processor 102 executes the computer program stored in the memory 104 to perform various functional applications and data processing, that is, to implement the above-described method. Memory 104 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include memory remotely located relative to the processor 102, which may be connected to the mobile terminal via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof. The transmission device 106 is used to receive or transmit data via a network. Specific examples of the network described above may include a wireless network provided by a communication provider of the mobile terminal. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, simply referred to as NIC) that can connect to other network devices through a base station to communicate with the internet. In one example, the transmission device 106 may be a Radio Frequency (RF) module, which is configured to communicate with the internet wirelessly.
In this embodiment, a method for generating a test case based on a knowledge graph, which is executed on a mobile terminal, a computer terminal or a similar computing device, it should be noted that the steps illustrated in the flowchart of the drawings may be performed in a computer system such as a set of computer executable instructions, and that although a logical order is illustrated in the flowchart, in some cases the steps illustrated or described may be performed in an order different from that illustrated herein.
Fig. 2 is a flow chart of a method for generating a test case based on a knowledge-graph according to an embodiment of the application. As shown in fig. 2, the method comprises the steps of:
step S201, obtaining a new added service requirement, wherein the new added service requirement is a service requirement which is not stored in a knowledge graph, and the service requirement is a requirement for transacting service;
specifically, some business requirements are stored in advance in the knowledge graph, if new business requirements are met, namely new business requirements are added, the knowledge graph can be queried to determine whether the knowledge graph corresponds to the same business requirements, and if the knowledge graph does not correspond to the same business requirements as the new business requirements, the new business requirements are the new business requirements.
Step S202, a case generation model is constructed, wherein the case generation model is trained by using a plurality of sets of training data, and each set of training data in the plurality of sets of training data comprises a historical service requirement, a historical knowledge base, a historical service rule and a historical test case which are acquired in a historical time period;
specifically, the historical knowledge base is a pre-labeled expert knowledge base, and the expert knowledge base refers to a database or a resource base integrating expert knowledge and experience.
Specifically, machine learning training may be performed by using historical data, where the historical data includes historical service requirements and historical test cases corresponding to the historical service requirements, a historical knowledge base and historical test cases corresponding to the historical knowledge base, and historical service rules and historical test cases corresponding to the historical service rules are generated based on the historical service requirements, the historical knowledge base and the historical service rules, and the historical test cases are test cases already built based on the historical service requirements, the historical knowledge base and the historical service rules in a historical time period, and prediction, classification or new data generation are performed by learning patterns and rules in the historical data, so as to obtain a case generation model.
Step S203, inputting the new business requirement into the case generation model to obtain a new test case corresponding to the new business requirement;
in particular, the test analysis using the existing methods has the following drawbacks: the method can only process similar demands, can not perform test analysis and use case generation on newly added demands, has single input source of a test case knowledge base of the existing method, and does not support the input of structured business knowledge, semi-structured business demands and transaction baselines. Therefore, only the existing knowledge or similar knowledge can be searched, the existing use cases are output or new cases are generated according to the similar use cases, and the cases generated in the way have certain errors with the service demands. When the search element does not exist in the existing test case knowledge base, it cannot be processed later.
For example, the business requirement a stored in the knowledge graph can find the test case of the business requirement a in the knowledge graph if the business requirement a' exists, but if the newly added business requirement is B, the obtained test case is completely inaccurate because no knowledge about the business requirement B is stored in the knowledge graph, and the test case of the business requirement a or the test case of the business requirement C may be obtained.
Therefore, according to the scheme of the application, if the newly increased service requirement exists, the newly increased service requirement C is input into the case generation model, so that a newly increased test case corresponding to the newly increased service requirement C can be generated, namely, the newly increased test case is expanded for the newly increased service requirement C.
Of course, if the business requirement is a, and the test case of the business requirement a is originally stored in the knowledge graph, the business requirement a may not be input into the case generation model, and the test case of the business requirement a in the knowledge graph may be directly used, or in order to further expand the test case, the business requirement a may be input into the case generation model, so as to expand the test case of the business requirement a.
Step S204, inputting the new business requirement and the corresponding new test case into the knowledge graph to obtain an updated knowledge graph, wherein the updated knowledge graph at least comprises the business requirement, the test case corresponding to the business requirement, the new business requirement and the new test case corresponding to the new business requirement.
Specifically, the knowledge graph is pre-stored with service requirements and test cases corresponding to the service requirements, and when new test cases corresponding to the new service requirements are generated according to the case generation model, the knowledge graph can be updated, and the new service requirements and the corresponding new test cases are input into the knowledge graph, so that the knowledge graph can be perfected.
According to the embodiment, if the newly increased business requirement exists, the test case corresponding to the newly increased business requirement is generated according to the case generation model, so that the test case obtained when the newly increased business requirement exists corresponds to the newly increased business requirement, the newly increased business requirement and the corresponding newly increased test case are input into the knowledge graph, and the newly increased test case corresponding to the newly increased business requirement and the newly increased test business requirement can be stored in the knowledge graph, so that the test case generation can be performed on the requirements outside the existing knowledge graph through the scheme.
Specifically, in the scheme of the application, a method for testing analysis and test case generation is provided, and the purpose is to quickly analyze the requirements, reduce the time and workload of manually writing the test cases, thereby improving the testing efficiency and reducing the personnel cost.
The new business requirement is often a large requirement, and a plurality of steps or scenes can be included to realize the new business requirement, so that the new business requirement can be split to better analyze the new business requirement, in the specific realization process, the new business requirement is input into the case generation model to obtain a new test case corresponding to the new business requirement, and the new test case can be realized by the following steps: carrying out structural processing on the newly increased service requirement by adopting a deep learning technology to obtain at least one structural requirement, wherein the structural processing is orderly and normalized splitting processing on the newly increased service requirement, and one structural requirement corresponds to one test scene or one test step; and sequentially inputting all the structuring requirements into the case generation model to obtain all the new test cases corresponding to the new business requirements, wherein one of the new business requirements corresponds to at least one structuring requirement, and one of the structuring requirements corresponds to at least one of the new test cases.
In the scheme, the new business requirements can be subjected to structural processing, the new business requirements are split into at least one structural requirement, so that the new business requirements can be better analyzed, ambiguity and misunderstanding of the requirements are reduced, the structural requirements are easier to process and analyze by a computer program, tasks such as automatic requirement management, requirement tracking, requirement priority ordering and the like can be supported, the structural requirements can be more easily classified, filed and retrieved, and the reuse of the requirements is promoted, the sequential structural requirements can be sequentially input into a case generation model, at least one new test case can be generated by each structural requirement, and thus, the new test cases can be more efficiently generated according to the requirements of each step.
Specifically, the new business requirement and the structured requirement may be in a one-to-many relationship, and the structured requirement and the new test case may also be in a one-to-many relationship, so that the new business requirement may be split into small structured requirements, each small structured requirement may generate a plurality of new test cases, if a part of the requirements are directly input into the case generation model by the new business requirement, the quality of the generated new test cases may not be recognized, and the efficiency of generating the test cases is lower, so that the new business requirement is split, and the obtained plurality of structured requirements are input into the case generation model to generate the new test cases, so that the occurrence of the situation can be avoided, and the requirements of each step may be analyzed to generate the corresponding new test cases.
The service requirements are structured by adopting a deep learning technology, the data can be cleaned, preprocessed and marked, so that the data is suitable for training of deep learning models, deep learning models suitable for processing the service requirements, such as a cyclic neural network (RNN), a Convolutional Neural Network (CNN) or a Transformer, are selected and designed according to the characteristics of the requirements and the data types, and the original data is subjected to feature extraction and converted into a form which can be understood and processed by the models. For text data, text may be converted to a vector representation using word embedding techniques; for image data, features may be extracted using convolutional neural networks; for speech data, acoustic feature extraction techniques may be used. The deep learning model is trained using the prepared data set. And selecting a proper optimization algorithm and a proper loss function to perform model training according to the requirements and the data volume. Through iterative optimization of model parameters, the model can better fit data, and accuracy of demand structuring is improved. And evaluating the trained model by using a test set, calculating indexes such as accuracy, recall rate, F1 value and the like of the model, and evaluating the performance and generalization capability of the model. And optimizing and improving the model according to the evaluation result. And deploying the trained model into an actual service scene, and carrying out structural processing on new service requirements. The services of the structured requirements can be provided by means of API interfaces, mobile applications, etc.
Specifically, when a new business requirement is obtained, searching can be performed in the knowledge graph to determine whether the same business requirement can be found in the knowledge graph, if the same business requirement can be found in the knowledge graph, then the test case of the business requirement stored in the knowledge graph is directly extracted, and if the same business requirement cannot be found in the knowledge graph, then the new business requirement can be input into the case generation model to generate a new test case.
Specifically, the newly added service requirement may be processed according to a deep learning technology, for example, natural language processing is adopted, there is a newly added service requirement that user a needs to transfer money to user B, if natural language processing is adopted, natural language can be identified, and the new service requirement is converted into a structured requirement, and the structured requirement is sorted into a ordered and standardized flow, for example, the first structured requirement is that the service scenario is the transfer, the second structured requirement is that the user participating in the transfer is user a and user B, the third structured requirement is that the type of transfer is mobile phone bank transfer or website transfer or ATM machine transfer, the fourth structured requirement is that whether the account balance of user a meets the transfer requirement (if the transfer amount is 500 yuan and the account balance of user a is 100 yuan, the transfer requirement cannot be met), and if the transfer requirement is met, the fifth structured requirement is that the account balance of user a is deducted, and the sixth structured requirement is that the account balance of user B is increased.
The knowledge base is also provided with test points in related fields, the test work can be better guided through the test points, in the specific implementation process, the knowledge graph also comprises the test points, the test points are tasks for testing one test case, all the structuring requirements are sequentially input into the case generation model, and all the newly added test cases corresponding to the newly added service requirements are obtained through the following steps: searching whether the test key points corresponding to the structuring requirements exist in the knowledge graph; under the condition that the test key points corresponding to the structuring requirements are found, the test key points corresponding to the structuring requirements are extracted to serve as target test key points; under the condition that a target service with the service similarity greater than a similarity threshold value with the structuring requirement is found, updating the test key points of the target service according to the structuring requirement to obtain the target test key points; under the condition that the test key points corresponding to the structuring requirements are not found, generating the target test key points according to the structuring requirements; and inputting the target test key points into the case generation model to obtain all the new test cases corresponding to the new service requirements.
In the scheme, the test key points can be found in the knowledge graph, if the same or similar test key points can be found in the knowledge graph, the same test key points can be directly used as target test key points, if the similar test key points are found in the knowledge graph, the target test key points can be directly updated according to the test key points, if the test key points cannot be found in the knowledge graph, new test key points can be directly generated, thus the comprehensiveness and the accuracy of test work can be ensured, the design of a test case from scratch can be avoided, part of time for generating the test case can be saved, meanwhile, the consistency and the traceability of the test can be ensured, further, the new test case can be generated according to the target test key points, the efficiency and the quality of the test work can be improved, and the comprehensiveness, the accuracy, the consistency and the traceability of the test can be further ensured.
Specifically, the similarity threshold may be 80%, or 90%, or any other viable value.
Of course, the target test key point and the structural requirement can also be input into the knowledge graph, so that the updated knowledge graph comprises the service requirement, a test case corresponding to the service requirement, a new test case corresponding to the new service requirement, the target test key point and the structural requirement.
Specifically, the flow of the test analysis and case generation arrangement is shown in fig. 3, and includes the following steps: step (1), carrying out structuring treatment on service requirements by a manual analysis or deep learning method to obtain standard structuring requirements; step (2), carrying out entity identification on the structural requirement, inquiring the existing test knowledge graph, differentiating all the test points of the structural requirement, and outputting the test points needing to be newly added, modified and deleted; step (3), inputting the newly added and modified test points into a case generation model, and outputting test cases corresponding to the test points; and (4) updating the knowledge graph according to the results of the steps (2) and (3), and the existing test points and test cases in the knowledge graph to obtain a test case set corresponding to the requirements.
Specifically, for the above 2), the searching may be performed in a knowledge graph, the extracted organization requirements are input into the knowledge graph, channels (such as transfer, mobile phone transfer or website transfer) may be searched, contents in the knowledge graph are searched, for example, a user is searched, it may be determined that if the user is an individual user, the associated scene may be the user, a product used by the user, a channel used by the user to transfer money, what is done is transfer, saving money, money taking, and the like, and the above contents are made into the knowledge graph. The entity identification can be performed to identify channels, entities, network sites, banks, online banking, autonomous equipment, user types (personal users, company users, government users and financial institutions), after the business requirements are met, the business requirements are split into structural requirements, the entities are found and input into the knowledge graph, the fact that the structural requirements are found out is determined, and then the finding result is reversely updated.
For example, for the deletion test point described above, since there are many structured common steps, such as inquiring about the balance in the card, whether transferring money or withdrawing money, this action can be applied to many scenarios, and duplicate actions can be deleted.
For another example, in the newly added demand, the demand may be derived from the existing scene, if one demand is a website transfer, then the newly added demand is a mobile phone bank transfer, then one test key point in the website transfer is identity card verification, and for the mobile phone bank transfer, the identity card verification on the counter is not needed, but the APP is required to be logged in the mobile phone, so that a logged-in test key point can be added on the basis of the website transfer, and then one test key point of the identity card verification is deleted.
Specifically, the scheme of the application can carry out multidimensional retrieval and analysis on business requirements and test cases through clients, channels, products and requirement points, and can carry out case generation on newly-increased requirements. And identifying the newly added test key points by inquiring the knowledge graph. The test case generation can be performed on requirements outside the existing knowledge graph.
The scheme of the application can accurately multiplex the stock test cases. Based on the test knowledge graph generated by the structural requirement, entity identification can be performed on the newly added requirement, accurate searching is performed in the test knowledge graph, and accurate multiplexing of cases is realized.
In order to filter noise of the data, improve quality and accuracy of the data, so as to ensure that reliability and reliability of the data used for constructing the knowledge base are higher, before obtaining the new business requirement, the method further comprises the following steps: carrying out data cleaning on service data to obtain cleaned service data, wherein the service data comprises the service requirement and the test case corresponding to the service requirement; performing data verification on the cleaned service data to obtain a verification result, wherein the data verification comprises one or more of consistency verification, integrity verification and accuracy verification; and generating a knowledge base according to the business data which passes the verification under the condition that the verification result representation passes the verification, and generating prompt information under the condition that the verification result representation does not pass the verification.
In the scheme, the data can be cleaned and checked, the original business data possibly contains noise, errors or incomplete information, the problems can be removed through data cleaning, the quality and reliability of the data are improved, the data can conform to the standard and format of consistency, so that a unified data model and structure can be built in a knowledge base, the subsequent data analysis and application are facilitated, the data are cleaned and checked, a higher-quality knowledge base can be generated through the cleaned and checked data, and the accuracy of knowledge in the knowledge base is further improved.
Specifically, the deep learning technology is applied to the automatic generation scene of the test case, and the model construction mainly comprises the following steps:
step 1, constructing an expert knowledge base; step 2, generating a basic model; and step 3, optimizing through the basic model to generate a case generation model.
Specifically, the expert knowledge base is constructed based on information such as business requirements, existing test case libraries and expert experiences through techniques such as standard structuring (e.g. business modeling) of requirements, natural language processing and the like, and is mainly used for establishing association between requirements and test cases, assisting in training a large model and verifying test case data generated by the large model, and as shown in fig. 4, the main flow for constructing the expert knowledge base comprises the following steps:
step A, extracting temporary layer data: sampling of perfect basic data such as structured business demand data, test case data and the like is extracted in an ETL data extraction mode, and simple processing is carried out on the data in a data cleaning mode and the like;
and B, data layer business processing: the method comprises the steps of reading requirement data and test case data processed by a temporary layer, extracting the requirement data and the marked test case data according to a requirement rule template, wherein the rule template converts business requirements into structural requirements for marking, namely marking things done in a test case (such as counter transfer or money taking through a website), required nodes and test reasons, and thus, after the data are marked, the method is favorable for subsequent machine learning;
And C, checking the data quality: and performing consistency check, integrity check, accuracy check and the like during the operation of the data layer ETL.
Specifically, consistency verification is performed on the cleaned service data, and a consistency rule, such as a value range, an association relation and the like of data fields, can be determined according to service requirements and data characteristics. Verifying whether the type and format of the data field meet the regulations, such as the format of the date field, the data type of the digital field, and the like. It is checked whether the data meets predefined constraints, such as uniqueness constraints, foreign key constraints, etc. And comparing data among different data sources to ensure the consistency of values of key fields, such as the consistency of client information in different systems. If the data is found to be inconsistent, conflict resolution is needed, such as by way of data merging, data updating, and the like.
Specifically, the integrity check of the cleaned service data can determine the integrity rule, such as the necessary filling field, the association relation, the data range and the like, according to the service requirement and the data characteristics. And verifying whether the data contains necessary filling fields or not to ensure the integrity of the data. And verifying whether the association relationship between the data exists, such as foreign key association, father-son relationship and the like. Whether the data is within a prescribed range, such as whether the age is within a reasonable range, whether the amount is within a preset range, etc., is verified. If the data is found to be missing, the data is supplemented according to the business rules, and the integrity of the data is ensured.
Specifically, the accuracy of the cleaned service data can be checked to determine the accuracy standard and expected result of the data according to the service requirements and the data characteristics. This may include aspects of correctness, logical relationships, legitimacy, etc. of the data. And collecting service data to be checked, cleaning and preprocessing the service data, and ensuring the quality and consistency of the data. This may include removing duplicate data, processing missing values, processing outliers, etc. And selecting a proper data verification method according to the data type and verification requirements. Common methods include rule verification, logic verification, algorithm verification, and the like. And verifying the data according to the business rules and the predefined rules. For example, whether the verification date field conforms to a specified format, whether the verification value field is within a reasonable range, and the like. And verifying the data according to the logic relation between the data. For example, verifying whether the associated fields match, verifying that the parent-child relationships are correct, etc. And carrying out algorithm calculation on the specific data, and verifying the accuracy of a calculation result. For example, some numerical fields are summed, averaged, and compared to expected results
In order to improve the performance and effect of the model to meet the requirements of practical test applications, before constructing the case generation model, the method further comprises the following steps: constructing a basic model, wherein the basic model is trained by using a plurality of sets of training data, and each set of training data in the plurality of sets of training data comprises the historical service requirement, the historical knowledge base, the historical service rule and the historical test case which are acquired in a historical time period; and carrying out optimization processing on the basic model to obtain the case generation model, wherein the optimization processing comprises one or more of adjustment of model parameters, adjustment of coverage rate and similarity comparison.
In the scheme, the basic model can be optimized, so that the accuracy of the basic model can be improved, the generalization capability of the model is improved, the error of the model can be reduced by the case generation model obtained after optimization, the robustness and the stability of the case generation model are better, and further, the test case generated by the case generation model can be ensured to be more accurate.
Specifically, front-end transactions can be associated with test cases according to preset rules, executable test cases are generated, and correctness and coverage rate of the test cases are verified through expert knowledge base and test implementation. And then, according to the verification result, optimizing the basic model, and improving the test coverage rate and the test efficiency. The automatic generation of test cases is a dynamic and continuously evolving process, and the generated model needs to be continuously maintained and optimized, so that the effectiveness and the usability in an actual scene are ensured.
Specifically, verification can be performed according to the cases produced after the basic model is trained, the comparison is calculated and performed through the neural network vector similarity, and the basic model can be continuously trained in a mode of optimizing parameters or supplementing training data and the like if the expectation is not reached. The task capacity of generating the test cases is improved through continuous iteration, a basic model is perfected, and a case generation model is obtained.
In particular, optimizing the model may require adjusting parameters of the model to find the best configuration. This may be accomplished through the use of various optimization algorithms and techniques, such as grid searching, random searching, bayesian optimization, and the like. By cross-verifying on different combinations of parameters, the best performing parameters are selected.
In particular, features of the input data may be processed to extract more useful information. For example, the text data is subjected to a bag-of-word model, TF-IDF encoding, or the like, or the image data is subjected to edge detection, color distribution, or the like.
Specifically, the training data can be expanded to increase the generalization capability of the model. For example, in an image classification task, training samples may be added by way of rotation, flipping, scaling, etc.
Specifically, a suitable similarity calculation method may be used to measure the degree of similarity between different samples. Common similarity calculation methods include cosine similarity, euclidean distance, edit distance, and the like. The selection of the appropriate similarity calculation method depends on the specific application scenario and the data characteristics.
Specifically, for generating the basic model, as shown in fig. 5, the test case data marked in the expert knowledge base may be used to perform supervised instruction learning training in batches according to a scientific manner, so as to obtain the basic model.
Specifically, for generating a case generation model by optimizing the basic model, as shown in fig. 5, checking the test case output after training the basic model, calculating and comparing the vector similarity of the neural network, and continuing training the basic model by optimizing parameters or supplementing training data if the expectation is not reached, so as to optimize and improve the task capacity of the production test case through continuous iteration, thereby obtaining the case generation model.
Specifically, the verification of the test cases output after the training of the basic model may be performed in a manual verification manner, after the training of the basic model, the output test cases are manually verified, and are subjected to similarity matching with the test cases edited manually, if the similarity is smaller than a threshold (for example, 95% or 80%, etc.), the basic model may be optimized, if the similarity is greater than or equal to the threshold, the basic model may not be optimized, and the basic model is used as a case generation model, and of course, in order to ensure the accuracy of data, the basic model may be optimized when the similarity is greater than or equal to the threshold.
In addition, for the training data of another optimization mode, if the data has A+B, the format is AABBCC, and the basic model can only identify the format of AABBCC, and the format of ABBCCC cannot be identified, so that the training data of different formats can be adopted for supplementing so as to continue training the basic model, and the optimization of the basic model is realized.
Specifically, the scheme of the application can realize accurate test, shorten test period and support rapid iteration of service. Therefore, the method can adapt to a mode of agile development of the bank software in a new stage, realizes rapid agile test, and ensures that the system is rapidly delivered and brought on line. Through automatic positioning demand change influence scope, simplify test analysis process, can carry out quick analysis to the newly-increased demand, carry out accurate location to the demand change, reduce test cost, improve efficiency of software testing.
In some embodiments, after obtaining the new service requirement, the method further includes the following steps: a data preparation step, namely acquiring a structured requirement and acquiring a test case generated by the case generation model; a knowledge extraction step of obtaining a main body for constructing the knowledge graph, wherein the main body is a central node in the knowledge graph, and obtaining an association relationship between the business requirement and the test case; a knowledge fusion step of carrying out fusion processing on the knowledge extracted in the knowledge extraction step, wherein the fusion processing comprises one or more of relationship alignment, relationship disambiguation and relationship verification; and a knowledge application step of constructing the knowledge graph by taking the business requirement as an entity, the test case as an attribute and the association relationship as a triplet.
In the scheme, the original data required for constructing the knowledge graph can be obtained through data preparation, a usable data basis is provided for the subsequent steps, and meaningful, relational and attribute processes can be extracted from the original data through knowledge extraction, so that unstructured or semi-structured data can be converted into structured knowledge representation forms, the structured knowledge representation forms are converted into computable forms, a basis is provided for subsequent knowledge fusion and knowledge application, knowledge of different sources and different formats can be integrated and fused through knowledge fusion, conflicts can be eliminated, inconsistency among the data can be solved, the accuracy and the reliability of the knowledge can be improved, further a knowledge base can be constructed according to the knowledge, the knowledge base is applied to the field of test cases, and more accurate search results, personalized recommendation and intelligent question and answer can be provided for the test cases and service requirements, so that user experience and service effects are improved.
Specifically, as shown in fig. 6, the construction flow of the test knowledge graph mainly comprises the following steps:
basic data preparation step: structured business requirements, test case data generated using a large model (case generation model); specifically, the field and the target of the knowledge graph can be determined, the original data can be collected, the original data can comprise structured data, semi-structured data and unstructured data, the original data is cleaned, noise, repeated data and incomplete information are removed, the data is preprocessed, data format conversion, standardization, normalization and the like are included, a data mode and mode mapping are established, and preparation is made for subsequent knowledge extraction;
Knowledge extraction: through pretreatment and ontology construction (ontology extraction), a test knowledge graph integral framework is built, wherein the test knowledge graph integral framework mainly comprises attribute extraction, relationship extraction and entity extraction; specifically, a proper knowledge extraction method and technology can be selected according to the field and the target, such as natural language processing, information extraction and the like, entity extraction is performed on the cleaned and preprocessed data, entity objects in the text, such as characters, places, organizations and the like, relation extraction is performed, relation among the entities is extracted, a relation network is established, attribute information is extracted, attribute values of the entities, such as age, gender, address and the like, the extracted entities, the relation and the attributes are marked and classified, and a knowledge representation form is established;
and (3) knowledge fusion: the quality evaluation can be carried out through the automatic knowledge graph construction engine which comprises algorithms and processes of entity identification, relation extraction, reference resolution, disambiguation alignment (entity disambiguation), triplet storage, manual verification and the like; specifically, knowledge from different data sources can be aligned, duplicate and conflict contents are eliminated, inconsistencies such as naming inconsistencies, synonym problems and the like are solved, knowledge links are established, identical or related entities and relations are connected and integrated, a knowledge graph mode is established, attributes and constraints of the entities and the relations are defined, consistency and integrity of the knowledge graph are ensured, and data verification and quality control are performed;
Knowledge application step: outputting a test knowledge graph formed by a large number of knowledge triples, and carrying out knowledge reasoning through the knowledge graph; specifically, a proper knowledge application method and technology, such as a search engine, a recommendation system and the like, can be selected according to specific tasks and requirements, an index and search mechanism is established, knowledge graph-based information retrieval and query are supported, knowledge reasoning and inference are carried out, and knowledge graphs are utilized for carrying out logic reasoning and association analysis.
For example, for a test scenario, user a transfers to user B, and when an ontology is built, the user may be used as the ontology, or the transfer step may be used as the ontology, and the ontology may be used as the central node of the knowledge graph, for example, there may be a, a' and a″, and it is only necessary to specifically select who is the ontology.
For example, for knowledge fusion, a business scenario is that a user transfers money through a counter, and in particular, there are several entities, several customers, channels for transferring money, etc. steps are all subdivided, for example, a first step is to look at balance, it is useful for each step, the relationship between each step is associated, similar requirements can be extracted, for example, a mobile phone bank purchases money management, it is possible to identify that the user is to purchase money management, a specific step is to log in an account in the first step, a second step is to determine business rules, and in fact there are similar steps for purchasing money management and transferring money, for example, log in this step, so steps can be fused.
Specifically, the scheme of the application can realize the construction of expert knowledge base, case generation model and test knowledge graph by inputting various kinds of knowledge. Including structured business requirements, semi-structured business requirements, system transaction baselines, etc.
In some current solutions, according to the requirement document and the extracted multiple requirement points, a relationship between the multiple requirement points is established, a requirement view is established, the relationship between the requirement and the functional point is shown in the requirement view, and the relationship between the requirement and the test case is not established, so that on one hand, the test range cannot be determined according to the requirement, and on the other hand, the associated service scene cannot be located through the test case, and therefore, the two-way traceability of the service requirement and the test case cannot be achieved, and on some embodiments, after the knowledge graph is constructed, the method further includes the following steps: acquiring a query requirement, wherein the query requirement is a requirement for querying the service requirement and/or the test case from the knowledge graph; and searching keywords in the knowledge graph according to the keywords in the query requirement to obtain a search result, and displaying the search result in a graphical mode.
In the scheme, the tested knowledge graph can realize a visual analysis mode of multidimensional query, the multidimensional query is carried out according to different scenes and elements, and the visual query of keyword search and graph data display (graph data mining) technology can be adopted to help a user to better understand and explore information in the knowledge graph.
The knowledge graph visualization query is a relatively visual graph multidimensional query mode, and information in the knowledge graph is displayed in a graph mode. The visualized query visualizes different types of data, such as node attributes, relationships, semantics and the like, and the contents are displayed in a graph form, so that a user can more easily understand the query result, the cognitive load of the user is reduced, and the user can more easily understand the query result. For example, a tree diagram, foam diagram, etc. may be used to express a hierarchy or association of information. Actionable graphs refer to information that a user can explore a knowledge graph through interactions with the graph. For example, more detailed information may be obtained by clicking on, zooming in and out of details, etc.
The knowledge-graph keyword search is a common graph query mode, and knowledge-graph information related to the input words or phrases is obtained through the search. Although the query mode is simple and feasible, the accuracy of the query result is not high because the keyword input by the user may have ambiguity. In addition, this query approach does not accurately control the number and accuracy of query results and is therefore relatively inefficient in processing large-scale data. As a way of multidimensional query, the core is keyword selection and query expression.
Specifically, the above scheme can realize the association between the test service requirement and the test case, the service requirement can be used for seeing what the test case is, for example, the input keyword channel is a mobile phone bank, what the test case corresponding to the mobile phone bank is, what the current test progress is, the forward direction is used for searching the test case through the service requirement, the reverse direction is used for searching the service requirement through the test case, and the reverse direction searching can be used for determining the service range associated with the test case.
The two-way tracing from the knowledge graph to the test case is mainly realized by combining graph data mining, associated data query and information retrieval technologies, and the knowledge graph, the test case and the service information are subjected to associated query and analysis mining, so that the associated data are presented in a visual mode.
The scheme of the application can realize the bidirectional traceability from business requirement to test case and from test case to business requirement. The forward trace is used for inquiring the associated test scene and the corresponding test case through the service model information, so that the test range can be conveniently and quickly defined. The test progress linkage can acquire test execution conditions of related business scenes, such as test coverage rate (for example, 100 forces are applied to transfer design, but only 80 tests are found finally, so that the coverage rate is 80%, the number of applied test forces can be determined), test passing rate and the like, and the method can be applied to scenes such as analysis of influence of demand change on the test. The reverse tracing is to quickly locate the corresponding service model content through the test cases, so that the service influence range of defects found in the quick locating test is facilitated, the problem range is reduced, and potential defects are found.
The scheme of the application can establish the traceability of the test process. And establishing an association relation between the service requirements, the test cases and the test defects through the knowledge graph, and rapidly positioning all relevant elements corresponding to the defects when the test defects are found. The AI technology is used for better analyzing and tracing related data and information, so that efficient test supervision control is realized.
The embodiment of the application also provides a device for generating the test case based on the knowledge graph, and the device for generating the test case based on the knowledge graph can be used for executing the method for generating the test case based on the knowledge graph. The device is used for realizing the above embodiments and preferred embodiments, and is not described in detail. As used below, the term "module" may be a combination of software and/or hardware that implements a predetermined function. While the means described in the following embodiments are preferably implemented in software, implementation in hardware, or a combination of software and hardware, is also possible and contemplated.
The device for generating the test case based on the knowledge graph provided by the embodiment of the application is described below.
Fig. 7 is a block diagram of a knowledge-graph-based test case generation apparatus according to an embodiment of the present application. As shown in fig. 7, the apparatus includes:
a first obtaining unit 10, configured to obtain a new service requirement, where the new service requirement is a service requirement that is not stored in a knowledge graph, and the service requirement is a requirement of transacting a service;
a first construction unit 20, configured to construct a case generation model, where the case generation model is trained using a plurality of sets of training data, and each set of training data in the plurality of sets of training data includes a historical business requirement, a historical knowledge base, a historical business rule, and a historical test case acquired in a historical time period;
the first processing unit 30 is configured to input the new service requirement into the case generation model to obtain a new test case corresponding to the new service requirement;
the updating unit 40 is configured to input the new service requirement and the corresponding new test case into the knowledge graph to obtain an updated knowledge graph, where the updated knowledge graph at least includes the service requirement, the test case corresponding to the service requirement, the new service requirement, and the new test case corresponding to the new service requirement.
According to the embodiment, if the newly increased business requirement exists, the test case corresponding to the newly increased business requirement is generated according to the case generation model, so that the test case obtained when the newly increased business requirement exists corresponds to the newly increased business requirement, the newly increased business requirement and the corresponding newly increased test case are input into the knowledge graph, and the newly increased test case corresponding to the newly increased business requirement and the newly increased test business requirement can be stored in the knowledge graph, so that the test case generation can be performed on the requirements outside the existing knowledge graph through the scheme.
The new business requirement is often a large requirement, and a plurality of steps or scenes can be included to realize the new business requirement, so that the new business requirement can be split to better analyze the new business requirement, in the specific implementation process, the first processing unit comprises a first processing module and a second processing module, the first processing module is used for carrying out structural processing on the new business requirement by adopting a deep learning technology to obtain at least one structural requirement, wherein the structural processing is orderly and normalized split processing on the new business requirement, and one structural requirement corresponds to one test scene or one test step; the second processing module is configured to sequentially input all the structured requirements into the case generation model to obtain all the new test cases corresponding to the new business requirements, where one of the new business requirements corresponds to at least one of the structured requirements and one of the structured requirements corresponds to at least one of the new test cases.
In the scheme, the new business requirements can be subjected to structural processing, the new business requirements are split into at least one structural requirement, so that the new business requirements can be better analyzed, ambiguity and misunderstanding of the requirements are reduced, the structural requirements are easier to process and analyze by a computer program, tasks such as automatic requirement management, requirement tracking, requirement priority ordering and the like can be supported, the structural requirements can be more easily classified, filed and retrieved, and the reuse of the requirements is promoted, the sequential structural requirements can be sequentially input into a case generation model, at least one new test case can be generated by each structural requirement, and thus, the new test cases can be more efficiently generated according to the requirements of each step.
The knowledge base is also provided with test points in related fields, the test work can be better guided through the test points, in the specific implementation process, the knowledge graph also comprises the test points, the test points are tasks for testing one test case, the second processing module comprises a searching sub-module, a first processing sub-module, a second processing sub-module, a third processing sub-module and a fourth processing sub-module, and the searching sub-module is used for searching whether the test points corresponding to the structural requirements exist in the knowledge graph; the first processing sub-module is used for extracting the test key points corresponding to the structuring requirements as target test key points under the condition that the test key points corresponding to the structuring requirements are found out; the second processing sub-module is used for updating the test key points of the target service according to the structuring requirement under the condition that the target service with the service similarity larger than a similarity threshold value with the structuring requirement is found, so as to obtain the target test key points; the third processing sub-module is used for generating the target test key point according to the structuring requirement under the condition that the test key point corresponding to the structuring requirement is not found; and the fourth processing submodule is used for inputting the target test key points into the case generation model to obtain all the new test cases corresponding to the new service requirements.
In the scheme, the test key points can be found in the knowledge graph, if the same or similar test key points can be found in the knowledge graph, the same test key points can be directly used as target test key points, if the similar test key points are found in the knowledge graph, the target test key points can be directly updated according to the test key points, if the test key points cannot be found in the knowledge graph, new test key points can be directly generated, thus the comprehensiveness and the accuracy of test work can be ensured, the design of a test case from scratch can be avoided, part of time for generating the test case can be saved, meanwhile, the consistency and the traceability of the test can be ensured, further, the new test case can be generated according to the target test key points, the efficiency and the quality of the test work can be improved, and the comprehensiveness, the accuracy, the consistency and the traceability of the test can be further ensured.
In order to filter noise of data and improve quality and accuracy of the data so as to ensure higher reliability and reliability of the data used for constructing a knowledge base, the device further comprises a cleaning unit, a checking unit and a generating unit, wherein the cleaning unit is used for cleaning the data of the service data before acquiring a new service requirement to obtain the cleaned service data, and the service data comprises the service requirement and the test case corresponding to the service requirement; the verification unit is used for carrying out data verification on the cleaned service data to obtain a verification result, wherein the data verification comprises one or more of consistency verification, integrity verification and accuracy verification; the generating unit is used for generating a knowledge base according to the business data which passes the verification under the condition that the verification result representation passes the verification, and generating prompt information under the condition that the verification result representation does not pass the verification.
In the scheme, the data can be cleaned and checked, the original business data possibly contains noise, errors or incomplete information, the problems can be removed through data cleaning, the quality and reliability of the data are improved, the data can conform to the standard and format of consistency, so that a unified data model and structure can be built in a knowledge base, the subsequent data analysis and application are facilitated, the data are cleaned and checked, a higher-quality knowledge base can be generated through the cleaned and checked data, and the accuracy of knowledge in the knowledge base is further improved.
In order to improve the performance and effect of the model and meet the requirements of practical test application, the device further comprises a second construction unit and a second processing unit, wherein the second construction unit is used for constructing a basic model before constructing a case generation model, the basic model is obtained by training by using multiple sets of training data, and each set of training data in the multiple sets of training data comprises the historical service requirements, the historical knowledge base, the historical service rules and the historical test cases which are acquired in a historical time period; and the second processing unit is used for carrying out optimization processing on the basic model to obtain the case generation model, wherein the optimization processing comprises one or more of adjustment of model parameters, adjustment of coverage rate and similarity comparison.
In the scheme, the basic model can be optimized, so that the accuracy of the basic model can be improved, the generalization capability of the model is improved, the error of the model can be reduced by the case generation model obtained after optimization, the robustness and the stability of the case generation model are better, and further, the test case generated by the case generation model can be ensured to be more accurate.
In some embodiments, the apparatus further includes a data preparation unit, a knowledge extraction unit, a knowledge fusion unit, and a knowledge application unit, where the data preparation unit is configured to perform a data preparation step after acquiring a new service requirement, acquire a structured requirement, and acquire a test case generated by the case generation model; the knowledge extraction unit is used for executing a knowledge extraction step, obtaining a main body for constructing the knowledge graph, wherein the main body is a central node in the knowledge graph, and obtaining the association relationship between the business requirement and the test case; the knowledge fusion unit is used for executing a knowledge fusion step and carrying out fusion processing on the knowledge extracted in the knowledge extraction step, wherein the fusion processing comprises one or more of relationship alignment, relationship disambiguation and relationship verification; the knowledge application unit is used for executing a knowledge application step, and constructing the knowledge graph by taking the business requirement as an entity, the test case as an attribute and the association relationship as a triplet.
In the scheme, the original data required for constructing the knowledge graph can be obtained through data preparation, a usable data basis is provided for the subsequent steps, and meaningful, relational and attribute processes can be extracted from the original data through knowledge extraction, so that unstructured or semi-structured data can be converted into structured knowledge representation forms, the structured knowledge representation forms are converted into computable forms, a basis is provided for subsequent knowledge fusion and knowledge application, knowledge of different sources and different formats can be integrated and fused through knowledge fusion, conflicts can be eliminated, inconsistency among the data can be solved, the accuracy and the reliability of the knowledge can be improved, further a knowledge base can be constructed according to the knowledge, the knowledge base is applied to the field of test cases, and more accurate search results, personalized recommendation and intelligent question and answer can be provided for the test cases and service requirements, so that user experience and service effects are improved.
In some current solutions, according to a requirement document and the extracted multiple requirement points, a relationship between the multiple requirement points is established, a requirement view is established, the relationship between the requirement and the functional point is shown in the requirement view, and the relationship between the requirement and the test case is not established, so that on one hand, a test range cannot be determined according to the requirement, and on the other hand, an associated service scene cannot be located through the test case, and therefore, bidirectional traceability of the service requirement and the test case cannot be achieved, and in some embodiments, the device further comprises a second acquisition unit and a third processing unit, wherein the second acquisition unit is used for acquiring a query requirement after the knowledge graph is constructed, and the query requirement is a requirement for querying the service requirement and/or the test case from the knowledge graph; and the third processing unit is used for searching the keywords in the knowledge graph according to the keywords in the query requirement to obtain search results, and displaying the search results in a graphical mode.
In the scheme, the tested knowledge graph can realize a visual analysis mode of multidimensional query, the multidimensional query is carried out according to different scenes and elements, and the visual query of keyword search and graph data display (graph data mining) technology can be adopted to help a user to better understand and explore information in the knowledge graph.
The device for generating the test case based on the knowledge graph comprises a processor and a memory, wherein the first acquisition unit, the first construction unit, the first processing unit, the updating unit and the like are all stored in the memory as program units, and the processor executes the program units stored in the memory to realize corresponding functions. The modules are all located in the same processor; alternatively, the above modules may be located in different processors in any combination.
The processor includes a kernel, and the kernel fetches the corresponding program unit from the memory. The kernel can be provided with one or more than one kernel, and the problem that the knowledge graph in the prior art can only find similar cases and cannot process newly increased demands is solved by adjusting kernel parameters.
The memory may include volatile memory, random Access Memory (RAM), and/or nonvolatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM), among other forms in computer readable media, the memory including at least one memory chip.
The embodiment of the application provides a computer readable storage medium, which comprises a stored program, wherein the program is used for controlling equipment where the computer readable storage medium is located to execute the method for generating the test case based on the knowledge graph.
The embodiment of the application provides a processor which is used for running a program, wherein the method for generating the test case based on the knowledge graph is executed when the program runs.
The application also provides a case management system comprising one or more processors, a memory, and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, and the one or more programs comprise a generating method for executing any one of the knowledge-graph-based test cases.
The embodiment of the application provides equipment, which comprises a processor, a memory and a program stored in the memory and capable of running on the processor, wherein the processor realizes the steps of a method for generating a test case based on a knowledge graph when executing the program. The device herein may be a server, PC, PAD, cell phone, etc.
The application also provides a computer program product adapted to perform a program of steps of a method of generating test cases initialized with at least knowledge-based profiles when executed on a data processing device.
It will be appreciated by those skilled in the art that the modules or steps of the application described above may be implemented in a general purpose computing device, they may be concentrated on a single computing device, or distributed across a network of computing devices, they may be implemented in program code executable by computing devices, so that they may be stored in a storage device for execution by computing devices, and in some cases, the steps shown or described may be performed in a different order than that shown or described herein, or they may be separately fabricated into individual integrated circuit modules, or multiple modules or steps of them may be fabricated into a single integrated circuit module. Thus, the present application is not limited to any specific combination of hardware and software.
It will be appreciated by those skilled in the art that embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In one typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include volatile memory in a computer-readable medium, random Access Memory (RAM) and/or nonvolatile memory, etc., such as Read Only Memory (ROM) or flash RAM. Memory is an example of a computer-readable medium.
Computer readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of storage media for a computer include, but are not limited to, phase change memory (PRAM), static Random Access Memory (SRAM), dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), read Only Memory (ROM), electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium, which can be used to store information that can be accessed by a computing device. Computer-readable media, as defined herein, does not include transitory computer-readable media (transmission media), such as modulated data signals and carrier waves.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article or apparatus that comprises an element.
From the above description, it can be seen that the above embodiments of the present application achieve the following technical effects:
1) According to the method for generating the test cases based on the knowledge graph, if the new business requirements exist, the test cases corresponding to the new business requirements are generated according to the case generation model, so that the test cases obtained when the new business requirements exist correspond to the new business requirements, the new business requirements and the corresponding new test cases are input into the knowledge graph, and the new test business requirements and the new test cases corresponding to the new test business requirements can be stored in the knowledge graph, so that the test case generation can be performed on requirements outside the existing knowledge graph through the scheme.
2) According to the device for generating the test cases based on the knowledge graph, if the new business requirements exist, the test cases corresponding to the new business requirements are generated according to the case generation model, so that the test cases obtained when the new business requirements exist correspond to the new business requirements, the new business requirements and the corresponding new test cases are input into the knowledge graph, and the new test business requirements and the new test cases corresponding to the new test business requirements can be stored in the knowledge graph, so that the test case generation can be performed on requirements outside the existing knowledge graph through the scheme.
The above description is only of the preferred embodiments of the present application and is not intended to limit the present application, but various modifications and variations can be made to the present application by those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the protection scope of the present application.

Claims (10)

1. The method for generating the test case based on the knowledge graph is characterized by comprising the following steps of:
acquiring a new added service requirement, wherein the new added service requirement is a service requirement which is not stored in a knowledge graph, and the service requirement is a requirement for handling a service;
Constructing a case generation model, wherein the case generation model is trained by using a plurality of sets of training data, and each set of training data in the plurality of sets of training data comprises a historical service requirement, a historical knowledge base, a historical service rule and a historical test case which are acquired in a historical time period;
inputting the new business requirements to the case generation model to obtain new test cases corresponding to the new business requirements;
inputting the new business requirement and the corresponding new test case into the knowledge graph to obtain an updated knowledge graph, wherein the updated knowledge graph at least comprises the business requirement, the test case corresponding to the business requirement, the new business requirement and the new test case corresponding to the new business requirement.
2. The method of claim 1, wherein inputting the new business requirement to the case generation model to obtain a new test case corresponding to the new business requirement comprises:
carrying out structural processing on the newly-increased business requirement by adopting a deep learning technology to obtain at least one structural requirement, wherein the structural processing is orderly and normalized splitting processing on the newly-increased business requirement, and one structural requirement corresponds to one test scene or one test step;
And sequentially inputting all the structured demands into the case generation model to obtain all the new test cases corresponding to the new business demands, wherein one new business demand corresponds to at least one structured demand, and one structured demand corresponds to at least one new test case.
3. The method of claim 2, wherein the knowledge graph further includes a test point, the test point being a task for testing one test case, and sequentially inputting all the structured requirements to the case generation model to obtain all the new test cases corresponding to the new business requirements, including:
searching whether the test key points corresponding to the structuring requirements exist in the knowledge graph;
under the condition that the test key points corresponding to the structural requirements are found, the test key points corresponding to the structural requirements are extracted to serve as target test key points;
under the condition that a target service with the service similarity greater than a similarity threshold value with the structuring requirement is found, updating the test key points of the target service according to the structuring requirement to obtain the target test key points;
Generating the target test key point according to the structuring requirement under the condition that the test key point corresponding to the structuring requirement is not found;
and inputting the target test key points into the case generation model to obtain all the new test cases corresponding to the new service requirements.
4. The method of claim 1, wherein prior to acquiring the new service requirement, the method further comprises:
carrying out data cleaning on service data to obtain cleaned service data, wherein the service data comprises the service requirement and the test case corresponding to the service requirement;
performing data verification on the cleaned service data to obtain a verification result, wherein the data verification comprises one or more of consistency verification, integrity verification and accuracy verification;
and generating a knowledge base according to the business data which passes the verification under the condition that the verification result representation passes the verification, and generating prompt information under the condition that the verification result representation does not pass the verification.
5. The method of claim 1, wherein prior to constructing the case creation model, the method further comprises:
Constructing a basic model, wherein the basic model is obtained by training by using a plurality of sets of training data, and each set of training data in the plurality of sets of training data comprises the historical service requirements, the historical knowledge base, the historical service rules and the historical test cases which are acquired in a historical time period;
and carrying out optimization processing on the basic model to obtain the case generation model, wherein the optimization processing comprises one or more of adjustment of model parameters, adjustment of coverage rate and similarity comparison.
6. The method of claim 1, wherein after obtaining the new service requirement, the method further comprises:
a data preparation step, namely acquiring a structured requirement and acquiring a test case generated by the case generation model;
a knowledge extraction step, namely acquiring a main body for constructing the knowledge graph, wherein the main body is a central node in the knowledge graph, and acquiring an association relationship between the business requirement and the test case;
a knowledge fusion step of carrying out fusion processing on the knowledge extracted in the knowledge extraction step, wherein the fusion processing comprises one or more of relationship alignment, relationship disambiguation and relationship verification;
And a knowledge application step, wherein the business requirement is taken as an entity, the test case is taken as an attribute, and the association relationship is taken as a triplet to construct the knowledge graph.
7. The method of claim 6, wherein after constructing the knowledge-graph, the method further comprises:
acquiring a query requirement, wherein the query requirement is a requirement for querying the business requirement and/or the test case from the knowledge graph;
and carrying out keyword searching in the knowledge graph according to the keywords in the query requirement to obtain a search result, and displaying the search result in a graphical mode.
8. A device for generating a test case based on a knowledge graph, comprising:
the system comprises a first acquisition unit, a second acquisition unit and a third acquisition unit, wherein the first acquisition unit is used for acquiring a new business requirement, the new business requirement is a business requirement which is not stored in a knowledge graph, and the business requirement is a business handling requirement;
the first construction unit is used for constructing a case generation model, wherein the case generation model is trained by using a plurality of sets of training data, and each set of training data in the plurality of sets of training data comprises a historical service requirement, a historical knowledge base, a historical service rule and a historical test case which are acquired in a historical time period;
The first processing unit is used for inputting the new business requirements into the case generation model to obtain new test cases corresponding to the new business requirements;
the updating unit is used for inputting the new business requirement and the corresponding new test case into the knowledge graph to obtain an updated knowledge graph, wherein the updated knowledge graph at least comprises the business requirement, the test case corresponding to the business requirement, the new business requirement and the new test case corresponding to the new business requirement.
9. A computer-readable storage medium, characterized in that the computer-readable storage medium comprises a stored program, wherein the device in which the computer-readable storage medium is controlled to execute the method for generating a test case based on a knowledge-graph according to any one of claims 1 to 7 when the program runs.
10. A case management system, comprising: one or more processors, memory, and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, the one or more programs comprising a method for performing the knowledge-graph based test case generation of any of claims 1-7.
CN202311287685.8A 2023-10-07 2023-10-07 Method and device for generating test cases based on knowledge graph Pending CN117130938A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311287685.8A CN117130938A (en) 2023-10-07 2023-10-07 Method and device for generating test cases based on knowledge graph

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311287685.8A CN117130938A (en) 2023-10-07 2023-10-07 Method and device for generating test cases based on knowledge graph

Publications (1)

Publication Number Publication Date
CN117130938A true CN117130938A (en) 2023-11-28

Family

ID=88854724

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311287685.8A Pending CN117130938A (en) 2023-10-07 2023-10-07 Method and device for generating test cases based on knowledge graph

Country Status (1)

Country Link
CN (1) CN117130938A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN118551840A (en) * 2024-07-25 2024-08-27 湖南汇视威智能科技有限公司 Knowledge extraction system and knowledge extraction method based on large language model algorithm

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN118551840A (en) * 2024-07-25 2024-08-27 湖南汇视威智能科技有限公司 Knowledge extraction system and knowledge extraction method based on large language model algorithm
CN118551840B (en) * 2024-07-25 2024-10-29 湖南汇视威智能科技有限公司 Knowledge extraction system and knowledge extraction method based on large language model algorithm

Similar Documents

Publication Publication Date Title
Gong et al. A survey on dataset quality in machine learning
US11119980B2 (en) Self-learning operational database management
US20210173817A1 (en) Method and system for large scale data curation
Jiang et al. Recent research advances on interactive machine learning
CN111026842B (en) Natural language processing method, natural language processing device and intelligent question-answering system
Wang et al. Industrial big data analytics: challenges, methodologies, and applications
CN106447066A (en) Big data feature extraction method and device
US20170109639A1 (en) General Model for Linking Between Nonconsecutively Performed Steps in Business Processes
CN111078776A (en) Data table standardization method, device, equipment and storage medium
US20170109638A1 (en) Ensemble-Based Identification of Executions of a Business Process
Vysotska et al. Intelligent analysis of Ukrainian-language tweets for public opinion research based on NLP methods and machine learning technology
KR20160104064A (en) A multidimensional recursive learning process and system used to discover complex dyadic or multiple counterparty relationships
CN115438740A (en) Multi-source data convergence and fusion method and system
US20170109640A1 (en) Generation of Candidate Sequences Using Crowd-Based Seeds of Commonly-Performed Steps of a Business Process
Yang Financial big data management and control and artificial intelligence analysis method based on data mining technology
Salih et al. Data quality issues in big data: a review
CN116976321A (en) Text processing method, apparatus, computer device, storage medium, and program product
CN117130938A (en) Method and device for generating test cases based on knowledge graph
CN115358481A (en) Early warning and identification method, system and device for enterprise ex-situ migration
CN114860941A (en) Industry data management method and system based on data brain
Yahia et al. A new approach for evaluation of data mining techniques
CN113610626A (en) Bank credit risk identification knowledge graph construction method and device, computer equipment and computer readable storage medium
CN118132750A (en) Processing method and device for customer service data in power industry
CN117744769A (en) Knowledge graph construction method and device for industrial chain data, electronic equipment and medium
CN117076770A (en) Data recommendation method and device based on graph calculation, storage value and electronic equipment

Legal Events

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