[go: up one dir, main page]
More Web Proxy on the site http://driver.im/

CN110955608B - Test data processing method, device, computer equipment and storage medium - Google Patents

Test data processing method, device, computer equipment and storage medium Download PDF

Info

Publication number
CN110955608B
CN110955608B CN201911338952.3A CN201911338952A CN110955608B CN 110955608 B CN110955608 B CN 110955608B CN 201911338952 A CN201911338952 A CN 201911338952A CN 110955608 B CN110955608 B CN 110955608B
Authority
CN
China
Prior art keywords
directed graph
test case
node
program
link
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.)
Active
Application number
CN201911338952.3A
Other languages
Chinese (zh)
Other versions
CN110955608A (en
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.)
Kingdee Software China Co Ltd
Original Assignee
Kingdee Software China Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Kingdee Software China Co Ltd filed Critical Kingdee Software China Co Ltd
Priority to CN201911338952.3A priority Critical patent/CN110955608B/en
Publication of CN110955608A publication Critical patent/CN110955608A/en
Application granted granted Critical
Publication of CN110955608B publication Critical patent/CN110955608B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

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/3688Test management for test execution, e.g. scheduling of test suites
    • 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

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The application provides a test data processing method, a device, equipment and a storage medium, which comprise the following steps: acquiring a program to be tested and a corresponding directed graph, wherein the directed graph takes each function in the program to be tested as a node, and generates directed connection among the nodes according to the successive calling relation of each function; acquiring node information of each node in the directed graph from a program to be tested, and marking the corresponding each node; traversing the directed graph to obtain a directed graph link set corresponding to the directed graph; and determining directed graph link keywords corresponding to directed graph links in the directed graph link set according to node information corresponding to each node, and matching the directed graph links in the directed graph link set with candidate test case templates according to the directed graph link keywords and the test case template keywords to obtain target test case templates corresponding to the directed graph links, so that corresponding target test cases can be obtained, and common testers can easily detect faults which cannot be found by the black box test.

Description

Test data processing method, device, computer equipment and storage medium
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a test data processing method, a test data processing device, a computer device, and a storage medium.
Background
Currently, with the development of computer technology, different types of software applications are generated, and each software application needs to be tested before being released to detect functions, performances and the like of the application.
The test is divided into a black box test and a white box test, the black box test depends on a requirement document and a requirement specification, a tester can only test software according to the functions described in the requirement specification, and the tester does not know the internal implementation logic of the code, so that test points are easily omitted in the test process. If the conventional white-box test is adopted, the quality requirement on the testers is high, and the testers need to know the program code logic to detect the software bug.
Disclosure of Invention
In view of the foregoing, it is desirable to provide a test data processing method, apparatus, computer device, and storage medium that enable a typical tester to easily detect a failure that cannot be found by the black box test.
A method of test data processing, the method comprising:
acquiring a program to be tested, and acquiring a directed graph corresponding to the program to be tested, wherein the directed graph takes each function in the program to be tested as a node, and generates directed connection among the nodes according to the successive calling relation of each function;
acquiring node information of each node in the directed graph from the program to be tested, and marking the corresponding nodes according to the node information;
traversing the directed graph to obtain a directed graph link set corresponding to the directed graph;
determining directed graph link keywords corresponding to directed graph links in the directed graph link set according to node information corresponding to each node, and matching the directed graph links in the directed graph link set with candidate test case templates according to the directed graph link keywords and the test case template keywords to obtain target test case templates corresponding to the directed graph links;
and obtaining the target test case corresponding to the directed graph link according to the target test case template corresponding to the directed graph link.
In one embodiment, the obtaining the directed graph corresponding to the program to be tested includes:
analyzing the execution process of a program to be tested, and detecting the calling relation among all functions of the program to be tested through program instructions, wherein the program instructions comprise at least one of turning instructions and branch instructions;
when a directed calling relationship exists between a first function and a second function, determining a directed connector between a first node corresponding to the first function and a second node corresponding to the second function according to the calling relationship;
and connecting the first node and the second node through the directed connector.
In one embodiment, the determining, according to node information corresponding to each node, a directed graph link keyword corresponding to a directed graph link in the directed graph link set, and according to the directed graph link keyword and the test case template keyword, matching the directed graph link in the directed graph link set with a candidate test case template, to obtain a target test case template corresponding to the directed graph link includes:
acquiring node information corresponding to each node in a directed graph link, wherein the node information comprises entity information;
extracting a current directed graph link keyword corresponding to the directed graph link from the entity information;
matching the current directed graph link keywords with the test case template keywords corresponding to the candidate test case templates respectively;
and when the matching is successful, the candidate test case template which is successfully matched is used as a target test case template corresponding to the directed graph link.
In one embodiment, the method further comprises: :
generating a current keyword vector corresponding to a directed graph link in the directed graph link set;
and inputting the current keyword vector into a trained test case prediction model to obtain a target test case corresponding to the directed graph link output by the test case prediction model.
In one embodiment, the generating step of the trained test case prediction model includes:
acquiring a training directed graph link and a corresponding standard test case;
acquiring training directed graph link keywords corresponding to the training directed graph links to form training keyword vectors;
inputting the training keyword vector into a test case prediction model to obtain a predicted test case output by the test case prediction model;
and adjusting parameters of the test case prediction model according to the prediction test case and the standard test case corresponding to the training directed graph link until a preset condition is met, and generating the trained test case prediction model.
A test data processing apparatus, the apparatus comprising:
the system comprises an acquisition module, a processing module and a processing module, wherein the acquisition module is used for acquiring a program to be tested, acquiring a directed graph corresponding to the program to be tested, and generating directed connection among all nodes according to the calling relationship of all functions by taking all functions in the program to be tested as nodes;
the node marking module is used for acquiring node information of each node in the directed graph from the program to be tested and marking information of each corresponding node according to the node information;
the directed graph link set determining module is used for traversing the directed graph to obtain a directed graph link set corresponding to the directed graph;
the template matching module is used for determining directed graph link keywords corresponding to the directed graph links in the directed graph link set according to node information corresponding to each node, and matching the directed graph links in the directed graph link set with candidate test case templates according to the directed graph link keywords and the test case template keywords to obtain target test case templates corresponding to the directed graph links;
and the first target test case determining module is used for obtaining the target test case corresponding to the directed graph link according to the target test case template corresponding to the directed graph link.
In one embodiment, the template matching module is further configured to obtain node information corresponding to each node in the directed graph link, where the node information includes entity information, extract a current directed graph link keyword corresponding to the directed graph link from the entity information, and match the current directed graph link keyword with a test case template keyword corresponding to each candidate test case template, where when the matching is successful, the candidate test case template that is matched successfully is used as a target test case template corresponding to the directed graph link.
In one embodiment, the apparatus further comprises:
and the second target test case determining module is used for generating a current keyword vector corresponding to the directed graph link in the directed graph link set, inputting the current keyword vector into a trained test case prediction model, and obtaining the target test case corresponding to the directed graph link output by the test case prediction model.
A computer device comprising a memory storing a computer program and a processor which when executing the computer program performs the steps of:
acquiring a program to be tested, and acquiring a directed graph corresponding to the program to be tested, wherein the directed graph takes each function in the program to be tested as a node, and generates directed connection among the nodes according to the successive calling relation of each function;
acquiring node information of each node in the directed graph from the program to be tested, and marking the corresponding nodes according to the node information;
traversing the directed graph to obtain a directed graph link set corresponding to the directed graph;
determining directed graph link keywords corresponding to directed graph links in the directed graph link set according to node information corresponding to each node, and matching the directed graph links in the directed graph link set with candidate test case templates according to the directed graph link keywords and the test case template keywords to obtain target test case templates corresponding to the directed graph links;
and obtaining the target test case corresponding to the directed graph link according to the target test case template corresponding to the directed graph link.
A computer readable storage medium having stored thereon a computer program which when executed by a processor performs the steps of:
acquiring a program to be tested, and acquiring a directed graph corresponding to the program to be tested, wherein the directed graph takes each function in the program to be tested as a node, and generates directed connection among the nodes according to the successive calling relation of each function;
acquiring node information of each node in the directed graph from the program to be tested, and marking the corresponding nodes according to the node information;
traversing the directed graph to obtain a directed graph link set corresponding to the directed graph;
determining directed graph link keywords corresponding to directed graph links in the directed graph link set according to node information corresponding to each node, and matching the directed graph links in the directed graph link set with candidate test case templates according to the directed graph link keywords and the test case template keywords to obtain target test case templates corresponding to the directed graph links;
and obtaining the target test case corresponding to the directed graph link according to the target test case template corresponding to the directed graph link.
According to the test data processing method, the device, the computer equipment and the storage medium, the program to be tested is obtained, the directed graph corresponding to the program to be tested is obtained, each function in the program to be tested is taken as a node in the directed graph, and directed connection among the nodes is generated according to the calling relation of each function; acquiring node information of each node in the directed graph from a program to be tested, and marking the corresponding each node according to the node information; traversing the directed graph to obtain a directed graph link set corresponding to the directed graph; determining directed graph link keywords corresponding to directed graph links in the directed graph link set according to node information corresponding to each node, and matching the directed graph links in the directed graph link set with candidate test case templates according to the directed graph link keywords and the test case template keywords to obtain target test case templates corresponding to the directed graph links; according to the target test case template corresponding to the directed graph link, the target test case corresponding to the directed graph link is obtained, a series of extraction, translation and the like are implemented on the directed graph, so that optimization and improvement on the black box test are realized, the problems of larger blindness and low coverage rate of the test case in the black box test process are solved, furthermore, the directed graph link is obtained through analysis, the test case template matching is carried out according to the directed graph link keywords, the corresponding target test case is determined for the directed graph link in a self-adaptive manner, automatic writing of the test case based on the directed graph is realized through the template matching, the efficiency of writing the test case is improved, a tester does not need to know program code logic, and a common tester can easily detect faults which cannot be found by the black box test, so that the effect of carrying out the white box test is achieved.
Drawings
FIG. 1 is a diagram of an application environment for a test data processing method in one embodiment;
FIG. 2 is a flow chart of a test data processing method in one embodiment;
FIG. 3 is a schematic diagram of a directed graph in one embodiment;
FIG. 4 is a schematic diagram of a process for determining a target test case by template matching in one embodiment;
FIG. 5 is a schematic diagram of a process for determining a target test case by a model in another embodiment;
FIG. 6 is a block diagram of a test data processing device in one embodiment;
fig. 7 is an internal structural diagram of a computer device in one embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application will be further described in detail with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the present application.
The test data processing method provided by the application can be applied to an application environment shown in figure 1. FIG. 1 is a diagram of an application environment in which a test data processing method operates in one embodiment. As shown in fig. 1, the application environment includes a terminal 110, a server 120. The terminals and the servers communicate through a network, and the communication network may be a wireless or wired communication network, such as an IP network, a cellular mobile communication network, etc., where the number of terminals and servers is not limited.
Among them, the terminal 110 may be, but is not limited to, various personal computers, notebook computers, smart phones, tablet computers, and portable wearable devices. The server may be implemented as a stand-alone server or as a server cluster composed of a plurality of servers. The test data processing method may be implemented on the terminal 110 or the server 120.
In one embodiment, as shown in fig. 2, a test data processing method is provided, and the method is applied to the terminal 110 or the server 120 in fig. 1 for illustration, and includes the following steps:
step 210, acquiring a program to be tested, and acquiring a directed graph corresponding to the program to be tested, wherein the directed graph takes each function in the program to be tested as a node, and generates directed connection between each node according to the successive calling relation of each function.
The program to be tested may be an execution file or a dynamic link library, and the format includes C/C++/C#/Java/Python. The directed graph describes the call and dependency relationships between the various functions. The program to be tested comprises basic machine execution and memory model definition, and the function is taken as a minimum analysis unit, so that the following information can be obtained:
1. function name, parameter list, and return value.
2. A function body, including various entity definitions, and related operations, an entity refers to a collection of something, and the individual of each type of data object is commonly referred to as an entity. Such as the name of the material, the name of the food, the name of the large class of food, etc. in our application, each data object is an entity.
3. Inter-function call logic, such as B- > E, represents B call E, where B, E represents 2 different functions, respectively.
Specifically, with functions as nodes, according to the calling sequence between functions, a directed graph from one function to another function is constructed, as shown in fig. 3, where M1 and M2 respectively represent interfaces of programs, nodes a, B, C, D, E, F, G, H, and I respectively represent different function methods, and connecting lines represent calls from one method to another method. The graph also indicates dependencies, e.g. a depends on D and E, C depends on F. Where different programs may depend on the same method, e.g. both M1 and M2 depend on B.
In one embodiment, the directed graph of the program under test is obtained by a tool, different programming language bytecode analysis tools are different, e.g., jclassib, classpy, ASM, etc., as are common byte analysis tools in JAVA language.
For a Web interface, each external API (Application Programming Interface, application program interface) is relatively independent, and a directed graph with the function as an entry node and the function as a starting point can be built. Since a Web program may contain multiple API interfaces and internal logic has multiple node multiplexing, as in node E of fig. 3, the directed graph may have multiple entries.
Step 220, obtaining node information of each node in the directed graph from the program to be tested, and marking the corresponding nodes according to the node information.
The node information comprises function names, entity definitions in a function body, notes of the functions, manual marking information and the like. The function name can partially explain the function of the function, and for languages like C/C++, the function can be just an address, but the real name of the function can be obtained through a symbol table, and the entity definition can determine entity information such as materials, foods, users and the like which are butted by the method. The annotation of the function can be combined with the source code information to find the annotation corresponding to the function, and the annotation depends on the code of the specification. The manual marking information is mainly manually interpreted and marked for the content with insufficient machine interpretation, and can be determined by the joint participation of testers and developers.
Specifically, traversing each node, acquiring the annotation of each node, accessing the function body, acquiring entity information, and acquiring the annotation of the entity according to the development document. Marking the directed graph, marking the obtained node information to the directed graph, and writing the obtained node information to the node attribute corresponding to the directed graph.
In one embodiment, the directed graph of marked information is displayed in the form of MATLAB or html, the node missing node information is obtained, the manual marking information is received, and the error information of the existing node is corrected.
Step 230, traversing the directed graph to obtain a directed graph link set corresponding to the directed graph; and determining directed graph link keywords corresponding to the directed graph links in the directed graph link set according to node information corresponding to each node, and matching the directed graph links in the directed graph link set with candidate test case templates according to the directed graph link keywords and the test case template keywords to obtain target test case templates corresponding to the directed graph links.
The directed graph link is the minimum reference unit, and in the directed graph, one directed graph can have one or more directed graph links to form a directed graph link set corresponding to the directed graph from an entry method, namely a starting point API method, to a node where call ends.
Specifically, the directed graph links are derived from the directed graph, and by traversing the directed graph and applying a depth-first search algorithm to each entry node, a set of directed graph links corresponding to all of the directed graph links comprising the directed graph can be obtained. And determining the directed graph link keywords corresponding to the directed graph links in the directed graph link set according to the node information corresponding to each node, and extracting the directed graph link keywords from the node information according to a keyword extraction algorithm. If the node information of the first directed graph link includes a stall, the stall may be used as a directed graph link key of the first directed graph link.
The test case template is a method or function with input and output, and the test case set is output by inputting the directed graph link keywords. The specified test case templates are input into a group of character string sets and output into a group of test case sets. The Inputs are also called keyword sets, for example, menu information, and may include discount, name, flavor, quantity, and the like.
The test case templates can be divided into universal templates, industry templates and custom templates according to business requirements. The generic template refers to a program definition template, which generally does not have specific business meaning, such as a plastic number template, a character string template, a binary template, a floating point number template, and the like, and is called a generic template because the data focuses on the type of data and does not concern specific meaning. The industry templates are catalogues with certain industry significance, such as catering industry, financial industry and the like, and testers in different industries can introduce templates in corresponding industries. The industry templates have certain pertinence and corresponding limitation, and in order to more flexibly cope with specific business, custom templates need to be introduced, and the templates are written by specific testers. For example, a simple menu test case template, the input keyword list may be [ foodName, foodType, discount, count ], and when the above keyword appears in the directed graph link, the template is considered to be matched, and the corresponding test case is output. For example, modifying discounts to-1, 9, 1100, etc., automatically generates 3 test cases for discount information, respectively.
The template matching process is the process of matching the directed graph link keywords with the test case template keywords, and if the matching is successful, the target test case template corresponding to the directed graph link is obtained from the candidate test case templates. In one embodiment, the process of template matching may be implemented using the following pseudocode:
step 240, obtaining the target test case corresponding to the directed graph link according to the target test case template corresponding to the directed graph link.
Specifically, the template represents a target test case template, and the corresponding test case is obtained through templates. Finally, the files or the test management end are written through the saveTestCases, so that preparation is made for the execution of the subsequent test cases. And archiving the test case set by using the target test cases corresponding to the directed graph links.
In the embodiment, a program to be tested is obtained, a directed graph corresponding to the program to be tested is obtained, the directed graph takes each function in the program to be tested as a node, and directed connection among the nodes is generated according to the successive calling relation of each function; acquiring node information of each node in the directed graph from a program to be tested, and marking the corresponding each node according to the node information; traversing the directed graph to obtain a directed graph link set corresponding to the directed graph; determining directed graph link keywords corresponding to directed graph links in the directed graph link set according to node information corresponding to each node, and matching the directed graph links in the directed graph link set with candidate test case templates according to the directed graph link keywords and the test case template keywords to obtain target test case templates corresponding to the directed graph links; according to the target test case template corresponding to the directed graph link, the target test case corresponding to the directed graph link is obtained, a series of extraction, translation and the like are implemented on the directed graph, so that optimization and improvement on the black box test are realized, the problems of larger blindness and low coverage rate of the test case in the black box test process are solved, furthermore, the directed graph link is obtained through analysis, the test case template matching is carried out according to the directed graph link keywords, the corresponding target test case is determined for the directed graph link in a self-adaptive manner, automatic writing of the test case based on the directed graph is realized through the template matching, the efficiency of writing the test case is improved, a tester does not need to know program code logic, and a common tester can easily detect faults which cannot be found by the black box test, so that the effect of carrying out the white box test is achieved.
FIG. 4 is a schematic diagram illustrating a process for determining a target test case by template matching in one embodiment.
In one embodiment, the obtaining a directed graph corresponding to the program to be tested in step 210 includes: analyzing the execution process of a program to be tested, and detecting the calling relation among the functions of the program to be tested through program instructions, wherein the program instructions comprise at least one of turning instructions and branch instructions; when a directed call relationship exists between the first function and the second function, determining a directed connector between a first node corresponding to the first function and a second node corresponding to the second function according to the call relationship, and connecting the first node and the second node through the directed connector.
Specifically, the present invention relates to a method for manufacturing a semiconductor device. Jump instructions refer to jump instructions in machine language such as if, jump, continuous, break, switch, etc. in the C language. For example, when jump from A to B in the jump instruction, the call sequence of AB is A- > B, so that the direction of the directional connector is from A to B. A branch instruction is an instruction that alters the program flow, and if a branch is taken, the next instruction to be executed proceeds to the portion of the program that the branch is taken to execute. The calling relation of the two functions can be obtained through the branch instruction, so that the directed connector between the two nodes corresponding to the two functions is determined. And determining the directed connectors among the nodes according to the function call relation to obtain the directed graph.
In this embodiment, the execution process of the program to be tested is analyzed by the machine code/assembly code/byte code, and the directed graph of the program is constructed, which is equivalent to changing the black box of the program into a transparent box, so that the internal implementation process of the program can be known without reading the program code.
In one embodiment, step 230 includes: acquiring node information corresponding to each node in a directed graph link, wherein the node information comprises entity information; extracting a current directed graph link keyword corresponding to the directed graph link from the entity information; and respectively matching the current directed graph link keywords with the test case template keywords corresponding to the candidate test case templates, and taking the candidate test case templates which are successfully matched as target test case templates corresponding to the directed graph links when the matching is successful.
Specifically, the entity information describes an entity, for example, the entity is a material, a food, a user, etc., and the description information of different entities is different, for example, the food entity generally includes a food name, a food type, discount information, quantity information, etc., for example, the user entity generally includes information of gender, age, hobbies, region of the user entity, etc., so that the current directed graph link keywords corresponding to the directed graph links are extracted from the entity information, which can well reflect the specific testing direction of the directed graph links, because different types of information generally need different testing cases for testing. And the target test case template is obtained by matching the current directed graph link keywords with the test case template keywords corresponding to the candidate test case templates respectively.
In this embodiment, the accuracy of determining the target test case template can be improved by extracting the current directed graph link keyword corresponding to the directed graph link from the entity information.
In one embodiment, the method further comprises: generating a current keyword vector corresponding to a directed graph link in the directed graph link set, inputting the current keyword vector into a trained test case prediction model, and obtaining a target test case corresponding to the directed graph link output by the test case prediction model.
Specifically, the current keywords corresponding to the directed graph links in the directed graph link set are obtained first, then each current keyword is formed into a current keyword vector, and the trained test case prediction model can automatically output the matched target test case according to the input, so that the target test case corresponding to the directed graph links can be obtained quickly according to the trained test case prediction model. The target test cases corresponding to the directed graph links output by the test case prediction model can be archived, so that preparation is made for subsequent test case execution. The trained test case prediction model is obtained by training a large number of training samples, and the accuracy of the target test case corresponding to the output directed graph link is high.
In one embodiment, the step of generating the trained test case predictive model includes: acquiring a training directed graph link and a corresponding standard test case, acquiring training key word vectors formed by training directed graph link key words corresponding to the training directed graph link, inputting the training key word vectors into a test case prediction model, and obtaining a prediction test case output by the test case prediction model; and adjusting parameters of the test case prediction model according to the prediction test case and the standard test case corresponding to the training directed graph link until a preset condition is met, and generating a trained test case prediction model.
Specifically, the standard test case may be a target test case corresponding to a directed graph link determined by template matching, or a target test case corresponding to a directed graph link written manually, or a target test case corresponding to a directed graph link output by a test case prediction model with trained history. And taking the directed graph link with the target test case as a training directed graph link, extracting training directed graph link keywords corresponding to the training directed graph link to form training keyword vectors, inputting the training keyword vectors into a test case prediction model to obtain a predicted test case, comparing the predicted test case with a standard test case, calculating the similarity, and if the similarity is lower than a preset threshold, continuing to adjust parameters of the test case prediction model until the predicted test case and the standard test case reach preset conditions, and if the similarity is greater than the preset threshold, generating the trained test case prediction model. In one embodiment, the method further comprises a preprocessing step, wherein the main directed graph links are cleaned, the validity of the directed graph link data set is guaranteed, and the legal directed graph links are used as training directed graph links.
As shown in FIG. 5, in one embodiment, the directed graph links and test cases are used as a training set for machine learning to train a corresponding model, thereby implementing a flowchart that covers more comprehensive test case writing and use of the trained test case prediction model.
It should be understood that, although the steps in the flowchart of fig. 2 are shown in sequence as indicated by the arrows, the steps are not necessarily performed in sequence as indicated by the arrows. The steps are not strictly limited to the order of execution unless explicitly recited herein, and the steps may be executed in other orders. Moreover, at least some of the steps in fig. 2 may include multiple sub-steps or stages that are not necessarily performed at the same time, but may be performed at different times, nor do the order in which the sub-steps or stages are performed necessarily performed in sequence, but may be performed alternately or alternately with at least a portion of the sub-steps or stages of other steps or other steps.
In one embodiment, as shown in FIG. 6, there is provided a test data processing apparatus comprising: the system comprises an acquisition module 310, a node marking module 320, a directed graph link set determining module 330, a template matching module 340 and a first target test case determining module 350, wherein:
the obtaining module 310 is configured to obtain a program to be tested, obtain a directed graph corresponding to the program to be tested, and generate directed connections between the nodes according to the successive call relationships of the functions in the program to be tested by using the functions as nodes.
The node marking module 320 is configured to obtain node information of each node in the directed graph from the program to be tested, and mark information of each corresponding node according to the node information.
The directed graph link set determining module 330 is configured to traverse the directed graph to obtain a directed graph link set corresponding to the directed graph.
The template matching module 340 is configured to determine a directed graph link keyword corresponding to a directed graph link in the directed graph link set according to node information corresponding to each node, and match the directed graph link in the directed graph link set with a candidate test case template according to the directed graph link keyword and the test case template keyword, so as to obtain a target test case template corresponding to the directed graph link.
The first target test case determining module 350 is configured to obtain a target test case corresponding to the directed graph link according to a target test case template corresponding to the directed graph link.
In one embodiment, the template matching module 340 is further configured to obtain node information corresponding to each node in the directed graph link, where the node information includes entity information, extract a current directed graph link keyword corresponding to the directed graph link from the entity information, and match the current directed graph link keyword with a test case template keyword corresponding to each candidate test case template, where when the matching is successful, the candidate test case template that is successfully matched is used as a target test case template corresponding to the directed graph link.
In one embodiment, the apparatus further comprises:
and the second target test case determining module 360 is configured to generate a current keyword vector corresponding to a directed graph link in the directed graph link set, input the current keyword vector into a trained test case prediction model, and obtain a target test case corresponding to the directed graph link output by the test case prediction model.
In one embodiment, the obtaining module 310 is further configured to analyze an execution process of the program to be tested, detect a call relationship between functions of the program to be tested through a program instruction, where the program instruction includes at least one of a transfer instruction and a branch instruction, and determine, when a directed call relationship exists between a first function and a second function, a directed connector between a first node corresponding to the first function and a second node corresponding to the second function according to the call relationship; the first node and the second node are connected by a directed connector.
In one embodiment, the apparatus further comprises:
the training module 370 is configured to obtain a training directed graph link and a corresponding standard test case, obtain a training directed graph link keyword corresponding to the training directed graph link to form a training keyword vector, input the training keyword vector into a test case prediction model to obtain a predicted test case output by the test case prediction model, and adjust parameters of the test case prediction model according to the predicted test case and the standard test case corresponding to the training directed graph link until a preset condition is satisfied, so as to generate a trained test case prediction model.
For specific limitations of the test data processing device, reference may be made to the above limitations of the test data processing method, and no further description is given here. The various modules in the test data processing apparatus described above may be implemented in whole or in part by software, hardware, or a combination thereof. The above modules may be embedded in hardware or may be independent of a processor in the computer device, or may be stored in software in a memory in the computer device, so that the processor may call and execute operations corresponding to the above modules.
In one embodiment, a computer device, which may be a terminal, whose internal structure may be as shown in fig. 7, includes a processor, a memory, a network interface, an input device, and a display screen connected through a system bus. The memory includes a nonvolatile storage medium and an internal memory. The non-volatile storage medium of the computer device stores an operating system and may also store a computer program which, when executed by a processor, causes the processor to perform a test data processing method. The internal memory may also store a computer program which, when executed by the processor, causes the processor to perform the data processing method. The display screen of the computer equipment can be a liquid crystal display screen or an electronic ink display screen, the input device of the computer equipment can be a touch layer covered on the display screen, can also be keys, a track ball or a touch pad arranged on the shell of the computer equipment, and can also be an external keyboard, a touch pad or a mouse and the like.
It will be appreciated by those skilled in the art that the structure shown in fig. 7 is merely a block diagram of some of the structures associated with the present application and is not limiting of the computer device to which the present application may be applied, and that a particular computer device may include more or fewer components than shown, or may combine certain components, or have a different arrangement of components.
In one embodiment, a computer device is provided comprising a memory and a processor, the memory storing a computer program which, when executed by the processor, causes the processor to perform the steps of the test data processing method described above. The steps of the test data processing method herein may be the steps of the test data processing method of the above-described respective embodiments.
In one embodiment, a computer readable storage medium is provided, storing a computer program which, when executed by a processor, causes the processor to perform the steps of the test data processing method described above. The steps of the test data processing method herein may be the steps of the test data processing method of the above-described respective embodiments.
Those skilled in the art will appreciate that implementing all or part of the above described methods may be accomplished by way of a computer program stored on a non-transitory computer readable storage medium, which when executed, may comprise the steps of the embodiments of the methods described above. Any reference to memory, storage, database, or other medium used in the various embodiments provided herein may include non-volatile and/or volatile memory. The nonvolatile memory can include Read Only Memory (ROM), programmable ROM (PROM), electrically Programmable ROM (EPROM), electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double Data Rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous Link DRAM (SLDRAM), memory bus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), among others.
The technical features of the above embodiments may be arbitrarily combined, and all possible combinations of the technical features in the above embodiments are not described for brevity of description, however, as long as there is no contradiction between the combinations of the technical features, they should be considered as the scope of the description.
The above examples merely represent a few embodiments of the present application, which are described in more detail and are not to be construed as limiting the scope of the invention. It should be noted that it would be apparent to those skilled in the art that various modifications and improvements could be made without departing from the spirit of the present application, which would be within the scope of the present application. Accordingly, the scope of protection of the present application is to be determined by the claims appended hereto.

Claims (10)

1. A method of test data processing, the method comprising:
acquiring a program to be tested, and acquiring a directed graph corresponding to the program to be tested, wherein the directed graph takes each function in the program to be tested as a node, and generates directed connection among the nodes according to the successive calling relation of each function;
acquiring node information of each node in the directed graph from the program to be tested, and marking the corresponding nodes according to the node information;
traversing the directed graph to obtain a directed graph link set corresponding to the directed graph; the directed graph link set is a set of links formed from a start node to an end node in each directed graph;
the node information of each node comprises entity information, the current directed graph link keywords corresponding to the directed graph links in the directed graph link set are extracted from the entity information, and the method for determining the target test case by the current directed graph link keywords comprises the following steps:
in a first mode, the keywords of the current directed graph link are respectively matched with the keywords of the test case templates corresponding to the candidate test case templates, and when the matching is successful, the candidate test case templates which are successfully matched are used as target test case templates corresponding to the directed graph link; obtaining a target test case corresponding to the directed graph link according to a target test case template corresponding to the directed graph link;
a second mode is that the current directed link keywords corresponding to the directed graph links in the directed graph link set are formed into current keyword vectors; and inputting the current keyword vector into a trained test case prediction model to obtain a target test case corresponding to the directed graph link output by the test case prediction model.
2. The method of claim 1, wherein the obtaining the directed graph corresponding to the program to be tested comprises:
analyzing the execution process of a program to be tested, and detecting the calling relation among all functions of the program to be tested through program instructions, wherein the program instructions comprise at least one of turning instructions and branch instructions;
when a directed calling relationship exists between a first function and a second function, determining a directed connector between a first node corresponding to the first function and a second node corresponding to the second function according to the calling relationship;
and connecting the first node and the second node through the directed connector.
3. The method of claim 1, wherein the program to be tested is an execution file or a dynamic link library.
4. The method of claim 1, wherein the test case template is a method or function with inputs and outputs.
5. The method of claim 1, wherein the step of generating the trained test case predictive model comprises:
acquiring a training directed graph link and a corresponding standard test case;
acquiring training directed graph link keywords corresponding to the training directed graph links to form training keyword vectors;
inputting the training keyword vector into a test case prediction model to obtain a predicted test case output by the test case prediction model;
and adjusting parameters of the test case prediction model according to the prediction test case and the standard test case corresponding to the training directed graph link until a preset condition is met, and generating the trained test case prediction model.
6. A test data processing apparatus, the apparatus comprising:
the system comprises an acquisition module, a processing module and a processing module, wherein the acquisition module is used for acquiring a program to be tested, acquiring a directed graph corresponding to the program to be tested, and generating directed connection among all nodes according to the calling relationship of all functions by taking all functions in the program to be tested as nodes;
the node marking module is used for acquiring node information of each node in the directed graph from the program to be tested and marking information of each corresponding node according to the node information;
the directed graph link set determining module is used for traversing the directed graph to obtain a directed graph link set corresponding to the directed graph; the directed graph link set is a set of links formed from a start node to an end node in each directed graph;
the template matching module is used for extracting current directed graph link keywords corresponding to directed graph links in the directed graph link set from entity information, respectively matching the current directed graph link keywords with test case template keywords corresponding to candidate test case templates, and taking the candidate test case templates successfully matched as target test case templates corresponding to the directed graph links when the matching is successful;
the first target test case determining module is used for obtaining the target test case corresponding to the directed graph link according to the target test case template corresponding to the directed graph link;
the second target test case determining module is used for forming a current directed link keyword corresponding to a directed graph link in the directed graph link set into a current keyword vector; and inputting the current keyword vector into a trained test case prediction model to obtain a target test case corresponding to the directed graph link output by the test case prediction model.
7. The apparatus of claim 6, wherein the acquisition module is further configured to analyze an execution process of a program to be tested, and detect a call relationship between functions of the program to be tested by a program instruction, the program instruction including at least one of a branch instruction and a branch instruction; when a directed calling relationship exists between a first function and a second function, determining a directed connector between a first node corresponding to the first function and a second node corresponding to the second function according to the calling relationship; and connecting the first node and the second node through the directed connector.
8. The apparatus of claim 6, wherein the apparatus further comprises:
the second target test case determining module is also used for acquiring a training directed graph link and a corresponding standard test case; acquiring training directed graph link keywords corresponding to the training directed graph links to form training keyword vectors; inputting the training keyword vector into a test case prediction model to obtain a predicted test case output by the test case prediction model; and adjusting parameters of the test case prediction model according to the prediction test case and the standard test case corresponding to the training directed graph link until a preset condition is met, and generating the trained test case prediction model.
9. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor implements the steps of the method of any one of claims 1 to 5 when the computer program is executed.
10. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the steps of the method according to any one of claims 1 to 5.
CN201911338952.3A 2019-12-23 2019-12-23 Test data processing method, device, computer equipment and storage medium Active CN110955608B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911338952.3A CN110955608B (en) 2019-12-23 2019-12-23 Test data processing method, device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911338952.3A CN110955608B (en) 2019-12-23 2019-12-23 Test data processing method, device, computer equipment and storage medium

Publications (2)

Publication Number Publication Date
CN110955608A CN110955608A (en) 2020-04-03
CN110955608B true CN110955608B (en) 2024-03-08

Family

ID=69983437

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911338952.3A Active CN110955608B (en) 2019-12-23 2019-12-23 Test data processing method, device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN110955608B (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112363924B (en) * 2020-11-10 2023-09-29 中国平安人寿保险股份有限公司 Text coverage rate testing method based on directed graph and related equipment
CN112597002A (en) * 2020-12-08 2021-04-02 北京中电华大电子设计有限责任公司 Python script based test vector generation method
CN112597055A (en) * 2020-12-30 2021-04-02 深圳Tcl新技术有限公司 Test case generation method, device, equipment and computer readable storage medium
CN115994244B (en) * 2021-10-18 2024-03-19 广州南天电脑系统有限公司 Directed graph data processing method and device based on big data and computer equipment
CN115757123B (en) * 2022-11-16 2023-09-22 大商所飞泰测试技术有限公司 Test case generation method, device, equipment and medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101908020A (en) * 2010-08-27 2010-12-08 南京大学 Method for prioritizing test cases based on classified excavation and version change
CN107273297A (en) * 2017-06-28 2017-10-20 百度在线网络技术(北京)有限公司 Method and apparatus for generating test case
CN107301129A (en) * 2017-06-28 2017-10-27 百度在线网络技术(北京)有限公司 Method and apparatus for generating test case
CN110162468A (en) * 2019-04-26 2019-08-23 腾讯科技(深圳)有限公司 A kind of test method, device and computer readable storage medium
CN110471858A (en) * 2019-08-22 2019-11-19 腾讯科技(深圳)有限公司 Applied program testing method, device and storage medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101908020A (en) * 2010-08-27 2010-12-08 南京大学 Method for prioritizing test cases based on classified excavation and version change
CN107273297A (en) * 2017-06-28 2017-10-20 百度在线网络技术(北京)有限公司 Method and apparatus for generating test case
CN107301129A (en) * 2017-06-28 2017-10-27 百度在线网络技术(北京)有限公司 Method and apparatus for generating test case
CN110162468A (en) * 2019-04-26 2019-08-23 腾讯科技(深圳)有限公司 A kind of test method, device and computer readable storage medium
CN110471858A (en) * 2019-08-22 2019-11-19 腾讯科技(深圳)有限公司 Applied program testing method, device and storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
郑锦勤 等.基于函数调用路径的回归测试用例选择排序方法研究.计算机应用研究.2017,第33卷(第7期),第2063-2066页. *

Also Published As

Publication number Publication date
CN110955608A (en) 2020-04-03

Similar Documents

Publication Publication Date Title
CN110955608B (en) Test data processing method, device, computer equipment and storage medium
CN111666401B (en) Document recommendation method, device, computer equipment and medium based on graph structure
CN108427707B (en) Man-machine question and answer method, device, computer equipment and storage medium
CN111176996A (en) Test case generation method and device, computer equipment and storage medium
CN108804159B (en) Javascript module loading method and preprocessing method and device thereof, and computer equipment
CN109783604B (en) Information extraction method and device based on small amount of samples and computer equipment
CN110688307B (en) JavaScript code detection method, device, equipment and storage medium
CN111507086A (en) Automatic discovery of translation text location in localized applications
CN113536735B (en) Text marking method, system and storage medium based on keywords
CN112417338B (en) Page adaptation method, system and equipment
CN113961768B (en) Sensitive word detection method and device, computer equipment and storage medium
CN117725182A (en) Data retrieval method, device, equipment and storage medium based on large language model
CN117033249A (en) Test case generation method and device, computer equipment and storage medium
CN108399125A (en) Automated testing method, device, computer equipment and storage medium
CN113505078B (en) Configuration file updating method, device, equipment and storage medium
CN117095422B (en) Document information analysis method, device, computer equipment and storage medium
CN111859862A (en) Text data labeling method and device, storage medium and electronic device
CN111754352A (en) Method, device, equipment and storage medium for judging correctness of viewpoint statement
JP6568968B2 (en) Document review device and program
CN111191235A (en) Suspicious file analysis method and device and computer readable storage medium
CN111142871A (en) Front-end page development system, method, equipment and medium
CN114579834B (en) Webpage login entity identification method and device, electronic equipment and storage medium
CN110659316B (en) Data processing method, device, computer equipment and storage medium
CN113010550B (en) Batch object generation and batch processing method and device for structured data
CN116860747A (en) Training sample generation method and device, electronic equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
TG01 Patent term adjustment
TG01 Patent term adjustment