Test case generation method, generation device, computer equipment and storage medium
Through log-based feature and coverage classification deduplication technology, test cases are generated, which solves the problem of high cost of automation use cases construction in the existing technology, and achieves efficient and accurate test cases generation and maintenance.
Patent Information
- Application Number
- CN202010065394.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-01-20
- Publication Date
- 2024-12-13
- Estimated Expiration
- 2040-12-13
AI Technical Summary
In the prior art, automation use case construction relies on manual experience, resulting in high costs and high cost of using case maintenance, making it impossible to efficiently generate accurate test cases.
By obtaining the logs generated during the execution of the business request, two classification deduplication based on features and coverage are adopted, clustering models and coverage similarity calculations are used to generate non-repetitive test cases, reducing manual intervention and maintenance costs.
It realizes test case generation without manual use cases, reduces late maintenance costs, improves testing efficiency, and ensures test integrity.
Smart Images

Figure CN111831545B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a test case generation method, a test case generation device, a computer device and a computer-readable storage medium. Background Art
[0002] Automated use case construction has always been a very important means for testers to ensure project quality and improve testing efficiency. In related technologies, automated use cases are generally written and accumulated based on manual experience through code combing. This method has high labor costs, and as the business upgrades, the use case maintenance cost is also relatively high. Summary of the invention
[0003] The present invention aims to solve at least one of the technical problems existing in the prior art or related art.
[0004] To this end, one aspect of the present invention is to propose a test case generation method.
[0005] Another aspect of the present invention is to provide a test case generating device.
[0006] Another aspect of the present invention provides a computer device.
[0007] Yet another aspect of the present invention provides a computer-readable storage medium.
[0008] In view of this, according to one aspect of the present invention, a test case generation method is proposed, including: obtaining multiple logs generated during the execution of a business request; performing feature classification and coverage classification on the multiple logs in turn; and generating test cases based on the logs after feature classification and coverage classification.
[0009] The test case generation method provided by the present invention obtains all logs of business requests from input to output, and classifies and removes duplicates from the logs using a classification model based on the features of the logs. However, the model classification is not necessarily the most accurate, and there are still duplicate business categories in the categories classified by the model. In order to verify and improve the accuracy of the classification, a coverage-based classification of each log is introduced, and finally a test case is generated according to the classified log. The technical solution of the present invention can automatically generate test cases from non-duplicate logs through two classifications based on features and coverage, without the need to manually establish test cases, and the later maintenance cost is low, which can improve the overall test efficiency.
[0010] It should be noted that coverage is a measure of test completeness, which refers to the ratio of executed code to all code.
[0011] The test case generation method according to the present invention may also have the following technical features:
[0012] In the above technical solution, the step of feature classification of multiple logs specifically includes: parsing multiple logs to obtain features of each log; filtering the features; and classifying the logs using a clustering model based on the features remaining after filtering.
[0013] In this technical solution, multiple logs are analyzed parameterized to obtain the characteristics of each log, and the characteristics that are not useful for classification (such as log ID) are filtered out. The clustering model is used to classify the logs according to the remaining characteristics. For example, the logs can be classified according to whether a certain characteristic is the same. The model classification efficiency is high, and hundreds of thousands of logs can be classified in minutes. The model classification provides a basis for subsequent coverage classification.
[0014] In any of the above technical solutions, the step of classifying multiple logs by coverage specifically includes: obtaining any log from multiple log classes obtained by feature classification; running any log to obtain the coverage of any log; calculating the similarity of the coverage; and classifying multiple log classes according to the similarity.
[0015] In this technical solution, after the logs are classified by using a clustering model, multiple log classes are obtained, and any log is obtained in each day class. For example, when there are 10 log classes, 10 logs are obtained. The obtained logs are run to obtain the coverage file of each log, and the coverage file is globally indexed and arranged to become a quantifiable set representing the coverage (the quantifiable set is used as the coverage of the log). Further, the similarity of the coverage between the multiple logs is calculated. If the coverage similarity of the two logs is less than or equal to the preset similarity threshold, the day class where the two logs are located is merged into one class. If the coverage similarity of the two logs is greater than the preset similarity threshold, the day class where the two logs are located is retained. The present invention superimposes coverage classification on the basis of model classification, thereby achieving more accurate log classification while ensuring classification efficiency.
[0016] In any of the above technical solutions, it also includes: recording the coverage of the log before feature classification and coverage classification as the first coverage, and recording the coverage of the log after feature classification and coverage classification as the second coverage; calculating the difference between the second coverage and the first coverage, and the ratio of the difference to the second coverage; adjusting the parameters of the clustering model until the ratio is less than a preset ratio threshold.
[0017] In this technical solution, the coverage loss rate of the log is made lower than a certain threshold (for example, 2%) by adjusting the parameters of the clustering model, and the coverage loss rate = (second coverage - first coverage) / second coverage, thereby ensuring the test integrity of the test cases generated according to the classified logs.
[0018] According to another aspect of the present invention, a test case generation device is proposed, including: an acquisition module for acquiring multiple logs generated during the execution of a business request; a processing module for performing feature classification and coverage classification on the multiple logs in turn; and a generation module for generating test cases based on the logs after feature classification and coverage classification.
[0019] The test case generation device provided by the present invention obtains all logs of business requests from input to output, and classifies and removes duplicates from the logs using a classification model based on the features of the logs. However, the model classification is not necessarily the most accurate, and there are still duplicate business categories in the categories classified by the model. In order to verify and improve the accuracy of the classification, a coverage-based classification of each log is introduced, and finally a test case is generated based on the classified log. The technical solution of the present invention can automatically generate test cases from non-duplicate logs through two classifications based on features and coverage, without the need to manually establish test cases, and the later maintenance cost is low, which can improve the overall test efficiency.
[0020] It should be noted that coverage is a measure of test completeness, which refers to the ratio of executed code to all code.
[0021] The test case generation device according to the present invention may also have the following technical features:
[0022] In the above technical solution, the processing module is specifically used to: parse multiple logs to obtain the features of each log; filter the features; and classify the logs using a clustering model based on the features remaining after filtering.
[0023] In this technical solution, multiple logs are analyzed parameterized to obtain the characteristics of each log, and the characteristics that are not useful for classification (such as log ID) are filtered out. The clustering model is used to classify the logs according to the remaining characteristics. For example, the logs can be classified according to whether a certain characteristic is the same. The model classification efficiency is high, and hundreds of thousands of logs can be classified in minutes. The model classification provides a basis for subsequent coverage classification.
[0024] In any of the above technical solutions, the processing module is specifically used to: obtain any log from multiple log classes obtained by feature classification; run any log to obtain the coverage of any log; calculate the similarity of the coverage; and classify multiple log classes according to the similarity.
[0025] In this technical solution, after the logs are classified by using a clustering model, multiple log classes are obtained, and any log is obtained in each day class. For example, when there are 10 log classes, 10 logs are obtained. The obtained logs are run to obtain the coverage file of each log, and the coverage file is globally indexed and arranged to become a quantifiable set representing the coverage (the quantifiable set is used as the coverage of the log). Further, the similarity of the coverage between the multiple logs is calculated. If the coverage similarity of the two logs is less than or equal to the preset similarity threshold, the day class where the two logs are located is merged into one class. If the coverage similarity of the two logs is greater than the preset similarity threshold, the day class where the two logs are located is retained. The present invention superimposes coverage classification on the basis of model classification, thereby achieving more accurate log classification while ensuring classification efficiency.
[0026] In any of the above technical solutions, the processing module is also used to: record the coverage of the log before feature classification and coverage classification as the first coverage, and record the coverage of the log after feature classification and coverage classification as the second coverage; calculate the difference between the second coverage and the first coverage, and the ratio of the difference to the second coverage; adjust the parameters of the clustering model until the ratio is less than a preset ratio threshold.
[0027] In this technical solution, the coverage loss rate of the log is made lower than a certain threshold (for example, 2%) by adjusting the parameters of the clustering model, and the coverage loss rate = (second coverage - first coverage) / second coverage, thereby ensuring the test integrity of the test cases generated according to the classified logs.
[0028] According to another aspect of the present invention, a computer device is proposed, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements a test case generation method according to any of the above technical solutions when executing the computer program.
[0029] The computer device provided by the present invention implements the steps of the test case generation method of any of the above technical solutions when the processor executes the computer program, so the computer device includes all the beneficial effects of the test case generation method of any of the above technical solutions.
[0030] According to another aspect of the present invention, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the test case generation method of any of the above technical solutions is implemented.
[0031] The computer-readable storage medium provided by the present invention implements the steps of the test case generation method of any of the above-mentioned technical solutions when the computer program is executed by the processor. Therefore, the computer-readable storage medium includes all the beneficial effects of the test case generation method of any of the above-mentioned technical solutions.
[0032] Additional aspects and advantages of the present invention will become apparent from the following description or may be learned by practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] The above and / or additional aspects and advantages of the present invention will become apparent and easily understood from the description of the embodiments in conjunction with the following drawings, in which:
[0034] Figure 1 A schematic diagram showing a flow chart of a test case generation method according to a first embodiment of the present invention;
[0035] Figure 2 A schematic diagram showing a flow chart of a test case generation method according to a second embodiment of the present invention;
[0036] Figure 3 A schematic diagram showing a flow chart of a test case generation method according to a third embodiment of the present invention;
[0037] Figure 4 A schematic diagram showing a flow chart of a method for automatically generating test cases based on online logs according to an embodiment of the present invention;
[0038] Figure 5 A schematic diagram of the process of calculating coverage similarity according to an embodiment of the present invention is shown;
[0039] Figure 6 A schematic block diagram of a test case generating device according to an embodiment of the present invention is shown. DETAILED DESCRIPTION
[0040] In order to more clearly understand the above-mentioned purpose, features and advantages of the present invention, the present invention is further described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be noted that the embodiments of the present invention and the features in the embodiments can be combined with each other without conflict.
[0041] In the following description, many specific details are set forth to facilitate a full understanding of the present invention. However, the present invention may also be implemented in other ways different from those described herein. Therefore, the protection scope of the present invention is not limited to the specific embodiments disclosed below.
[0042] The embodiment of the first aspect of the present invention provides a test case generation method, and the test case generation method is described in detail through the following embodiments.
[0043] Embodiment 1, Figure 1 The flowchart of the test case generation method of the first embodiment of the present invention is shown. The method includes:
[0044] Step 102, obtaining multiple logs generated during the execution of the business request;
[0045] Step 104, performing feature classification and coverage classification on the multiple logs in sequence;
[0046] Step 106: Generate test cases based on the logs classified by feature and coverage.
[0047] The test case generation method provided by the present invention obtains all logs of business requests from input to output, and classifies and removes duplicates from the logs using a classification model based on the features of the logs. However, the model classification is not necessarily the most accurate, and there are still duplicate business categories in the categories classified by the model. In order to verify and improve the accuracy of the classification, a coverage-based classification of each log is introduced, and finally a test case is generated based on the classified log. The embodiment of the present invention, through two classifications based on features and coverage, can eventually automatically generate test cases from non-duplicate logs, without the need to manually establish test cases, and the later maintenance cost is low, which can improve the overall test efficiency.
[0048] It should be noted that coverage is a measure of test completeness, which refers to the ratio of executed code to all code.
[0049] Embodiment 2: Figure 2 A flow chart of a test case generation method according to a second embodiment of the present invention is shown. The method comprises:
[0050] Step 202, obtaining multiple logs generated during the execution of the business request;
[0051] Step 204, parsing multiple logs to obtain features of each log; filtering the features; and classifying the logs using a clustering model based on the features remaining after filtering;
[0052] Step 206, respectively obtaining any log from the multiple log classes obtained by feature classification; running any log to obtain the coverage of any log; performing similarity calculation on the coverage; and classifying the multiple log classes according to the similarity;
[0053] Step 208: Generate test cases based on the logs classified by feature and coverage.
[0054] In this embodiment, multiple logs are analyzed parameterized to obtain the features of each log, and features that are not useful for classification (such as log ID) are filtered out. The logs are classified according to the remaining features using a clustering model, for example, logs can be classified according to whether a certain feature is the same. The model classification efficiency is high, and hundreds of thousands of logs can be classified in minutes. Model classification provides a basis for subsequent coverage classification.
[0055] In this embodiment, a clustering model is used to classify logs to obtain multiple log classes, and any log is obtained in each day class. For example, when there are 10 log classes, 10 logs are obtained. The obtained logs are run to obtain the coverage file of each log, and the coverage file is globally indexed and arranged to become a quantifiable set representing the coverage (the quantifiable set is used as the coverage of the log). Further, the similarity of the coverage between multiple logs is calculated. If the coverage similarity of two logs is less than or equal to a preset similarity threshold, the day class where the two logs are located is merged into one class. If the coverage similarity of the two logs is greater than the preset similarity threshold, the day class where the two logs are located is retained. The present invention superimposes coverage classification on the basis of model classification, thereby achieving more accurate log classification while ensuring classification efficiency.
[0056] Embodiment 3, Figure 3 A flow chart of a test case generation method according to a third embodiment of the present invention is shown. The method comprises:
[0057] Step 302, obtaining multiple logs generated during the execution of the business request;
[0058] Step 304, parsing multiple logs to obtain features of each log; filtering the features; and classifying the logs using a clustering model based on the features remaining after filtering;
[0059] Step 306, respectively obtaining any log from the multiple log classes obtained by feature classification; running any log to obtain the coverage of any log; performing similarity calculation on the coverage; and classifying the multiple log classes according to the similarity;
[0060] Step 308, record the coverage of the log before feature classification and coverage classification as the first coverage, and record the coverage of the log after feature classification and coverage classification as the second coverage; calculate the difference between the second coverage and the first coverage, and the ratio of the difference to the second coverage;
[0061] Step 310, determining whether the ratio is less than a preset ratio threshold, if yes, proceed to step 314, otherwise proceed to step 312;
[0062] Step 312, adjusting the parameters of the clustering model, and then returning to step 304;
[0063] Step 314: Generate test cases based on the logs classified by feature classification and coverage classification.
[0064] In this embodiment, the coverage loss rate of the log is made lower than a certain threshold (for example, 2%) by adjusting the parameters of the clustering model, and the coverage loss rate = (second coverage - first coverage) / second coverage, thereby ensuring the test integrity of the test cases generated based on the classified logs.
[0065] Embodiment 4: The embodiment of the present invention proposes a method for automatically generating test cases based on online logs. Based on the logs generated by online traffic, an algorithm model is introduced to classify each traffic and remove duplicates, generating a minimum set of traffic, and finally automatically generating test cases. There is no need to manually establish test cases, and the subsequent maintenance cost is low, which can improve the overall test efficiency. At the same time, it can quickly complete a more comprehensive regression in the context of fast business iteration. This method is as follows Figure 4 As shown, including:
[0066] Perform full-link recording and playback of service online logs, treating all logs as a traffic flow. Service online logs include service input logs, service downstream return logs, service key intermediate logs, and service output logs.
[0067] Parse logs, that is, perform parameterized parsing on logs.
[0068] Get the signature file.
[0069] Remove noise and useless features.
[0070] Feature normalization processing.
[0071] Cluster analysis is performed using a clustering model. Since the accuracy of clustering model classification is not necessarily 100%, there are still categories in the categories divided by the model that are duplicated for the business. In order to verify and improve the accuracy of classification, consider whether there is an identifier that can accurately represent the direction of a traffic code. It is thought that different traffic must have different coverage, so coverage classification deduplication is introduced.
[0072] After clustering, a piece of traffic data is selected from each class.
[0073] Traffic replay: After replaying each traffic after model classification, a coverage file corresponding to this traffic will be generated.
[0074] Get the code coverage, and arrange the coverage files by global index to become a set of several numbers A representing the coverage, where A is [File Name_Overwrite Line 1 File Name_Overwrite Line 2
[0075] 1_3 1_6
[0076] 2_9 2_187
[0077] 19_197 19_1865]
[0078] After the set A is generated, the jaccard similarity calculation algorithm is introduced, and the similarity calculation of coverage is performed using formula (1) to perform accurate traffic classification.
[0079]
[0080] Among them, X and Y both represent coverage, and jaccard(X,Y) represents the similarity between coverage X and coverage Y.
[0081] It should be noted that the clustering model parameters can be debugged in a continuous cycle until the classified code coverage has almost no coverage loss compared to the full traffic.
[0082] The specific steps for calculating similarity based on the coverage file are as follows Figure 5 As shown, it includes: requesting to generate coverage data; removing useless coverage; converting coverage into a quantifiable set; and performing similarity measurement on coverage data.
[0083] The reason why we need to introduce clustering model instead of using coverage rate to accurately classify traffic is that when using coverage rate for classification, we need to calculate the coverage rate of each traffic and compare it with other traffic for similarity, which takes a long time. It takes 15 seconds to calculate a single traffic. It is definitely not realistic to use this method to classify hundreds of thousands of traffics online. Clustering model classification is very efficient, and hundreds of thousands of traffics can be classified in minutes, but its accuracy is not 100%. Therefore, coverage rate classification is superimposed on clustering model classification to achieve more accurate traffic classification while ensuring high efficiency.
[0084] Through the embodiment of the present invention, all the track logs from input to output of a single business request are regarded as a flow. After parameterizing and normalizing the flow, the clustering model dbscan is used to classify and remove duplicates of the flow. On the basis of clustering model classification, in order to achieve more accurate classification, a coverage file will be generated after each flow is replayed, and the coverage file generated by each flow is classified and removed using the jaccard similarity algorithm. On the basis of clustering model classification, coverage similarity classification and deduplication are superimposed, and finally, non-repetitive flow can be automatically generated as test cases, and machine learning algorithms are innovatively applied to the test field without the need to manually construct use cases.
[0085] The second embodiment of the present invention provides a test case generation device. Figure 6 A schematic block diagram of a test case generation device 600 according to an embodiment of the present invention is shown. The test case generation device 600 comprises:
[0086] An acquisition module 602 is used to acquire multiple logs generated during the execution of a business request;
[0087] A processing module 604 is used to perform feature classification and coverage classification on the multiple logs in sequence;
[0088] The generating module 606 is used to generate test cases according to the logs classified by feature classification and coverage classification.
[0089] The test case generation device provided by the present invention obtains all logs of business requests from input to output, and classifies and removes duplicates from the logs using a classification model based on the features of the logs. However, the model classification is not necessarily the most accurate, and there are still duplicate business categories in the categories classified by the model. In order to verify and improve the accuracy of the classification, a coverage-based classification of each log is introduced, and finally a test case is generated based on the classified log. The embodiment of the present invention, through two classifications and deduplications based on features and coverage, can eventually automatically generate test cases from non-repetitive logs, without the need to manually establish test cases, and the subsequent maintenance cost is low, which can improve the overall test efficiency. It should be noted that coverage is a measure of test completeness, which refers to the ratio of executed code to all code.
[0090] In the above embodiment, the processing module 604 is specifically used to: parse multiple logs to obtain the features of each log; filter the features; and classify the logs using a clustering model according to the features remaining after filtering.
[0091] In this embodiment, multiple logs are analyzed parameterized to obtain the features of each log, and features that are not useful for classification (such as log ID) are filtered out. The logs are classified according to the remaining features using a clustering model, for example, logs can be classified according to whether a certain feature is the same. The model classification efficiency is high, and hundreds of thousands of logs can be classified in minutes. Model classification provides a basis for subsequent coverage classification.
[0092] In any of the above embodiments, the processing module 604 is specifically used to: obtain any log from multiple log classes obtained by feature classification; run any log to obtain the coverage of any log; calculate the similarity of the coverage; and classify multiple log classes according to the similarity.
[0093] In this embodiment, a clustering model is used to classify logs to obtain multiple log classes, and any log is obtained in each day class. For example, when there are 10 log classes, 10 logs are obtained. The obtained logs are run to obtain the coverage file of each log, and the coverage file is globally indexed and arranged to become a quantifiable set representing the coverage (the quantifiable set is used as the coverage of the log). Further, the similarity of the coverage between multiple logs is calculated. If the coverage similarity of two logs is less than or equal to a preset similarity threshold, the day class where the two logs are located is merged into one class. If the coverage similarity of the two logs is greater than the preset similarity threshold, the day class where the two logs are located is retained. The present invention superimposes coverage classification on the basis of model classification, thereby achieving more accurate log classification while ensuring classification efficiency.
[0094] In any of the above embodiments, the processing module 604 is also used to: record the coverage of the log before feature classification and coverage classification as the first coverage, and record the coverage of the log after feature classification and coverage classification as the second coverage; calculate the difference between the second coverage and the first coverage, and the ratio of the difference to the second coverage; adjust the parameters of the clustering model until the ratio is less than a preset ratio threshold. In this embodiment, by adjusting the parameters of the clustering model so that the coverage loss rate of the log is lower than a certain threshold (for example, 2%), the coverage loss rate = (second coverage - first coverage) / second coverage, to ensure the test integrity of the test case generated according to the classified log.
[0095] An embodiment of the third aspect of the present invention proposes a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, a test case generation method as described in any of the above embodiments is implemented.
[0096] The computer device provided by the present invention implements the steps of the test case generation method of any of the above embodiments when the processor executes the computer program, so the computer device includes all the beneficial effects of the test case generation method of any of the above embodiments.
[0097] An embodiment of the fourth aspect of the present invention provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, a test case generation method as described in any of the above embodiments is implemented.
[0098] The computer-readable storage medium provided by the present invention implements the steps of the test case generation method of any of the above embodiments when the computer program is executed by a processor. Therefore, the computer-readable storage medium includes all the beneficial effects of the test case generation method of any of the above embodiments.
[0099] In the description of this specification, the terms "first" and "second" are used for descriptive purposes only and cannot be understood as indicating or implying relative importance unless otherwise clearly specified and limited; the terms "connection", "installation", "fixation" and the like should be understood in a broad sense, for example, "connection" can be a fixed connection, a detachable connection, or an integral connection; it can be directly connected or indirectly connected through an intermediate medium. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
[0100] In the description of this specification, the description of the terms "one embodiment", "some embodiments", "specific embodiments", etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described can be combined in any one or more embodiments or examples in a suitable manner.
[0101] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A test case generation method, characterized in that: include: Get multiple logs generated during the execution of business requests; Performing feature classification and coverage classification on the plurality of logs in sequence; The step of performing feature classification on the plurality of logs specifically includes: parsing the plurality of logs to obtain the features of each log; filtering the features; classifying the logs using a clustering model according to the features remaining after filtering; wherein the features that have no effect on the classification are filtered out; and the coverage rate refers to the ratio of the executed code to all the codes; the step of performing coverage classification on the plurality of logs specifically includes: obtaining any log from the plurality of log classes obtained by feature classification; running any of the logs to obtain the coverage rate of any of the logs; performing similarity calculation on the coverage rate; and classifying the plurality of log classes according to the similarity; The test case is generated according to the log after feature classification and coverage classification.
2. The test case generation method according to claim 1, characterized in that: The multiple logs generated during the execution of the business request are obtained, including: Get all logs of business requests from input to output.
3. The test case generation method according to claim 1, characterized in that: The classifying the plurality of log classes according to the similarity comprises: If the coverage similarity of two logs is less than or equal to the preset similarity threshold, the log classes of the two logs are merged into one class; If the coverage similarity of two logs is greater than the preset similarity threshold, the log classes to which the two logs belong are retained.
4. The test case generation method according to claim 1, characterized in that: Also includes: The coverage rate of the log before feature classification and coverage classification is recorded as the first coverage rate, and the coverage rate of the log after feature classification and coverage classification is recorded as the second coverage rate; Calculating a difference between the second coverage and the first coverage, and a ratio of the difference to the second coverage; The parameters of the clustering model are adjusted until the ratio is less than a preset ratio threshold.
5. A test case generating device, characterized in that: include: The acquisition module is used to obtain multiple logs generated during the execution of business requests; A processing module is used to perform feature classification and coverage classification on the multiple logs in sequence; the processing module is specifically used to: parse the multiple logs to obtain the features of each log; filter the features; classify the logs using a clustering model based on the features remaining after filtering; wherein the features that have no effect on the classification are filtered out; and the coverage refers to the ratio of the executed code to all the codes; the processing module is specifically used to: obtain any log from the multiple log classes obtained by feature classification; run any log to obtain the coverage of any log; perform similarity calculation on the coverage; and classify the multiple log classes based on the similarity; A generation module is used to generate the test case according to the log after feature classification and coverage classification.
6. The test case generating device according to claim 5, characterized in that: The acquisition module is specifically used to obtain all logs of business requests from input to output.
7. The test case generating device according to claim 5, characterized in that: The processing module is specifically used for: If the coverage similarity of two logs is less than or equal to the preset similarity threshold, the log classes of the two logs are merged into one class; If the coverage similarity of two logs is greater than the preset similarity threshold, the log classes to which the two logs belong are retained.
8. The test case generating device according to claim 5, characterized in that: The processing module is further used for: The coverage rate of the log before feature classification and coverage classification is recorded as the first coverage rate, and the coverage rate of the log after feature classification and coverage classification is recorded as the second coverage rate; Calculating a difference between the second coverage and the first coverage, and a ratio of the difference to the second coverage; The parameters of the clustering model are adjusted until the ratio is less than a preset ratio threshold.
9. A computer 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 test case generating method according to any one of claims 1 to 4 is implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the test case generating method according to any one of claims 1 to 4 is implemented.
Citation Information
Patent Citations
Test case processing method and device
CN106874199A
Method, device and system for constructing test case request objects
CN106980573A
Evaluating method of software test completeness
CN107844423A
Test case generation method and device and computer readable storage medium
CN107908549A
Test case generation method and device
CN109614324A
