Test case merging method and device, electronic equipment and storage medium
Through the automated page jump track matching and operation merging methods, the problem of low deduplication efficiency of test cases in regression automation testing is solved, and efficient automated deduplication is achieved, reducing labor costs and improving testing efficiency.
Patent Information
- Application Number
- CN202310770092.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-27
- Publication Date
- 2024-12-27
AI Technical Summary
In the prior art, the deduplication efficiency of test cases in regression automation tests is low and relies on manual review, resulting in high labor costs and low efficiency.
By obtaining and comparing the page jump tracks of test cases, using the string matching algorithm to find matching test cases, and combining repeated test cases based on page operations to achieve an automated deduplication process.
Save labor costs, improve the overall efficiency of deduplication and regression testing, reduce the execution time of test cases, and avoid manual intervention.
Smart Images

Figure CN119201665A_ABST
Abstract
Description
Technical Field
[0001] Embodiments of the present invention relate to the field of testing technology, and in particular to a test case merging method, device, electronic device and storage medium. Background Art
[0002] Automated testing is a process that converts human-driven testing behavior into machine execution. The test cases in an automated test case set are generally written by different testers in different teams. Regression testing refers to retesting after modifying the old code to confirm that the modification has not introduced new errors or caused errors in other codes. Regression automated testing is a testing method that combines automated testing and regression testing. Regression automated testing can greatly reduce the cost of system testing, maintenance and upgrades. Generally speaking, the number of cases for regression automated testing increases gradually. Therefore, the number of automated test cases in the entire regression testing phase is very large, and these test cases often take several hours to execute. Finding some repeated automated test cases and reducing the number of cases can improve the testing efficiency of regression automated testing.
[0003] In the process of implementing the present invention, the inventors found that currently, the method of mutual review of use cases within the team is generally adopted to determine and discover repeated automated test cases and remove duplicates, that is, a manual method is used to find and remove duplicate test cases. This method has problems such as high labor cost and low deduplication efficiency. Summary of the invention
[0004] The embodiments of the present invention provide a test case merging method, device, electronic device and storage medium, which can save labor costs, improve deduplication efficiency, and improve the test efficiency of regression testing.
[0005] In a first aspect, a test case merging method provided by an embodiment of the present invention includes:
[0006] Get the page jump track generated by executing the current test case, and get the page jump track generated by executing each preset test case;
[0007] Searching for a test case whose page jump track matches the page jump track of the current test case from the preset test cases to obtain a target test case;
[0008] Identify the test operations occurring on each page in the page jump track of the current test case;
[0009] The current test case is merged into the target test case based on the test operations occurring on each page.
[0010] In a second aspect, a test case merging device provided by an embodiment of the present invention includes:
[0011] An acquisition module is used to acquire the page jump track generated by executing the current test case, and acquire the page jump track generated by executing each preset test case;
[0012] A search module, used to search for a test case whose page jump track matches the page jump track of the current test case from the preset test cases, to obtain a target test case;
[0013] An identification module, used to identify the test operations occurring on each page in the page jump track of the current test case;
[0014] A merging module is used to merge the current test case into the target test case based on the test operations occurring on each page.
[0015] In a third aspect, an electronic device provided by an embodiment of the present invention comprises a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the test case merging method as described in any embodiment of the present invention is implemented.
[0016] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, on which a computer program is stored, and when the program is executed by a processor, the test case merging method as described in any embodiment of the present invention is implemented.
[0017] The scheme of the embodiment of the present invention can obtain the page jump track generated by executing the current test case, and obtain the page jump track generated by executing each preset test case respectively; search for the test case whose page jump track matches the page jump track of the current test case from each preset test case, and obtain the target test case; identify the test operations occurring on each page in the page jump track of the current test case; merge the current test case into the target test case based on the test operations occurring on each page. That is, the present invention can compare the page jump track of the test case to find repeated test cases (i.e. check for duplicates), merge the repeated test cases based on the test operations on the page (i.e. remove duplicates), and the entire check for duplicates and remove duplicates process is automatically executed, without the need for manual operation or manual intervention, saving labor costs, improving the efficiency of removing duplicates, and improving the test efficiency of regression testing. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] In order to more clearly illustrate the technical solution of the present invention, the drawings required for use in the embodiments are briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present invention and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0019] Figure 1 It is a flowchart of a test case merging method provided by an embodiment of the present invention;
[0020] Figure 2 is another flowchart of the test case merging method provided by an embodiment of the present invention;
[0021] Figure 3a , Figure 3b , Figure 3c , Figure 3d and Figure 3e It is an example diagram of page jump tracks of some test cases provided by the embodiments of the present invention;
[0022] Figure 3f is an example diagram of test case merging provided by an embodiment of the present invention;
[0023] Figure 4 is a structural diagram of a test framework provided by an embodiment of the present invention;
[0024] Figure 5 It is a structural schematic diagram of a test case merging device provided by an embodiment of the present invention;
[0025] Figure 6 It is a structural schematic diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0026] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings 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 should fall within the scope of protection of the present invention.
[0027] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0028] Figure 1 This is a flow chart of a test case merging method provided by an embodiment of the present invention. The method can be applied in a scenario of performing regression automation testing on a system or application. The method can be executed by a test case merging device provided by an embodiment of the present invention. The device can be implemented in software and / or hardware. In a specific embodiment, the device can be implemented by a computer, a server, etc.
[0029] refer to Figure 1 The test case merging method of this embodiment may specifically include the following steps:
[0030] Step 101, obtaining a page jump track generated by executing the current test case, and obtaining a page jump track generated by executing each preset test case.
[0031] The current test case may come from a target automated test case set, which may include a large number of test cases that can be used to perform regression automated testing on a system or application. These test cases may be written by different testers. The current test case may be any test case in the target automated test case set, and the preset test case may be other test cases in the target automated test case set except the current test case. There may be multiple preset test cases.
[0032] In actual applications, the execution process of the current test case and each preset test case can be monitored to obtain monitoring data, and the page jump track of the current test case and the page jump track of each preset test case can be obtained by analyzing the monitoring data. The page jump track may include the identification information of the page jumped during the execution of the corresponding test case and the page jump order between each page. For example, if the current test case is used to test the payment function of an application, when the test case is executed for the application, the application may generate the following page jump track: details page-purchase selection page-checkout page-payment page.
[0033] Step 102 , searching for a test case whose page jump track matches the page jump track of the current test case from various preset test cases, and obtaining a target test case.
[0034] For example, the page jump track matching the current test case may be a page jump track that completely includes the page jump track of the current test case, or a page jump track that includes the complete page jump track of the current test case. Generally speaking, the page jump track of the target test case to be searched is longer than or equal to the page jump track of the current test case, and there may be one or more target test cases to be searched.
[0035] Specifically, a string matching algorithm can be used to search for test cases whose page jump traces match the page jump traces of the current test case from various preset test cases. Commonly used string matching algorithms include: brute force matching algorithm, KMP (Knuth Morris Pratt) matching algorithm, BM (Boyer-Moore) matching algorithm, etc. Among them, the main idea of the brute force matching algorithm is: starting from the first character of the main string and the pattern string (string to be matched), compare them in sequence. When an unmatched character appears, the pattern string position moves back one position, and then starts from the first character of the pattern string and compares it with the corresponding main string character in sequence, and repeats this process until the match is successful or the matching position is not found. The KMP matching algorithm is also called a jump matching algorithm. The main idea of the KMP matching algorithm is: when searching for a pattern string in the main string, use the matched parts of the pattern string and the main string to skip some useless comparisons, that is, when an unmatched character appears at a certain position, it should be moved as far to the right as possible to avoid repeated comparisons, thereby improving matching efficiency. In practical applications, the required matching algorithm can be selected according to actual needs. Specifically in this embodiment, the page jump track of the current test case can be used as the pattern string, and the page jump tracks of each preset test case can be used as the main string, and matching is performed according to the selected string matching algorithm.
[0036] Step 103: Identify the test operations occurring on each page in the page jump track of the current test case.
[0037] Test operations can be some automated operations that simulate users, such as click, slide, input, select, assert, etc. The page jump track of the current test case generally involves multiple pages, and the test operations occurring on each page can be identified. For example, when executing a test case for the payment function of an application, the user's up and down sliding test operation will be simulated on the details page, and the user's selection or input of specifications, models, quantities, etc. will be simulated on the purchase selection page.
[0038] Step 104: merge the current test case into the target test case based on the test operations occurring on each page.
[0039] Specifically, the test operations occurring on each page involved in the current test case can be merged into the corresponding page of the target test case, thereby realizing the merging of test cases. For example, the current test case and the target test case both involve the settlement page, the current test case performs a sliding operation on the settlement page, and the target test case performs a click operation on the settlement page, then the sliding operation performed by the current test case on the settlement page can be merged into the settlement page of the target test case. After the merger, the current test case can be deleted, and the settlement page of the merged target test case will include both sliding and clicking test operations, that is, the settlement page of the target test case will cover the test operations occurring on the settlement page of the current test case.
[0040] In a specific implementation, when the page jump tracks of two test cases are exactly the same, there may be differences in the internal implementation logic of the two test cases. In order to avoid incomplete test coverage caused by transitional merging, after identifying the test operations occurring on each page in the page jump track of the current test case, it is also possible to first determine whether the test operations occurring on each page meet the preset conditions. When the test operations occurring on each page meet the preset conditions, the current test case is merged into the target test case; otherwise, the current test case is not merged into the target test case. The preset condition can be a pre-set condition to limit the test operation. When the test operation meets the limited condition, it means that the test operation (or test case) can be merged.
[0041] For example, the test operations can be divided into two categories: X and Y through experimental tests in advance. If the test operations occurring on each page involved in the current test case all belong to X category, then the test operations occurring on each page are considered to meet the preset conditions. On the contrary, if a test operation occurring on at least one of the pages involved in the current test case does not belong to X category, then it is considered not to meet the preset conditions. X category can be a test operation performed on the current page that does not cause the page data of the next page to change; for example, the test operations of sliding up and down and flipping through specific selection items on the purchase selection page, these operations will not cause the data on the settlement page to change, and can be classified into X category. Y category can be considered as a test operation performed on the current page that will cause the page data of the next page to change; for example, the test operations of model and quantity selection on the purchase selection page, these operations will cause the data on the settlement page to change, such as when different purchase quantities are selected, the settlement amount on the settlement page will change, and these test operations can be classified into Y category. In actual applications, there can be other classification principles or standards for X category and Y category, which can be set according to actual conditions, and are not specifically limited here.
[0042] In actual applications, each test case in the target automated test case set can be traversed, and the test cases that can be merged can be merged, thereby reducing the number of test cases in the target automated test case set. When performing regression automated testing on the system or application corresponding to the target automated test case set, the target automated test case set after the test case merger can be used, thereby reducing the number of test cases executed and improving testing efficiency.
[0043] The scheme of this embodiment can obtain the page jump track generated by executing the current test case, and obtain the page jump track generated by executing each preset test case respectively; search for the test case whose page jump track matches the page jump track of the current test case from each preset test case, and obtain the target test case; identify the test operations occurring on each page in the page jump track of the current test case; merge the current test case into the target test case based on the test operations occurring on each page. That is, the present invention can compare the page jump track of the test case to find repeated test cases (check for duplicates), merge the repeated test cases based on the test operations on the page (de-duplicate), and the entire check for duplicates and de-duplicate process is automatically executed, without the need for manual operation or manual intervention, saving labor costs, improving the de-duplicate efficiency, and improving the test efficiency of regression testing.
[0044] The following examples further illustrate the test case merging method provided by the embodiment of the present invention. Figure 2 As shown, the method of this embodiment may specifically include the following steps:
[0045] Step 201, obtaining a page jump track generated by executing the current test case, and obtaining a page jump track generated by executing each preset test case.
[0046] For example, the debug bridge command (adb command) can be used to obtain the identification information and page jump order of the page that jumps when executing the current test case, and the page jump track is generated according to the identification information and page jump order of the page that jumps. Alternatively, the front-end page when executing the current test case can also be screenshotted or recorded, and the screenshot or recording data is analyzed to generate the page jump track of the current test case. The same or similar method can be used to obtain the page jump track of the preset test case. The page jump track can include the identification information of the page that jumps during the execution of the corresponding test case and the page jump order between each page. The identification information of the page can be the name, number, sequence number, etc. of the page.
[0047] Step 202 , using a jump matching algorithm, searches for a test case whose page jump track matches the page jump track of the current test case from various preset test cases to obtain a target test case.
[0048] The jump matching algorithm is the KMP matching algorithm. The use of the jump matching algorithm can reduce the time complexity of matching and improve the matching efficiency. The page jump trajectory matching with the current test case can be a page jump trajectory that completely includes the page jump trajectory of the current test case, or a page jump trajectory that includes the complete page jump trajectory of the current test case. Generally speaking, the page jump trajectory of the target test case to be searched is longer than or equal to the page jump trajectory of the current test case. Therefore, the target test case can be searched in the test case whose page jump trajectory is longer than or equal to the page jump trajectory of the current test case to narrow the search scope and further improve the search efficiency. The number of target test cases to be searched may be one or more, or it may be 0.
[0049] For example, suppose the page jump trace generated by executing the current test case is as follows Figure 3a As shown, Figure 3a A, B, C, and D represent different pages, that is, the page jump track of the current test case is A→B→C→D. Assume that the preset test case includes 4 test cases, and the page jump track of test case 1 is as follows: Figure 3b As shown, it is A→B→C→D→E; the page jump track of test case 2 is as follows Figure 3c As shown, it is E→A→B→C→D; the page jump track of test case 3 is as follows Figure 3d As shown, it is E→A→B→C→D→F; the page jump track of test case 4 is as follows Figure 3e As shown, it is E→A→F→B→C→D; the test cases whose page jump trajectory matches the page jump trajectory of the current test case are test case 1, test case 2 and test case 3, and the page jump trajectory of test case 4 does not match the page jump trajectory of the current test case.
[0050] Step 203: Identify the test operations occurring on each page in the page jump track of the current test case.
[0051] The test operation can be some automated operations performed by simulating users, such as click, slide, input, selection, assertion, etc. The page jump track of the current test case generally involves multiple pages, and the test operations occurring on each page can be identified. The pages in the page jump track of the current test case include the current page and the next page adjacent to the current page in the page jump track of the current test case. For example, Figure 3a In the page jump track shown, when the current page is page B, the next page is page C.
[0052] Step 204 , determining whether the test operation occurring on each page meets the preset conditions, if yes, executing step 205 , if not, executing step 207 .
[0053] Through experimental testing in advance, the test operations can be divided into two categories: category X and category Y. If the test operations occurring on each page involved in the current test case all belong to category X, then the test operations occurring on each page are considered to meet the preset conditions. On the contrary, if at least one of the pages involved in the current test case has a test operation that does not belong to category X (i.e., belongs to category Y), then it is considered not to meet the preset conditions. Test operations that meet the preset conditions are test operations that can be merged.
[0054] For example, test operations performed on the current page that do not cause changes to the page data on the next page can be classified as type X operations; for example, test operations of sliding up and down and flipping through specific selection items on the purchase selection page, these operations will not cause changes to the data on the settlement page, and can be classified as type X. Test operations performed on the current page that will cause changes to the page data on the next page can be classified as type Y operations; for example, test operations of selecting models and quantities on the purchase selection page, these operations will cause changes to the data on the settlement page, such as when different purchase quantities are selected, the settlement amount on the settlement page will change, and these operations can be classified as type Y.
[0055] Since the general page jump click operation is a necessary operation, when classifying the test operation, the page jump click operation can be excluded from the classification scope. In particular, if a page jump click operation has at least two optional positions on the previous page, that is, you can click to enter the next page from different positions of the previous page, and when you click to enter the next page from different positions of the previous page, the page data of the next page is different, then this page jump click operation is classified into Class Y, because in this case, there are differences in the implementation logic of entering the next page from different positions of the current page, which is a situation that cannot be merged. For example, when entering the settlement page from position 1 and position 2 of the details page, the prices displayed on the settlement page are different, then the test operation of clicking to jump to the settlement page at position 1 and position 2 of the details page belongs to Class Y. On the contrary, if the page data of the next page are the same when clicking to enter the next page from different positions of the previous page, then this page jump click operation can be classified into Class X.
[0056] In addition, for the test operations included in the classification scope, there are some special cases that need special treatment. For example, if a test operation is executed through conditional judgment, even if the test operation will cause the page data of the next page to change, the test operation should be classified as Class Y, because the test operation triggered by conditional judgment is an optional operation, which will be executed only when the condition is met, and will not be executed when the condition is not met, that is, it may not be executed every time. That is, when it is determined that the test operation occurring on the current page will cause the page data of the next page to change, it can be further determined whether the test operation occurring on the current page is an optional operation. If it is an optional operation, the test operation occurring on the current page is classified as Class Y, and the test operation occurring on the current page meets the preset conditions.
[0057] In addition, for test operations that require special or specified configuration data to be performed, even if the test operation does not cause the page data of the next page to change, this test operation should be classified into Class X, because this test operation has special requirements for data and cannot be implemented using data of general configuration, and is an operation that cannot be merged. For example, some test operations can only be performed when configured as specified products, so these test operations need to be classified into Class X even if they do not cause the data of the next page to change. That is, when it is determined that the test operation occurring on the current page will not cause the page data of the next page to change, it can be further determined whether the test operation occurring on the current page requires specified configuration data. If the test operation occurring on the current page does not require specified configuration data, the test operation occurring on the current page is classified into Class Y; conversely, if the test operation occurring on the previous page requires specified configuration data, the test operation occurring on the current page is classified into Class X.
[0058] At this point, the test operations included in the classification scope are classified. After classification, it can be determined whether the corresponding test operations meet the preset conditions according to the classification situation. In actual applications, some pages may have test operations that can be included in the classification scope, while some pages do not have test operations that can be included in the classification scope. The types of test operations that can be included in the classification scope can be determined. For example Figure 3a In the page jump track shown, there may be no test operations on page A and page B that can be included in the classification scope. There may only be some page jump click operations on page A and page B. The existence of page A and page B is to enter page C.
[0059] Step 205, determine the difference operation.
[0060] The difference operation refers to a test operation that occurs in a page of the page jump track of the current test case but does not occur in a corresponding page of the page jump track of the target test case.
[0061] Step 206: Incorporate the implementation logic of the difference operation into the target test case, and delete the current test case.
[0062] For example, an example of test case merging is Figure 3f As shown, assuming that the page jump track of the current test case is A→B→C→D, there are no operations that can be included in the classification scope on pages A, B, and D, and there are operations X1 and X2 that can be included in the classification scope on page C, and X1 and X2 both belong to the previous X category, that is, they are test operations that can be merged; the page jump track of the target test case is A→B→C→D→E, and there are operations X1 and X3 that can be included in the classification scope on page C, and X1 and X3 both belong to the previous X category, then the test operation X2 (difference operation) on page C of the current test case can be merged into page C of the target test case. After the merger, the test operations on page C of the target test case include X1, X2, and X3. After the merger, the current test case can be deleted.
[0063] Step 207: determine that the current test case cannot be merged into the target test case.
[0064] If the current test case cannot be merged, you can continue to keep the current test case in the automated test case set and continue to look for the target test case that the next test case can be merged into. Traverse each test case in the automated test case set, merge and remove duplicates for the test cases that can be merged, thereby reducing the number of test cases in the target automated test case set. After the merging and deduplication are completed, an analysis report can be generated for the automated test case set. The analysis report can include identification information and quantity information of the deleted test cases, information on the merged test cases, etc., for the testers to review. When performing regression automation testing on the system or application corresponding to the target automated test case set, the target automated test case set after the test case merger can be used, thereby reducing the number of executed test cases and improving testing efficiency.
[0065] The solution of this embodiment can compare the page jump trajectory of the test case and determine the type of test operation of the page. When the page jump trajectory of the test case matches and the type of test operation of the page meets the conditions, it can be considered that there is duplication between the current test case and the target test case, and the duplicate test cases can be merged (deduplicated) based on the test operation on the page. The entire duplication checking and deduplication process is automatically executed without the need for manual operation or intervention, thus saving labor costs, improving deduplication efficiency, and improving the test efficiency of regression testing. In addition, through the double judgment of the page jump trajectory and the test operation of the page, accurate deduplication can be achieved, reducing the problem of insufficient test coverage caused by case merging.
[0066] The following describes the test framework provided by the embodiment of the present invention. Figure 4 As shown in the figure, the entire test framework can include three parts: automated test platform, device cluster and offline analysis. Among them: the automated test platform is responsible for the management of the user's automated test cases, the execution of automated tasks, the maintenance of the device list, and the viewing of the final test report. The device cluster layer is responsible for maintaining all mobile devices in the background to ensure that all devices are managed in a unified manner; at the same time, all devices will be installed with a unified automated test system. When the automated test tasks are assigned, the unified task scheduler is responsible for scheduling the devices; when the device executes each automated test case, the background will automatically record the data information of each page to form a timeline-based data link; at the same time, the steps and exceptions of each test case during the execution process will be recorded in the log for subsequent analysis. The offline analysis layer will regularly convert the collected use case page information into page jump trajectories (similar to Markov chains, it is necessary to analyze and deduplicate duplicate page information), and use the log information to collect the specific operation content performed on each page for subsequent analysis, and finally generate an analysis report on whether there are identical use cases.
[0067] Figure 5 is a schematic diagram of a structure of a test case merging device provided by an embodiment of the present invention, such as Figure 5 As shown, the device may specifically include:
[0068] The acquisition module 501 is used to acquire the page jump track generated by executing the current test case, and acquire the page jump track generated by executing each preset test case;
[0069] A search module 502 is used to search for a test case whose page jump track matches the page jump track of the current test case from the preset test cases to obtain a target test case;
[0070] An identification module 503 is used to identify the test operations occurring on each page in the page jump track of the current test case;
[0071] The merging module 504 is used to merge the current test case into the target test case based on the test operations occurring on each page.
[0072] In one embodiment, the merging module 504 is specifically used for:
[0073] Determine whether the test operation occurring on each of the pages meets the preset conditions;
[0074] When the test operations occurring on each of the pages meet the preset condition, the current test case is merged into the target test case.
[0075] In one embodiment, the pages include a current page and a subsequent page adjacent to the current page in the page jump track of the current test case, and the merging module 504 determines whether the test operations occurring on the pages meet the preset conditions, including:
[0076] Determine whether the test operation occurring on the current page will cause the page data of the subsequent page to change;
[0077] When the test operation occurring on the current page will not cause the page data of the subsequent page to change, it is determined that the test operation occurring on the current page meets the preset condition.
[0078] In one embodiment, the merging module 504 is further configured to:
[0079] When the test operation occurring on the current page may cause the page data of the subsequent page to change, determining whether the test operation occurring on the current page is an optional operation;
[0080] When the test operation occurring on the current page is the optional operation, it is determined that the test operation occurring on the current page meets the preset condition.
[0081] In one embodiment, when the test operation occurring on the current page does not cause the page data of the subsequent page to change, the merging module 504 determines that the test operation occurring on the current page meets the preset condition, including:
[0082] When the test operation occurring on the current page will not cause the page data of the subsequent page to change, determining whether the test operation occurring on the current page requires the designation of configuration data;
[0083] When the test operation occurring on the current page does not require the designated configuration data, it is determined that the test operation occurring on the current page meets the preset condition.
[0084] In one embodiment, the merging module 504 is specifically used for:
[0085] Determine a difference operation, where the difference operation refers to a test operation that occurs in a page of the page jump track of the current test case but does not occur in a corresponding page of the page jump track of the target test case;
[0086] The implementation logic of the difference operation is incorporated into the target test case, and the current test case is deleted.
[0087] In one embodiment, the acquisition module 501 acquires the page jump track generated by executing the current test case, including:
[0088] Using a debug bridge command to obtain identification information of a page to be redirected when executing the current test case;
[0089] The page jump track is generated according to the identification information of the jumped page and the page jump sequence.
[0090] In one embodiment, the identification module 503 is specifically used for:
[0091] Obtaining the execution log of the current test case;
[0092] The execution log is analyzed to identify the test operations occurring on each of the pages.
[0093] In one embodiment, the search module 502 is specifically used for:
[0094] A jump matching algorithm is used to search for a test case whose page jump track matches the page jump track of the current test case from the preset test cases to obtain a target test case.
[0095] Those skilled in the art can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example for illustration. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. The specific working process of the functional modules described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.
[0096] The device of the embodiment of the present invention can obtain the page jump track generated by executing the current test case, and obtain the page jump track generated by executing each preset test case respectively; search for the test case whose page jump track matches the page jump track of the current test case from each preset test case, and obtain the target test case; identify the test operations occurring on each page in the page jump track of the current test case; merge the current test case into the target test case based on the test operations occurring on each page. That is, the present invention can compare the page jump track of the test case to find repeated test cases (check for duplicates), merge the repeated test cases based on the test operations on the page (de-duplicate), and the whole check for duplicates and de-duplicate process is automatically executed, without manual operation or manual intervention, saving labor costs, improving de-duplicate efficiency, and improving the test efficiency of regression testing. In addition, by double judgment of the page jump track and the test operation of the page, it is possible to accurately remove duplicates, and reduce the problem that the test coverage points caused by the case merging are not comprehensive enough.
[0097] An embodiment of the present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, the test case merging method provided in any of the above embodiments is implemented.
[0098] An embodiment of the present invention further provides a computer-readable medium on which a computer program is stored. When the program is executed by a processor, the test case merging method provided in any of the above embodiments is implemented.
[0099] Reference below Figure 6 , which shows a schematic diagram of the structure of a computer system 600 of an electronic device suitable for implementing an embodiment of the present invention. Figure 6 The electronic device shown is only an example and should not bring any limitation to the function and scope of use of the present invention.
[0100] like Figure 6 As shown, the computer system 600 includes a central processing unit (CPU) 601, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage part 608 into a random access memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the computer system 600 are also stored. The CPU 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.
[0101] The following components are connected to the I / O interface 605: an input section 606 including a keyboard, a mouse, etc.; an output section 607 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 608 including a hard disk, etc.; and a communication section 609 including a network interface card such as a LAN card, a modem, etc. The communication section 609 performs communication processing via a network such as the Internet. A drive 610 is also connected to the I / O interface 605 as needed. A removable medium 611, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 610 as needed, so that a computer program read therefrom is installed into the storage section 608 as needed.
[0102] In particular, according to the embodiments disclosed in the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present invention include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 609, and / or installed from the removable medium 611. When the computer program is executed by the central processing unit (CPU) 601, the above-mentioned functions defined in the system of the present invention are executed.
[0103] It should be noted that the computer-readable medium shown in the present invention may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present invention, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.
[0104] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0105] The modules and / or units involved in the description of the present invention may be implemented by software or hardware. The modules and / or units described may also be arranged in a processor, for example, it may be described as follows: a processor includes an acquisition module, a search module, an identification module, and a merging module. The names of these modules do not, in some cases, constitute limitations on the modules themselves.
[0106] As another aspect, the present invention further provides a computer-readable medium, which may be included in the device described in the above embodiment; or may exist independently without being assembled into the device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by a device, the device includes:
[0107] Obtain the page jump track generated by executing the current test case, and obtain the page jump track generated by executing each preset test case; search for a test case whose page jump track matches the page jump track of the current test case from the preset test cases to obtain a target test case; identify the test operations occurring on each page in the page jump track of the current test case; and merge the current test case into the target test case based on the test operations occurring on each page.
[0108] According to the technical solution of the present invention, the page jump track of the test case can be compared to find duplicate test cases (check for duplicates), and the duplicate test cases can be merged (de-duplicated) based on the test operation on the page. The entire check for duplicates and de-duplication process is automatically executed without the need for manual operation or manual intervention, saving labor costs, improving de-duplication efficiency, and improving the test efficiency of regression testing. In addition, through the double judgment of the page jump track and the test operation of the page, accurate de-duplication can be achieved, reducing the problem of insufficient test coverage caused by the merging of test cases.
[0109] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.
[0110] It should be noted that the collection, collection, updating, analysis, processing, use, transmission, storage and other aspects of user personal information involved in the technical solution of this disclosure are in compliance with the provisions of relevant laws and regulations, are used for legitimate purposes, and do not violate public order and good morals. Necessary measures are taken for user personal information to prevent illegal access to user personal information data and maintain the security of user personal information, network security and national security.
[0111] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modification, equivalent substitution and improvement 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 merging method, characterized in that: include: Get the page jump track generated by executing the current test case, and get the page jump track generated by executing each preset test case; Searching for a test case whose page jump track matches the page jump track of the current test case from the preset test cases to obtain a target test case; Identify the test operations occurring on each page in the page jump track of the current test case; The current test case is merged into the target test case based on the test operations occurring on each page.
2. The method according to claim 1, characterized in that The test operation based on each page merges the current test case into the target test case, including: Determine whether the test operation occurring on each of the pages meets the preset conditions; When the test operations occurring on each of the pages meet the preset condition, the current test case is merged into the target test case.
3. The method according to claim 2, characterized in that The various pages include a current page and a subsequent page adjacent to the current page in a page jump track of the current test case, and determining whether the test operation occurring on the various pages meets a preset condition includes: Determine whether the test operation occurring on the current page will cause the page data of the subsequent page to change; When the test operation occurring on the current page will not cause the page data of the subsequent page to change, it is determined that the test operation occurring on the current page meets the preset condition.
4. The method according to claim 3, characterized in that After determining whether the test operation occurring on the current page will cause the page data of the subsequent page to change, the method further includes: When the test operation occurring on the current page may cause the page data of the subsequent page to change, determining whether the test operation occurring on the current page is an optional operation; When the test operation occurring on the current page is the optional operation, it is determined that the test operation occurring on the current page meets the preset condition.
5. The method according to claim 3, characterized in that: When the test operation occurring on the current page does not cause the page data of the subsequent page to change, determining that the test operation occurring on the current page meets the preset condition includes: When the test operation occurring on the current page will not cause the page data of the subsequent page to change, determining whether the test operation occurring on the current page requires the designation of configuration data; When the test operation occurring on the current page does not require the designated configuration data, it is determined that the test operation occurring on the current page meets the preset condition.
6. The method according to claim 1, characterized in that The test operation based on each page merges the current test case into the target test case, including: Determine a difference operation, where the difference operation refers to a test operation that occurs in a page of the page jump track of the current test case but does not occur in a corresponding page of the page jump track of the target test case; The implementation logic of the difference operation is incorporated into the target test case, and the current test case is deleted.
7. The method according to claim 1, characterized in that The obtaining of the page jump track generated by executing the current test case includes: Using the debug bridge command to obtain the identification information and page jump order of the page to be jumped when executing the current test case; The page jump track is generated according to the identification information of the jumped page and the page jump sequence.
8. The method according to claim 1, characterized in that The identifying the test operations occurring on each page in the page jump track of the current test case includes: Obtaining the execution log of the current test case; The execution log is analyzed to identify the test operations occurring on each of the pages.
9. The method according to claim 1, characterized in that: The step of searching for a test case whose page jump track matches the page jump track of the current test case from the preset test cases to obtain a target test case includes: A jump matching algorithm is used to search for a test case whose page jump track matches the page jump track of the current test case from the preset test cases to obtain a target test case.
10. A test case merging device, characterized in that: include: An acquisition module is used to acquire the page jump track generated by executing the current test case, and acquire the page jump track generated by executing each preset test case; A search module, used to search for a test case whose page jump track matches the page jump track of the current test case from the preset test cases, to obtain a target test case; An identification module, used to identify the test operations occurring on each page in the page jump track of the current test case; A merging module is used to merge the current test case into the target test case based on the test operations occurring on each page.
11. 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 program, the test case merging method according to any one of claims 1 to 9 is implemented.
12. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the test case merging method as described in any one of claims 1 to 9 is implemented.