Test case risk grading method and device based on graph algorithm
The directed graph of test cases is constructed by a graph algorithm based on the graph algorithm and the risk level classification is divided using the graph traversal algorithm, which solves the problem of inaccurate risk level classification in the test case, and improves the accuracy of test priority and the security of system operation.
Patent Information
- Application Number
- CN202311006991.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-10
- Publication Date
- 2025-02-28
AI Technical Summary
In the prior art, the inaccurate classification of risk levels of test cases leads to improper testing priorities and increases the risk of system operation.
The graph algorithm is used to obtain the test case and its transformation function information, and the directed graph of the test case is constructed, and the graph traversal algorithm and preset risk division rules are used to process it to generate the risk level division results of the test case.
It quickly identified and corrected the problem of inaccurate risk levels in test cases, increased the priority handling of high-risk test cases, and reduced the risk of system operation.
Smart Images

Figure CN119537194A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of test case technology, and in particular to a test case risk level classification method and device based on a graph algorithm. Background Art
[0002] When designing cases, testers need to arrange test priorities according to case risk levels. In the actual risk level classification, the risk level classification of test cases is inaccurate because case designers are not clear about the risk level classification rules or do not pay attention to the risk level classification and fail to make judgments. At the same time, due to the lack of inspection tools for test case management and auditing personnel, it is impossible to conduct inspections on all cases, and they can only rely on test case designers to comply with the risk level classification rules. Summary of the invention
[0003] In view of the problems existing in the prior art, the main purpose of the embodiments of the present invention is to provide a test case risk level classification method and device based on a graph algorithm, so as to quickly identify inaccurate test case risk levels and reduce the risk of system operation.
[0004] In order to achieve the above object, an embodiment of the present invention provides a test case risk level classification method based on a graph algorithm, the method comprising:
[0005] Acquire the test case and its corresponding transformation function information, pre-process the test case and its corresponding transformation function information, and obtain the test case information;
[0006] According to the graph algorithm and the preset correspondence between risk levels and directed line segments, the test case information is processed to generate a test case directed graph;
[0007] Using a graph traversal algorithm to traverse the test case directed graph, and marking the risks of the test cases in the test case information according to a preset risk classification rule;
[0008] According to the risk annotation corresponding to the test case, the correctness of the preset risk level corresponding to the test case is judged to obtain the risk level classification result of the test case.
[0009] Optionally, in an embodiment of the present invention, the test case and its corresponding transformation function information are preprocessed to obtain the test case information including:
[0010] The test cases and their corresponding transformation function information are standardized, and the standardized test cases and their corresponding transformation function information are stored in the database in sequence using SQL statements.
[0011] Optionally, in one embodiment of the present invention, the transformation function information includes the name of the transformation function and the number of transformation items.
[0012] Optionally, in an embodiment of the present invention, processing the test case information according to a graph algorithm and a preset correspondence between risk levels and directed line segments to generate a test case directed graph includes:
[0013] The project name, test case name and transformation function name in the test case information are used as vertices, and a directed graph is constructed using a graph algorithm;
[0014] According to the preset correspondence between the risk level and the directed line segment, the form of each directed line segment in the directed graph is determined to obtain the test case directed graph.
[0015] Optionally, in an embodiment of the present invention, the form of each directed line segment includes the line segment color and line segment shape of the directed line segment.
[0016] Optionally, in an embodiment of the present invention, traversing the test case directed graph using a graph traversal algorithm, and marking the risk of the test cases in the test case information according to a preset risk classification rule includes:
[0017] The test case directed graph is traversed by using a graph traversal algorithm to determine the risk level of each directed line segment corresponding to the test case name vertex in the test case directed graph and the number of line segments corresponding to different risk levels;
[0018] According to the risk level of each directed line segment corresponding to the test case name vertex and the number of line segments corresponding to different risk levels, the test cases in the test case information are risk labeled using a preset risk classification rule.
[0019] Optionally, in an embodiment of the present invention, according to the risk annotation corresponding to the test case, the correctness of the preset risk level corresponding to the test case is judged, and the test case risk level classification result is obtained, including:
[0020] Compare the risk annotation corresponding to the test case with the preset risk level to obtain a comparison result;
[0021] If the comparison result is that the levels are inconsistent, it is determined that the preset risk level is wrong, and the corresponding test case risk level classification result is that the test case risk level classification is wrong.
[0022] The embodiment of the present invention further provides a test case risk level classification device based on a graph algorithm, the device comprising:
[0023] A case information module is used to obtain the test case and its corresponding transformation function information, pre-process the test case and its corresponding transformation function information, and obtain the test case information;
[0024] A directed graph module, used to process the test case information according to the graph algorithm and the preset correspondence between the risk level and the directed line segment, and generate a directed graph of the test case;
[0025] A risk labeling module is used to traverse the test case directed graph using a graph traversal algorithm, and to label the test cases in the test case information with risks according to a preset risk classification rule;
[0026] The level classification module is used to judge the correctness of the preset risk level corresponding to the test case according to the risk label corresponding to the test case, and obtain the risk level classification result of the test case.
[0027] Optionally, in one embodiment of the present invention, the case information module is also used to standardize the test cases and their corresponding transformation function information, and use SQL statements to store the standardized test cases and their corresponding transformation function information in the database in sequence.
[0028] Optionally, in one embodiment of the present invention, the transformation function information includes the name of the transformation function and the number of transformation items.
[0029] Optionally, in one embodiment of the present invention, the directed graph module includes:
[0030] A directed graph unit, used to construct a directed graph using a graph algorithm by taking the project name, the test case name and the transformation function name in the test case information as vertices;
[0031] The directed line segment unit is used to determine the form of each directed line segment in the directed graph according to the preset correspondence between the risk level and the directed line segment, so as to obtain the test case directed graph.
[0032] Optionally, in an embodiment of the present invention, the form of each directed line segment includes the line segment color and line segment shape of the directed line segment.
[0033] Optionally, in one embodiment of the present invention, the risk marking module includes:
[0034] A graph traversal unit, used to traverse the test case directed graph using a graph traversal algorithm, to determine the risk level of each directed line segment corresponding to the test case name vertex in the test case directed graph and the number of line segments corresponding to different risk levels;
[0035] The risk labeling unit is used to label the test cases in the test case information according to the risk level of each directed line segment corresponding to the test case name vertex and the number of line segments corresponding to different risk levels, using a preset risk classification rule.
[0036] Optionally, in one embodiment of the present invention, the level classification module includes:
[0037] A level comparison unit, used to compare the risk annotation corresponding to the test case with the preset risk level to obtain a comparison result;
[0038] The level division unit is used to determine that the preset risk level is wrong if the comparison result is that the levels are inconsistent, and the corresponding test case risk level division result is a test case risk level division error.
[0039] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the above method is implemented when the processor executes the program.
[0040] The present invention also provides a computer-readable storage medium, which stores a computer program for executing the above method by a computer.
[0041] The present invention also provides a computer program product, comprising a computer program / instruction, which implements the steps of the above method when the computer program / instruction is executed by a processor.
[0042] The present invention constructs a test case directed graph through the test case information corresponding to different test items, uses the graph traversal algorithm and the risk level classification rule to determine the actual risk level of the test case, compares it with the risk level classified by the tester, and promptly identifies the test cases with inaccurate risk level classification, thereby increasing the priority of high-risk test cases and reducing the risk of system operation being affected by insufficient testing. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0044] Figure 1 This is a flow chart of a test case risk level classification method based on a graph algorithm according to an embodiment of the present invention;
[0045] Figure 2 A flowchart of generating a directed graph of test cases in an embodiment of the present invention;
[0046] Figure 3 A flow chart of risk marking in an embodiment of the present invention;
[0047] Figure 4 A flow chart of obtaining the risk level classification result of a test case in an embodiment of the present invention;
[0048] Figure 5A schematic diagram of the system structure of a test case risk level classification method based on a graph algorithm in a specific embodiment of the present invention;
[0049] Figure 6 A system workflow diagram of a test case risk level classification method based on a graph algorithm in an embodiment of the present invention;
[0050] Figure 7 It is a directed graph of test cases in an embodiment of the present invention;
[0051] Figure 8 This is a schematic diagram of the structure of a test case risk level classification device based on a graph algorithm according to an embodiment of the present invention;
[0052] Fig. 9 Schematic diagram of the structure of a directed graph module in an embodiment of the present invention;
[0053] Fig.10 This is a schematic diagram of the structure of a risk labeling module in an embodiment of the present invention;
[0054] Fig.11 This is a schematic diagram of the structure of a level division module in an embodiment of the present invention;
[0055] Fig.12 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0056] An embodiment of the present invention provides a test case risk level classification method and device based on a graph algorithm, which can be used in the financial field and other fields. It should be noted that the test case risk level classification method and device based on a graph algorithm of the present invention can be used in the financial field, and can also be used in any field other than the financial field. The application field of the test case risk level classification method and device based on a graph algorithm of the present invention is not limited.
[0057] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0058] like Figure 1The flowchart of a test case risk level classification method based on a graph algorithm according to an embodiment of the present invention is shown. The execution subject of the test case risk level classification method based on a graph algorithm provided by the embodiment of the present invention includes but is not limited to a computer. The present invention constructs a directed graph of test cases through the test case information corresponding to different test items, uses a graph traversal algorithm and risk level classification rules to determine the actual risk level of the test case, compares it with the risk level classified by the tester, and promptly identifies test cases with inaccurate risk level classification, thereby increasing the priority of high-risk test cases and reducing the risk of insufficient testing affecting system operation. The method shown in the figure includes:
[0059] Step S1, obtaining a test case and its corresponding transformation function information, preprocessing the test case and its corresponding transformation function information to obtain the test case information.
[0060] Among them, the test cases corresponding to different projects and the transformation function information corresponding to the test cases are obtained from the conventional test management platform. Specifically, the transformation function information includes the name of the transformation function and the number of transformation projects. In addition, the transformation function includes new functions, non-new functions, accounting-related functions and non-accounting-related functions.
[0061] Furthermore, the obtained test cases and their corresponding transformation function information are preprocessed. Specifically, the test cases and their corresponding transformation function information are standardized, that is, formatted, such as converting the test cases and their corresponding transformation function information into a required format, and filtering out unnecessary data or erroneous data. The preprocessed test cases and their corresponding transformation function information are sorted by project name and stored in the database using SQL statements.
[0062] Step S2, processing the test case information according to the graph algorithm and the preset correspondence between the risk level and the directed line segment to generate a test case directed graph.
[0063] Different transformation functions correspond to different risk levels. For example, new functions and accounting functions are high-risk. The specific correspondence between transformation functions and risk levels can be preset according to actual needs. In addition, when using graph algorithms to construct directed graphs, the project name, test case name, and transformation function name in the test case information are used as vertices, and then the vertices are connected by directed line segments according to the corresponding test cases in the project and the functional transformation of the test cases.
[0064] Furthermore, when connecting other vertices with the transformation function name vertex, the risk level corresponding to the directed line segment connecting the vertices is determined according to different transformation functions. Combining the corresponding relationship between the risk level and the directed line segment form, the final test case directed graph is obtained.
[0065] Specifically, if the transformation function corresponding to a certain transformation function name vertex is a new function, since the new function has a high risk level, the risk level corresponding to the directed line segment connecting the test case vertex to the transformation function vertex is high risk.
[0066] In addition, the form of the directed line segment includes the line segment color and the line segment shape. For example, the correspondence between the preset risk level and the form of the directed line segment can be that the high risk level corresponds to the red line segment, the medium risk level corresponds to the blue line segment, or the high risk level corresponds to the solid line, the medium risk level corresponds to the dotted line, and so on.
[0067] Step S3, traversing the test case directed graph using a graph traversal algorithm, and labeling the test cases in the test case information with risks according to a preset risk classification rule.
[0068] Among them, a graph traversal algorithm is used to traverse and search the obtained test case directed graph to determine the segment form and number of directed segments connected to each vertex.
[0069] Specifically, the risk level classification rule may be, for example, that if there are two directed lines connected to a vertex of a test case name, one is blue, corresponding to a medium risk level, and the other is red, corresponding to a high risk level, then the risk level of the vertex of the test case name is high risk. The risk level classification rule may also include that if there are more than one directed line segments connected to a vertex, the corresponding risk level is medium risk, then the risk level corresponding to the vertex is medium risk, and so on.
[0070] Therefore, by using the preset risk level classification rules, the actual risk level corresponding to the test case name vertex in the directed graph can be obtained, and the actual risk level is used as a risk label and annotated on the corresponding test case.
[0071] Step S4, judging the correctness of the preset risk level corresponding to the test case according to the risk label corresponding to the test case, and obtaining the risk level classification result of the test case.
[0072] Among them, the test case can be manually classified into risk levels when the test case modification function is tested by the test personnel. The risk level is the preset risk level. The risk label of each test case is compared with the preset risk level to determine whether the preset risk level is correct. Specifically, if the risk label is consistent with the preset risk level, it means that the preset risk level is correct. If not, it means that the preset risk level is wrong.
[0073] Furthermore, if the preset risk level is wrong, the test case risk level classification result is determined to be a level classification error, and the test case risk level classification result is sent to the corresponding tester terminal to timely remind the risk in the test case and avoid system errors.
[0074] As an embodiment of the present invention, the test cases and their corresponding transformation function information are preprocessed to obtain the test case information, including: standardizing the test cases and their corresponding transformation function information, and using SQL statements to store the standardized test cases and their corresponding transformation function information in a database in sequence.
[0075] Among them, the obtained test cases and their corresponding transformation function information are preprocessed. Specifically, the test cases and their corresponding transformation function information are standardized, that is, formatted, for example, the test cases and their corresponding transformation function information are converted into the required format, and unnecessary data or erroneous data are filtered out. The preprocessed test cases and their corresponding transformation function information are sorted by project name and stored in the database using SQL statements for easy call in subsequent processing.
[0076] As an embodiment of the present invention, the transformation function information includes the name of the transformation function and the number of transformation items.
[0077] Among them, the transformation function information includes the name of the transformation function and the number of transformation projects. In addition, the transformation functions include new functions, non-new functions, accounting-related functions and non-accounting-related functions.
[0078] In this embodiment, if Figure 2 As shown, according to the graph algorithm and the preset correspondence between the risk level and the directed line segment, the test case information is processed to generate a test case directed graph including:
[0079] Step S21, using the project name, test case name and transformation function name in the test case information as vertices, and using a graph algorithm to construct a directed graph;
[0080] Step S22, determining the form of each directed line segment in the directed graph according to the preset correspondence between the risk level and the directed line segment, and obtaining the test case directed graph.
[0081] Among them, when using the graph algorithm to construct a directed graph, the project name, test case name and transformation function name in the test case information are used as vertices, and then the vertices are connected by directed line segments according to the corresponding test cases in the project and the functional transformation of the test cases.
[0082] Furthermore, when connecting other vertices with the transformation function name vertex, the risk level corresponding to the directed line segment connecting the vertices is determined according to different transformation functions. Combining the corresponding relationship between the risk level and the directed line segment form, the final test case directed graph is obtained.
[0083] In this embodiment, the form of each directed line segment includes the line segment color and the line segment shape of the directed line segment.
[0084] Among them, if the transformation function corresponding to a certain transformation function name vertex is a new function, since the new function has a high risk level, the risk level corresponding to the directed line segment connecting the test case vertex to the transformation function vertex is high risk.
[0085] Specifically, the form of the directed line segment includes the line segment color and the line segment shape. For example, the correspondence between the preset risk level and the form of the directed line segment can be that the high risk level corresponds to the red line segment, the medium risk level corresponds to the blue line segment, or the high risk level corresponds to the solid line, the medium risk level corresponds to the dotted line, and so on.
[0086] In this embodiment, if Figure 3 As shown, the test case directed graph is traversed using a graph traversal algorithm, and risk marking of the test cases in the test case information is performed according to a preset risk classification rule, including:
[0087] Step S31, traversing the test case directed graph using a graph traversal algorithm to determine the risk level of each directed line segment corresponding to the test case name vertex in the test case directed graph and the number of line segments corresponding to different risk levels;
[0088] Step S32, according to the risk level of each directed line segment corresponding to the test case name vertex and the number of line segments corresponding to different risk levels, the test cases in the test case information are risk-labeled using a preset risk classification rule.
[0089] Among them, a graph traversal algorithm is used to traverse and search the obtained test case directed graph to determine the segment form and number of directed segments connected to each vertex.
[0090] Specifically, the risk level classification rule may be, for example, that if there are two directed lines connected to a vertex of a test case name, one is blue, corresponding to a medium risk level, and the other is red, corresponding to a high risk level, then the risk level of the vertex of the test case name is high risk. The risk level classification rule may also include that if there are more than one directed line segments connected to a vertex, the corresponding risk level is medium risk, then the risk level corresponding to the vertex is medium risk, and so on.
[0091] Therefore, by using the preset risk level classification rules, the actual risk level corresponding to the test case name vertex in the directed graph can be obtained, and the actual risk level is used as a risk label and annotated on the corresponding test case.
[0092] As an embodiment of the present invention, Figure 4As shown, according to the risk annotation corresponding to the test case, the correctness of the preset risk level corresponding to the test case is judged, and the test case risk level classification results include:
[0093] Step S41, comparing the risk label corresponding to the test case with the preset risk level to obtain a comparison result;
[0094] Step S42: If the comparison result is that the levels are inconsistent, it is determined that the preset risk level is wrong, and the corresponding test case risk level classification result is a test case risk level classification error.
[0095] Among them, the test case can be manually classified into risk levels when the test case modification function is tested by the test personnel. The risk level is the preset risk level. The risk label of each test case is compared with the preset risk level to determine whether the preset risk level is correct. Specifically, if the risk label is consistent with the preset risk level, it means that the preset risk level is correct. If not, it means that the preset risk level is wrong.
[0096] Furthermore, if the preset risk level is wrong, the test case risk level classification result is determined to be a level classification error, and the test case risk level classification result is sent to the corresponding tester terminal to timely remind the risk in the test case and avoid system errors.
[0097] In a specific embodiment of the present invention, Figure 5 The figure shows a schematic diagram of the system structure of the test case risk level classification method based on the graph algorithm. The present invention uses the information of whether the functional transformation of the test case involves accounting, whether a new function is added, and the number of projects involved in the function to timely discover the problem of inaccurate risk level classification of the test case, which helps to reduce the risk of insufficient testing affecting system operation. At the same time, it provides a unified inspection tool for auditors, greatly reducing the cost of manual verification.
[0098] In this embodiment, the risk level of the test case is determined by using the characteristic information of the test case and the transformation function involved, such as whether a new function is added, whether it involves accounts, and the number of other transformation projects involved. A directed graph of all test cases is drawn according to different test projects, and the actual risk level of the test case is determined according to the risk level classification rules corresponding to the transformation function in Table 1 by using the graph traversal algorithm. The risk level is compared with the risk level classified by the test case compiler, and the test case with inaccurate risk level classification is notified to the case designer, case department manager, and security auditor.
[0099] Table 1
[0100]
[0101] In this embodiment, Figure 5 The system shown in the figure includes three parts: data collection module 1, data analysis module 2, and risk disposal module 3. The main function of data collection module 1 is to collect information related to test cases from the test management platform and draw a directed graph. Data analysis module 2 is to determine the actual risk level of the test case and compare whether the risk level classification in the case is accurate. Risk disposal module 3 is responsible for risk disposal of test cases with incomplete designs. The specific description is as follows:
[0102] 1. Data acquisition module
[0103] The data collection module is mainly used to collect information related to test cases from the test management platform and draw a directed graph.
[0104] (1) Data collection unit: Export test cases and related information of corresponding transformation functions according to different projects on the test management platform.
[0105] (2) Data preprocessing unit: responsible for formatting the information related to the test case. The case name, name of the modified function, the person who wrote the case, the risk level, whether a new function is added, whether accounting is involved, and the project name are retained. Process them separately according to the project. After standardization, the data are sorted by project name and stored in the database using SQL statements. The processed test case information is shown in Table 2.
[0106] Table 2
[0107]
[0108] (3) Data mapping unit: Draw a directed graph based on the test case related information. Use Python's networkx library to draw a directed graph of the test case information, such as Figure 7 As shown, the basic logic is as follows:
[0109] a. Test case: The first branch is project, creating a new vertex V project The first branch created from project is testcase, and the new vertex V testcase , from the vertex V project To the top V testcase Draw a blue (color not shown) directed line segment E pt . Draw all the test cases in the project one by one.
[0110] b. Transformation function: From vertex V testcase Draw the transformation function of the test case and point to V function, according to whether it is a new function and whether it involves accounting fields, if it is a new function or involves accounting, use a red line segment (the color is not shown in the figure); if it is neither a new function nor involving accounting, use a blue line segment (the color is not shown in the figure). Draw the transformation functions corresponding to all test cases in turn.
[0111] c. Similarly, draw the test cases and corresponding transformation functions of all test items at the same time.
[0112] 2. Data analysis module
[0113] Data analysis module 2 uses the depth-first search algorithm of graph traversal to determine the actual risk level of the test case. The basic logic is:
[0114] (1) High-risk test cases: Check whether the modified functions corresponding to the test cases are new functions or involve accounting.
[0115] Among them, the inspection logic of the high-risk test case is: from the first vertex V in the graph project Start by visiting vertex V project Then select a V project Adjacent and unvisited vertices V i access, check from V according to Table 3 i Start, pointing to the next vertex V p Directed line segment E ip , if the directed line segment is red (the color is not shown in the figure), the corresponding test case is labeled as "high risk". i If there are multiple directed line segments pointing to the next vertex, you need to check each line segment one by one, and then go to the next step after checking all of them.
[0116] Table 3 High risk level classification rules
[0117]
[0118] (2) Medium-risk test cases: Check that the transformation functions corresponding to the test cases involve multiple transformation projects and are not new functions or functions involving accounting.
[0119] Among them, the inspection logic of the medium-risk test case is: from the first vertex V in the graph project Start by visiting vertex V project Then select a V project Adjacent and unvisited vertices V i access, check from V according to Table 4 i Start, pointing to the next vertex V p Directed line segment E ipIf there are more than or equal to 2 directed lines pointing to the same transformation function, and all directed lines are blue (color is not shown in the figure), the corresponding test case is labeled as "medium risk". i If there are multiple directed line segments pointing to the next vertex, you need to check each line segment one by one, and then go to the next step after checking all of them.
[0120] Table 4 Risk level classification rules
[0121]
[0122]
[0123] (3) Low-risk test cases: Test cases that are not labeled with high-risk and medium-risk labels are marked as low-risk cases.
[0124] (4) Output test cases with incorrect risk level classification: Compare the risk level of the test case with label G to see if it is consistent. For inconsistent test cases, output label T. See Table 5 for examples. In the table, the risk level refers to the preset risk level, and label G is the actual risk level of the test case, i.e., the risk label.
[0125] Table 5
[0126]
[0127] 3. Risk management module
[0128] The risk management module 3 is responsible for handling the inaccurate risk level classification of the test cases output by the data analysis module 2.
[0129] (1) Automatic positioning unit: locates the department, department case manager, and security auditor of the case writer output by the data analysis module 2.
[0130] (2) Event handling unit: The output content of data analysis module 2 is sent by email to the email addresses of case writers, department case managers, and security auditors, prompting them to pay attention and handle the incident in a timely manner.
[0131] In this embodiment, if Figure 6 The following is a schematic diagram of the system processing flow. As shown in the figure, the specific process is described as follows:
[0132] Step 101: Export the test cases and related information of the corresponding transformation functions according to different projects on the test management platform;
[0133] Step 102: pre-process and store the test case related information;
[0134] Step 103: using the data mapping unit in the data acquisition module 1 and the networkx library of Python, a directed graph is drawn according to the test case and the transformation function information;
[0135] Step 104: Data analysis module 2 uses a depth-first search algorithm of graph traversal to output the actual risk level of the test case according to high, medium, and low risk level judgment rules;
[0136] Step 105: Locate the department administrator and security auditor of the test case through the automatic positioning unit in the risk treatment module 3;
[0137] Step 106: Send a violation notification email to relevant personnel through the event handling unit in the risk handling module 3.
[0138] The present invention uses the test case related information to efficiently detect inaccurate risk level classification of the test case. Compared with the existing detection and auditing methods, the present invention has the following effects and advantages:
[0139] 1. Improved the audit efficiency of test cases. In the process of daily test case inspection, you can log in to the test management system to view the test cases and manually judge the test cases with inaccurate risk level classification. The present invention is based on test case information, processing and analysis, and realizes the automatic full inspection of the risk level of the test case, which greatly improves the audit efficiency.
[0140] 2. Improved audit accuracy of test cases. The present invention uses a graph traversal algorithm to check the accuracy of risk level classification according to the judgment rules of high, medium and low risk test cases.
[0141] like Figure 8 FIG. 1 is a schematic diagram of a structure of a test case risk level classification device based on a graph algorithm according to an embodiment of the present invention. The device shown in the figure includes:
[0142] The case information module 10 is used to obtain the test case and its corresponding transformation function information, pre-process the test case and its corresponding transformation function information, and obtain the test case information;
[0143] A directed graph module 20, for processing the test case information according to a graph algorithm and a preset correspondence between risk levels and directed line segments, and generating a directed graph of test cases;
[0144] The risk labeling module 30 is used to traverse the test case directed graph using a graph traversal algorithm, and to label the test cases in the test case information according to a preset risk classification rule;
[0145] The level classification module 40 is used to judge the correctness of the preset risk level corresponding to the test case according to the risk label corresponding to the test case, and obtain the risk level classification result of the test case.
[0146] As an embodiment of the present invention, the case information module 10 is also used to standardize the test cases and their corresponding transformation function information, and store the standardized test cases and their corresponding transformation function information in the database in sequence using SQL statements.
[0147] As an embodiment of the present invention, the transformation function information includes the name of the transformation function and the number of transformation items.
[0148] In this embodiment, if Fig. 9 As shown, the directed graph module 20 includes:
[0149] A directed graph unit 21, used to construct a directed graph using a graph algorithm by taking the project name, the test case name and the transformation function name in the test case information as vertices;
[0150] The directed line segment unit 22 is used to determine the form of each directed line segment in the directed graph according to the preset correspondence between the risk level and the directed line segment, so as to obtain the test case directed graph.
[0151] In this embodiment, the form of each directed line segment includes the line segment color and the line segment shape of the directed line segment.
[0152] In this embodiment, if Fig.10 As shown, the risk marking module 30 includes:
[0153] A graph traversal unit 31 is used to traverse the test case directed graph using a graph traversal algorithm to determine the risk level of each directed line segment corresponding to the test case name vertex in the test case directed graph and the number of line segments corresponding to different risk levels;
[0154] The risk labeling unit 32 is used to label the test cases in the test case information according to the risk level of each directed line segment corresponding to the test case name vertex and the number of line segments corresponding to different risk levels, using a preset risk classification rule.
[0155] As an embodiment of the present invention, Fig.11 As shown, the level classification module 40 includes:
[0156] The level comparison unit 41 is used to compare the risk label corresponding to the test case with the preset risk level to obtain a comparison result;
[0157] The level division unit 42 is used to determine that the preset risk level is wrong if the comparison result is that the levels are inconsistent, and the corresponding test case risk level division result is a test case risk level division error.
[0158] Based on the same application concept as the above-mentioned test case risk level classification method based on graph algorithm, the present invention also provides the above-mentioned test case risk level classification device based on graph algorithm. Since the principle of solving the problem by the test case risk level classification device based on graph algorithm is similar to that of the test case risk level classification method based on graph algorithm, the implementation of the test case risk level classification device based on graph algorithm can refer to the implementation of the test case risk level classification method based on graph algorithm, and the repeated parts will not be repeated.
[0159] The present invention constructs a test case directed graph through the test case information corresponding to different test items, uses the graph traversal algorithm and the risk level classification rule to determine the actual risk level of the test case, compares it with the risk level classified by the tester, and promptly identifies the test cases with inaccurate risk level classification, thereby increasing the priority of high-risk test cases and reducing the risk of system operation being affected by insufficient testing.
[0160] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the above method is implemented when the processor executes the program.
[0161] The present invention also provides a computer program product, comprising a computer program / instruction, which implements the steps of the above method when the computer program / instruction is executed by a processor.
[0162] The present invention also provides a computer-readable storage medium, which stores a computer program for executing the above method by a computer.
[0163] like Fig.12 As shown, the electronic device 600 may further include: a communication module 110, an input unit 120, an audio processor 130, a display 160, and a power supply 170. It is worth noting that the electronic device 600 does not necessarily have to include Fig.12 In addition, the electronic device 600 may also include Fig.12 For components not shown, reference may be made to the prior art.
[0164] like Fig.12 As shown, the central processor 100 is sometimes also referred to as a controller or an operation control, and may include a microprocessor or other processor devices and / or logic devices. The central processor 100 receives inputs and controls the operations of various components of the electronic device 600.
[0165] The memory 140 may be, for example, one or more of a cache, a flash memory, a hard drive, a removable medium, a volatile memory, a non-volatile memory or other suitable devices. The above-mentioned information related to the failure may be stored, and a program for executing the relevant information may also be stored. The CPU 100 may execute the program stored in the memory 140 to implement information storage or processing.
[0166] The input unit 120 provides input to the CPU 100. The input unit 120 is, for example, a key or a touch input device. The power supply 170 is used to provide power to the electronic device 600. The display 160 is used to display display objects such as images and text. The display may be, for example, an LCD display, but is not limited thereto.
[0167] The memory 140 may be a solid-state memory, such as a read-only memory (ROM), a random access memory (RAM), a SIM card, etc. It may also be a memory that saves information even when the power is off, can be selectively erased, and is provided with more data, examples of which are sometimes referred to as EPROMs, etc. The memory 140 may also be some other type of device. The memory 140 includes a buffer memory 141 (sometimes referred to as a buffer). The memory 140 may include an application / function storage unit 142, which is used to store application programs and function programs or processes for executing the operation of the electronic device 600 through the central processor 100.
[0168] The memory 140 may also include a data storage unit 143 for storing data, such as contacts, digital data, pictures, sounds, and / or any other data used by the electronic device. The driver storage unit 144 of the memory 140 may include various drivers for communication functions of the electronic device and / or for executing other functions of the electronic device (such as messaging applications, address book applications, etc.).
[0169] The communication module 110 is a transmitter / receiver 110 that transmits and receives signals via an antenna 111. The communication module (transmitter / receiver) 110 is coupled to the central processor 100 to provide input signals and receive output signals, which may be the same as the case of a conventional mobile communication terminal.
[0170] Based on different communication technologies, multiple communication modules 110 may be provided in the same electronic device, such as a cellular network module, a Bluetooth module and / or a wireless LAN module. The communication module (transmitter / receiver) 110 is also coupled to a speaker 131 and a microphone 132 via an audio processor 130 to provide an audio output via the speaker 131 and receive an audio input from the microphone 132, thereby realizing a common telecommunication function. The audio processor 130 may include any suitable buffer, decoder, amplifier, etc. In addition, the audio processor 130 is also coupled to the central processor 100, so that the sound can be recorded on the local machine through the microphone 132, and the sound stored on the local machine can be played through the speaker 131.
[0171] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0172] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0173] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0174] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0175] The present invention uses specific embodiments to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. At the same time, for those skilled in the art, according to the idea of the present invention, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.
Claims
1. A test case risk level classification method based on graph algorithm, characterized in that: The method comprises: Acquire a test case and its corresponding transformation function information, pre-process the test case and its corresponding transformation function information to obtain test case information; Processing the test case information according to a graph algorithm and a preset correspondence between risk levels and directed line segments to generate a test case directed graph; Using a graph traversal algorithm to traverse the test case directed graph, and according to a preset risk classification rule, labeling the test cases in the test case information with risks; According to the risk annotation corresponding to the test case, the correctness of the preset risk level corresponding to the test case is judged to obtain the risk level classification result of the test case.
2. The method according to claim 1, characterized in that The test case and its corresponding transformation function information are preprocessed to obtain test case information including: The test cases and their corresponding transformation function information are standardized, and the standardized test cases and their corresponding transformation function information are stored in a database in sequence using SQL statements.
3. The method according to claim 1, characterized in that The transformation function information includes the name of the transformation function and the number of transformation items.
4. The method according to claim 3, characterized in that Processing the test case information according to the graph algorithm and the preset correspondence between the risk level and the directed line segment to generate a test case directed graph includes: Using the project name, test case name and transformation function name in the test case information as vertices, and using a graph algorithm to construct a directed graph; According to the preset correspondence between the risk level and the directed line segment, the form of each directed line segment in the directed graph is determined to obtain the test case directed graph.
5. The method according to claim 4, characterized in that The form of each directed line segment includes the line segment color and line segment shape of the directed line segment.
6. The method according to claim 4, characterized in that Traversing the test case directed graph using a graph traversal algorithm, and marking the risk of the test cases in the test case information according to a preset risk classification rule includes: Using a graph traversal algorithm to traverse the test case directed graph, determine the risk level of each directed line segment corresponding to the test case name vertex in the test case directed graph and the number of line segments corresponding to different risk levels; According to the risk level of each directed line segment corresponding to the vertex of the test case name and the number of line segments corresponding to different risk levels, the test cases in the test case information are risk labeled using a preset risk classification rule.
7. The method according to claim 1, characterized in that According to the risk label corresponding to the test case, the correctness of the preset risk level corresponding to the test case is judged, and the test case risk level classification result is obtained, including: Compare the risk label corresponding to the test case with the preset risk level to obtain a comparison result; If the comparison result is that the levels are inconsistent, it is determined that the preset risk level is wrong, and the corresponding test case risk level classification result is a test case risk level classification error.
8. A test case risk level classification device based on graph algorithm, characterized in that: The device comprises: A case information module is used to obtain a test case and its corresponding transformation function information, and pre-process the test case and its corresponding transformation function information to obtain the test case information; A directed graph module, used to process the test case information according to a graph algorithm and a preset correspondence between risk levels and directed line segments to generate a test case directed graph; A risk labeling module, used to traverse the test case directed graph using a graph traversal algorithm, and label the test cases in the test case information with risks according to a preset risk classification rule; The level classification module is used to judge the correctness of the preset risk level corresponding to the test case according to the risk label corresponding to the test case, and obtain the test case risk level classification result.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the method according to any one of claims 1 to 7 is implemented.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program for causing a computer to execute the method according to any one of claims 1 to 7.