Test case selection methods, devices, electronic equipment, and storage media

By using an incompatibility information table and incremental code to automatically filter incompatible test cases in interface testing, the problem of test case incompatibility after interface upgrades was solved, and the stability and efficiency of the regression phase were improved.

CN115658478BActive Publication Date: 2026-07-17BEIJING BAIDU NETCOM SCI & TECH CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
BEIJING BAIDU NETCOM SCI & TECH CO LTD
Filing Date
2022-09-30
Publication Date
2026-07-17

AI Technical Summary

Technical Problem

In the context of microservices, existing technologies struggle to efficiently identify test cases that are incompatible with the upgraded interfaces, leading to instability and inefficiency in regression testing.

Method used

Based on a preset incompatibility information table and incremental code of the current test interface, test cases that are incompatible with the function to be tested are automatically filtered out. Incompatible test cases are extracted from the test case library and modified using attribute information matching, and an incompatibility report is generated.

Benefits of technology

It improves the accuracy and efficiency of screening incompatible test cases, ensures the stability and efficiency of regression testing, and reduces the need for manual intervention and reliance on experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115658478B_ABST
    Figure CN115658478B_ABST
Patent Text Reader

Abstract

This disclosure provides a method, apparatus, electronic device, and storage medium for screening test cases, relating to the technical field of software testing. The specific implementation scheme is as follows: based on a preset incompatibility information table and the incremental code of the function to be tested in the current test interface, it is determined that the function to be tested in the current test interface has incompatible test cases; the attribute information of the current test interface is extracted; based on the attribute information of the current test interface and the attribute information of the interfaces corresponding to each test case in the test case library, test cases incompatible with the function to be tested in the current test interface are screened from the test case library. The technology of this disclosure can effectively improve the accuracy and efficiency of screening incompatible test cases.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of computer technology, specifically to the field of software testing and other technical fields, and in particular to a method, apparatus, electronic device and storage medium for screening test cases. Background Technology

[0002] An interface is a protocol used to define a program; it describes a set of related behaviors that can belong to any class or structure. Servers often use interfaces to agree on the format of data exchange, and use a Uniform Resource Locator (URL) to locate and differentiate the functions of different interfaces. An interface can be considered a fundamental element for a software service to provide services to the outside world. In the context of microservices, many services expose business functions through interfaces, and internal business calls become calls to Application Program Interfaces (APIs) between services. Therefore, testing interfaces is particularly important.

[0003] Typically, testers use automated test cases to test APIs. These test cases contain different combinations of request parameters, and assertions are used to verify the data returned by the request or the changes it causes, in order to determine whether the service performance meets the product's expectations. These test cases are usually not one-time use; testers save historical test cases and use them during subsequent API upgrades to verify whether the upgrade affects older functionality. This process is also known as the regression phase of automated test cases. Summary of the Invention

[0004] This disclosure provides a method, apparatus, electronic device, and storage medium for screening test cases.

[0005] According to one aspect of this disclosure, a method for filtering test cases is provided, comprising:

[0006] Based on a pre-defined incompatibility information table and the incremental code of the function to be tested in the current test interface, it is determined that there are incompatible test cases for the function to be tested in the current test interface.

[0007] Extract the attribute information of the current test interface;

[0008] Based on the attribute information of the current test interface and the attribute information of the interfaces corresponding to each test case in the test case library, test cases that are incompatible with the function to be tested of the current test interface are selected from the test case library.

[0009] According to another aspect of this disclosure, a test case screening device is provided, comprising:

[0010] The determination module is used to determine, based on a preset incompatibility information table and the incremental code of the function to be tested in the current test interface, whether there are incompatible test cases for the function to be tested in the current test interface.

[0011] The extraction module is used to extract the attribute information of the current test interface;

[0012] The filtering module is used to filter test cases that are incompatible with the function to be tested of the current test interface from the test case library based on the attribute information of the current test interface and the attribute information of the interface corresponding to each test case in the test case library.

[0013] According to another aspect of this disclosure, an electronic device is provided, comprising:

[0014] At least one processor; and

[0015] A memory communicatively connected to the at least one processor; wherein,

[0016] The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the methods described above and any possible implementations.

[0017] According to another aspect of this disclosure, a non-transitory computer-readable storage medium is provided storing computer instructions for causing the computer to perform the methods described above and any possible implementation thereof.

[0018] According to another aspect of this disclosure, a computer program product is provided, comprising a computer program that, when executed by a processor, implements the aspects and any possible implementations described above.

[0019] According to the technology disclosed herein, the accuracy and efficiency of screening incompatible test cases can be effectively improved.

[0020] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of this disclosure, nor is it intended to limit the scope of this disclosure. Other features of this disclosure will become readily apparent from the following description. Attached Figure Description

[0021] The accompanying drawings are provided to better understand this solution and do not constitute a limitation of this disclosure. Wherein:

[0022] Figure 1 This is a schematic diagram based on the first embodiment of the present disclosure;

[0023] Figure 2 This is a schematic diagram according to the second embodiment of the present disclosure;

[0024] Figure 3 This is a schematic diagram of an incompatible information table provided in this embodiment;

[0025] Figure 4 This is a schematic diagram of an incompatible report provided in this embodiment;

[0026] Figure 5 This is a schematic diagram according to the third embodiment of the present disclosure;

[0027] Figure 6 This is a schematic diagram according to the fourth embodiment of the present disclosure;

[0028] Figure 7 This is a schematic diagram according to the fifth embodiment of the present disclosure;

[0029] Figure 8 This is a block diagram of an electronic device used to implement the methods of the embodiments of this disclosure. Detailed Implementation

[0030] The exemplary embodiments of this disclosure are described below with reference to the accompanying drawings, including various details of the embodiments to aid understanding, and should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of this disclosure. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.

[0031] Obviously, the described embodiments are only some, not all, of the embodiments disclosed herein. All other embodiments obtained by those skilled in the art based on the embodiments of this disclosure without inventive effort are within the scope of protection of this disclosure.

[0032] It should be noted that the terminal devices involved in the embodiments of this disclosure may include, but are not limited to, smart devices such as mobile phones, personal digital assistants (PDAs), wireless handheld devices, and tablet computers; the display devices may include, but are not limited to, personal computers, televisions, and other devices with display functions.

[0033] Furthermore, the term "and / or" in this article is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, or B existing alone. Additionally, the character " / " in this article generally indicates that the preceding and following related objects have an "or" relationship.

[0034] In the regression phase of automated test cases, a common problem is that code upgrades affect older API functionalities. For example, making a non-required field mandatory or changing a valid value to an invalid one can cause incompatibility between the upgraded code and the old test cases. This inevitably leads to the failure of the old test cases during the regression phase. Such incompatibility-induced failures not only fail to intercept the problem, increasing the troubleshooting and maintenance costs for testers, but may also mask the true underlying code issues.

[0035] Therefore, to identify incompatible test cases in the regression phase as early as possible and modify them to a usable state as soon as possible to avoid affecting the stability of the regression testing tasks, after the project's detailed design, testers can read the interface documentation in the design document to understand the changes in interface fields and use their experience to detect whether the upgraded interface will affect existing test cases. Affected test cases can then be modified to pass the regression testing, thus improving the efficiency of the regression testing phase. However, the implementation of this approach depends on the completeness and accuracy of the project's detailed design and the testers' personal experience, and the selection of test cases relies on manual selection, resulting in very low efficiency in screening incompatible test cases during the regression phase.

[0036] Figure 1 This is a schematic diagram based on the first embodiment of the present disclosure; as shown Figure 1 As shown in the figure, this embodiment provides a method for screening test cases, which may specifically include the following steps:

[0037] S101. Based on the preset incompatibility information table and the incremental code of the function to be tested in the current test interface, determine that there are incompatible test cases for the function to be tested in the current test interface.

[0038] S102. Extract the attribute information of the current test interface;

[0039] S103. Based on the attribute information of the current test interface and the attribute information of the interfaces corresponding to each test case in the test case library, filter out test cases that are incompatible with the function to be tested of the current test interface from the test case library.

[0040] The test case selection method in this embodiment is used before the regression phase of interface testing. It can proactively select test cases from the test case library that are incompatible with the function to be tested in the current test interface. This allows testers to modify incompatible test cases to make them compatible with the function to be tested in the current test interface, ensuring the stability of the regression phase and improving testing efficiency.

[0041] The function to be tested in the current test interface of this embodiment is developed by the R&D personnel in the form of incremental code. Before the function to be tested in the current test interface is released, it needs to undergo regression testing and other related tests to test the incremental code. Only after the tests are passed can it be released.

[0042] In this embodiment, based on a preset incompatibility information table and the incremental code of the function to be tested in the current test interface, it can be detected whether the incremental code hits the incompatibility situation in the incompatibility information. If it does, it can be determined that there are incompatible test cases in the function to be tested in the current test interface.

[0043] In this embodiment, when it is determined that there are incompatible test cases for the function to be tested in the current test interface, test cases that are incompatible with the function to be tested in the current test interface can be further filtered from the test case library. This test case library can include all test cases used in all historical tests of the current test interface. Specifically, the filtering can be based on the attribute information of the current test interface and the attribute information of the interfaces corresponding to each test case in the test case library, which can effectively ensure the accuracy of the filtered incompatible test cases.

[0044] The test case screening method in this embodiment, by adopting the above scheme, can automatically pre-screen test cases that are incompatible with the function to be tested in the current test interface before the regression test, so that testers can modify them in a timely and accurate manner to make them meet expectations. This can effectively improve the accuracy and efficiency of screening incompatible test cases, and can effectively improve the stability and efficiency of regression test.

[0045] Figure 2 This is a schematic diagram based on the second embodiment of the present disclosure; as shown Figure 2 As shown, the test case selection method in this embodiment is based on the above... Figure 1 Based on the technical solutions of the illustrated embodiments, the technical solutions of this disclosure will be described in further detail. For example... Figure 2 As shown, the test case selection method in this embodiment may specifically include the following steps:

[0046] S201. Check whether the incremental code of the function to be tested in the current test interface hits the incompatibility feature in the incompatibility information table; if it hits, proceed to step S202; if it does not hit, determine that there are no incompatible test cases for the function to be tested in the current test interface, and end.

[0047] S202. Determine that there are incompatible test cases for the function to be tested in the current test interface; proceed to step S203.

[0048] Since the function to be tested in the current test interface was developed by the R&D personnel in the form of incremental code, in this embodiment, by detecting whether the incremental code hits the incompatibility feature in the incompatibility information table, if it does, it can be determined that the function to be tested in the test interface will also have incompatible test cases, and incompatible test cases can be further obtained.

[0049] For example, before step S201 in this embodiment, it may also include: configuring an incompatibility information table based on the incompatibility information of test cases from historical interface testing;

[0050] In this embodiment, statistical analysis can be performed on the incompatibility information of all historical test cases for the test cases to obtain an incompatibility information table. For example, this incompatibility information table may include the code characteristics of incremental code. That is, incremental code that matches these code characteristics usually has incompatibility with test cases in the test case library.

[0051] In practical applications, test cases can include information such as the request Uniform Resource Locator (URL), request parameters, and return parameters. When detecting test case incompatibility, one can analyze whether the code characteristics mentioned above affect the request or return information of the test case. If so, incompatibility is inevitable. Based on the above principles, incompatibility information of all historical interface test cases can be analyzed, and an incompatibility information table can be configured.

[0052] Furthermore, the incompatibility information table can be configured with the scenarios corresponding to code characteristics and the location of code modifications. For example, the code modification location can include the first level, the second level, or higher, specifically referring to the level of the modified code within the entire incremental code. The first level can be called the interface level; code at this level is easily detected, making it very easy to obtain code characteristics and specific modifications, and facilitating the generation of modification suggestions. The second level and higher involve internal validation logic, and can also be called the internal validation logic level. This level contains a large amount of code, making it difficult to obtain specific modifications and generate modification suggestions.

[0053] For example, Figure 3 This is a schematic diagram of an incompatible information table provided in this embodiment. Figure 3 The level shown indicates the location of the code modification. Figure 3 Taking the incompatibility information table as an example, which includes level, scenario, and code characteristics, the scenario can include higher-level scenario information (e.g., column 2) or more detailed scenario information (e.g., column 3). Figure 3As shown, in the first-level code, i.e., the interface level, changes to Stargate protocol fields involve detailed scenario information such as requesting field deletion, requesting field modification, and adding / deleting / modifying field values. Furthermore, Figure 3 The modified code shown in the code features involves information such as the request URL, request parameters, and return parameters of the test cases, which will lead to incompatibility of the test cases.

[0054] The incompatibility information table configured in this embodiment is highly accurate and can help in the screening of incompatible test cases in this embodiment.

[0055] It should be noted that the incompatibility information table in this embodiment does not need to be configured before each test. Instead, once configured, it can be reused in multiple tests. Furthermore, in practical applications, the incompatibility information table can be updated periodically. Alternatively, when testers discover scenarios that cannot be currently covered, rules that adapt to the current code characteristics need to be added to continuously enrich the incompatibility information table and improve the accuracy of incompatibility test cases.

[0056] Further optionally, in one embodiment of this disclosure, step S201, detecting whether there are code features in the incompatibility information table in the incremental code of the function to be tested in the current test interface, may specifically include the following steps:

[0057] (a) Parse the incremental code of the function to be tested in the current test interface into a syntax tree;

[0058] (b) Obtain the code characteristics of field nodes, method nodes, return nodes, and lines of code in the syntax tree;

[0059] (c) Detect whether the code features of field nodes, method nodes, return nodes, or lines of code in the syntax tree match the code features in the incompatibility information table.

[0060] If a match is found, it can be determined that the incremental code of the function to be tested in the current test interface matches the code features in the incompatibility information table, which further confirms that there are incompatible test cases for the function to be tested in the current test interface. Correspondingly, the incompatibility features in the incompatibility information table can include the code features listed therein.

[0061] By detecting the above code features, it is possible to accurately determine whether there are incompatible test cases in the current test interface's function to be tested, and to ensure the accuracy of the detection and improve the detection efficiency.

[0062] Alternatively, in one embodiment of this disclosure, before step (a1), the method may further include: obtaining the scenario corresponding to the incremental code of the function to be tested in the current test interface; detecting and determining that the scenario matches an incompatible scenario in the incompatibility information table.

[0063] For example, you can refer to Figure 3 The incompatibility information table shown in the embodiment uses 11 incompatibility scenarios as an example. In practical applications, the incompatibility information table can be updated and expanded based on newly discovered incompatibility scenarios as testing progresses. First, the scenario corresponding to the incremental code of the function to be tested in the current test interface is obtained. If a scenario in the incompatibility information table is matched, steps (a)-(c) can be further executed. Otherwise, if no scenario in the incompatibility information table is matched, it can be considered that the scenario to which the incremental code of the function to be tested in the current test interface belongs does not have an incompatibility situation, that is, there are no incompatible test cases for the function to be tested in the current test interface. Correspondingly, the incompatibility features in the incompatibility information table can include the scenario and code features in the incompatibility information table.

[0064] By checking whether the scenarios corresponding to the incremental code of the function under test in the current test interface match the scenarios in the incompatibility information table, the accuracy of the filtering can be further improved. If the scenarios corresponding to the incremental code of the function under test in the current test interface do not match the scenarios in the incompatibility information table, steps (a)-(c) above do not need to be executed. This reduces unnecessary checks and shortens the filtering process when there are no incompatible test cases for the function under test in the current test interface. If the function under test in the current test interface does contain incompatibility information, steps (a)-(c) above are then executed to ensure the accuracy of the filtering.

[0065] S203. Based on the incremental code of the function to be tested in the current test interface, extract the field names and URLs of the current test interface;

[0066] The field names of the current test interface can include the request field names and the return field names. In this embodiment, using the field names and URLs of the current test interface can accurately and uniquely identify the attribute information of the current test interface.

[0067] For example, in this embodiment, static code analysis techniques can be used to extract the field names of the current test interface based on the incremental code of the function to be tested in the current test interface.

[0068] Based on the incremental code of the function to be tested in the current test interface, call chain analysis technology can be used to obtain the URL of the current test interface associated with the incremental code. This call chain analysis technology can analyze the call chain of each URL and method, and obtain the mapping relationship between methods and URLs, and methods and classes; then, based on the mapping relationship between methods and classes, the methods corresponding to the classes can be obtained, and further, based on the mapping relationship between methods and URLs, the URLs corresponding to the methods can be analyzed.

[0069] S204. Based on the attribute information of the current test interface and the attribute information of the interfaces corresponding to each test case in the test case library, filter out test cases that are incompatible with the function to be tested of the current test interface from the test case library.

[0070] By using the same method for extracting attribute information from the current test interface, we can also extract the attribute information of the interfaces corresponding to each test case in the test case library. Then, we filter the test cases from the test case library that match the attribute information of the current test interface. These test cases are the ones that are incompatible with the function to be tested in the current test interface.

[0071] S205. Obtain the identification information of incompatible test cases;

[0072] S206. Issue an incompatibility report, which includes identification information of the incompatible test cases.

[0073] In this embodiment, the purpose of issuing an incompatibility report is to provide prompts so that testers can modify incompatible test cases, enabling the incompatible test cases to stably complete the regression testing phase, thereby improving the stability and accuracy of the regression testing phase.

[0074] To more clearly highlight the incompatibility issues in the incompatibility report, allowing testers to quickly modify incompatible test cases, step S206 may include retrieving the code characteristics from the incompatibility information table corresponding to the incompatible test cases.

[0075] At this point, the corresponding step S206, issuing an incompatibility report, may include: issuing an incompatibility report carrying identification information and code characteristics of incompatible test cases.

[0076] Further optionally, in one embodiment of this disclosure, after obtaining the code features in the incompatibility information table corresponding to the incompatible test cases, and before issuing the incompatibility report in step S206, the following steps may be included:

[0077] (1) Based on the incompatibility information table and the code features in the incompatibility information table corresponding to the incompatible test cases, locate the code modification location;

[0078] (2) Detect whether the code modification location is in the first level or the second level or above; if it is in the first level, execute step (3); if it is in the second level or above, then step S206 can issue an incompatibility report carrying the identification information of incompatible test cases, code characteristics and code modification location.

[0079] (3) Generate modification suggestions based on code characteristics; at this time, step S206 can be to issue an incompatibility report carrying the identification information of incompatible test cases, code characteristics, code modification location and modification suggestions.

[0080] Because code modifications are located at the first level, the characteristics of these modifications can be easily and accurately identified. These characteristics clearly pinpoint the specific changes made to the code, allowing for the direct generation of corresponding modification suggestions. Correspondingly, when issuing an incompatibility report, including the code modification location and suggestions makes it very convenient for testers to modify the incompatible test cases, ensuring that the modifications are consistent with the incremental code of the function under test in the current test interface. This enables the test cases to be reliably tested during the regression phase.

[0081] However, if the code modification is located at the second level or above, as shown in Table 3 above, and involves code modifications at the internal verification logic level, the specific content of the code modification cannot be accurately located based on the code characteristics, so accurate modification suggestions cannot be obtained. In this case, the incompatibility report can only include the code characteristics and the location of the code modification for testers to refer to and modify the code in the incompatible test cases. This ensures that the modified test cases are consistent with the incremental code of the function under test in the current test interface, enabling stable completion of the test cases during the regression phase.

[0082] For example, Figure 4 This is a schematic diagram of an incompatibility report provided in this embodiment. For example... Figure 4 The image shows an incompatibility report with suggested modifications. This report identifies why each test case needs to be changed and how to change it, providing testers with clear and accurate suggestions. This allows testers to modify incompatible test cases promptly and accurately, ensuring that the modified test cases can stably complete regression testing tasks and improve the efficiency of regression testing. The term "hook" indicates incompatibility, signifying that the test case is blocked and cannot directly participate in regression testing.

[0083] The test cases selected using the method described above in this embodiment are incompatible test cases related to the function to be tested in the current test interface. Additionally, during the regression testing phase, it is also necessary to select some test cases from the test library that are related to and compatible with the function to be tested in the current test interface. Together, these will enable regression testing of the function to be tested in the test interface.

[0084] Alternatively, in one embodiment of this disclosure, since an interface may have many functions, different configured test cases may test different functions. After an interface is upgraded, it may be related to some functions that have already been launched, but not to other functions. Therefore, before the upgraded function is launched, regression testing is required to check whether the upgraded function of the interface is compatible with the previously related functions. In this embodiment, a set of test cases related to the function to be tested of the current test interface can be selected from the test case library first. Then, test cases that are incompatible with the function to be tested of the current test interface can be selected from the test case library. For example, in the above technical solution of this embodiment, the test case library can be a set of test cases that have been selected and are related to the function to be tested of the current test interface. By adopting the technical solution of this embodiment, test cases that are incompatible with the function to be tested of the current test interface can be selected from the test case library and an incompatibility report can be issued. Testers can then further modify the incompatible test cases based on the incompatibility report. The resulting test case set includes compatible test cases and test cases that have been modified due to incompatibility. Then, the obtained test case set can be used to perform regression testing on the functions to be tested in the current test interface.

[0085] The test case filtering method in this embodiment detects whether the incremental code of the function to be tested in the current test interface hits the incompatibility features in the incompatibility information table, thereby determining whether there are incompatible test cases for the function to be tested in the current test interface. This method can effectively improve the accuracy and efficiency of test case filtering.

[0086] Furthermore, in this embodiment, an incompatibility report can be issued after incompatible test cases are identified. For example, the incompatibility report can include identification information of the incompatible test cases, code characteristics, code modification locations, or modification suggestions. This provides testers with effective modification information, allowing them to promptly and accurately modify the incompatible test cases. The modified test cases are then consistent with the incremental code of the function under test in the current test interface, ensuring stable completion of the test cases during the regression phase. Therefore, the solution in this embodiment effectively ensures the timely and accurate modification of incompatible test cases, effectively accelerates the regression testing process, and improves test documentation and efficiency during the regression phase.

[0087] Moreover, the technical solution of this embodiment does not require manual intervention in the process of screening test cases. Testers have strong professional knowledge and do not need to manually screen test cases. According to the above technical solution of this embodiment, the screening of incompatible test cases can be automatically realized, improving the accuracy and efficiency of screening incompatible test cases, and effectively improving the stability and efficiency of regression testing.

[0088] Figure 5 This is a schematic diagram based on the third embodiment of this disclosure; as shown Figure 5 As shown, this embodiment provides an application example of a test case selection method, which uses the incremental code of the function to be tested in the current test interface for selection. Figure 3 The illustrated embodiment demonstrates code modifications for fields that are deleted or modified. Then, the R&D engineer (RD) submits the code. At this point, following the test case filtering method of this embodiment, the incremental code is scanned based on the incompatibility information table. The system checks whether the incremental code matches any incompatibility features in the table. If it does, the corresponding incompatible test case can be determined, triggering the test case filtering process.

[0089] Specifically, call chain analysis technology can be used to obtain the corresponding URL. Using the URL and the module name in the incremental code, the test case identifier, i.e., the caseid, is queried. The test case management platform is then requested to query the case content using the caseid, including the field names within the case. Then, based on the field names corresponding to the incremental code and the field names in the obtained case content, a caseid list affected by the incremental code is calculated. This caseid list is listed as a branch in the test case library, with the status marked as "hook," indicating that the cases in the branch's caseid list are all incompatible test cases, temporarily blocked, and cannot be automatically executed during the regression phase. Referring to the method in this embodiment, a corresponding report can be generated based on the obtained incompatible test cases to prompt testers to modify the incompatible test case set so that it can be tested during the regression phase. After modification, it can also be marked in the report / visualization mode to remove the incompatibility mark of the corresponding case; that is, it is equivalent to updating the hook status and removing the incompatibility mark of each case in the caseid list. For offline interfaces, the interface can be deleted directly with one click. After modification, the hook status also needs to be updated. At this point, testers can query the list of processed case IDs and perform status merging. This involves merging all modified cases from each branch into the test case library. After modification, regression testing can be performed first. Once the tests pass, the incremental code can be released; then, the modified cases from each branch are merged into the library. In practical applications, an interface project may include countless incremental code developments and releases, all following the implementation method described in this embodiment. Based on each submission of incremental code for the function to be tested, incompatible test cases are screened and modified to meet the requirements of regression testing. For details, please refer to the description in the above embodiment. The implementation process of the above embodiment will not be repeated here.

[0090] Figure 6 This is a schematic diagram based on the fourth embodiment of the present disclosure; as shown Figure 6 As shown, this embodiment provides a test case screening device 600, including:

[0091] The determination module 601 is used to determine whether there are incompatible test cases for the function to be tested in the current test interface based on a preset incompatibility information table and the incremental code of the function to be tested in the current test interface.

[0092] Extraction module 602 is used to extract attribute information of the current test interface;

[0093] The filtering module 603 is used to filter test cases that are incompatible with the function to be tested of the current test interface from the test case library based on the attribute information of the current test interface and the attribute information of the interface corresponding to each test case in the test case library.

[0094] The test case filtering device 600 in this embodiment achieves the same implementation principle and technical effect as the above-mentioned related method embodiments by using the above-mentioned modules. For details, please refer to the description of the above-mentioned related method embodiments, which will not be repeated here.

[0095] Figure 7 This is a schematic diagram according to the fifth embodiment of this disclosure; as shown Figure 7 As shown, this embodiment provides a test case screening device 700, including the above-mentioned... Figure 6 The modules with the same name and function shown are: Determine module 701, Extract module 702, and Filter module 703.

[0096] In this embodiment, the determining module 701 is used for:

[0097] Check whether the incremental code of the function to be tested in the current test interface hits the incompatibility feature in the incompatibility information table;

[0098] If the test is successful, it indicates that there are incompatible test cases for the function to be tested in the current test interface.

[0099] Further optionally, in one embodiment of this disclosure, the determining module 701 is configured to:

[0100] Parse the incremental code of the function to be tested in the current test interface into a syntax tree;

[0101] Obtain the code characteristics of field nodes, method nodes, return nodes, and lines of code in the syntax tree;

[0102] Detect whether the code features of field nodes, method nodes, return nodes, or lines of code in the syntax tree match the code features in the incompatibility information table.

[0103] Further optional, such as Figure 7 As shown, in one embodiment of this disclosure, the test case screening device 700 further includes:

[0104] The 704 module is used to obtain the scenario corresponding to the incremental code of the function to be tested in the current test interface;

[0105] The determination module 701 is also used to detect and determine whether a scene matches an incompatible scene in the incompatibility information table.

[0106] Further optional, such as Figure 7 As shown, in one embodiment of this disclosure, the test case screening device 700 further includes a reporting module 705;

[0107] The 704 acquisition module is also used to acquire identification information of incompatible test cases;

[0108] Report module 705 is used to issue incompatibility reports, which carry identification information of incompatible test cases.

[0109] Further optionally, in one embodiment of this disclosure, the acquisition module 704 is also used to acquire code features in the incompatibility information table corresponding to incompatible test cases;

[0110] Report module 705 is used to issue incompatibility reports that carry identification information and code characteristics of incompatible test cases.

[0111] Further optional, such as Figure 7 As shown, in one embodiment of this disclosure, the test case screening device 700 further includes:

[0112] The location module 706 is used to locate the code modification location based on the code characteristics in the incompatibility information table and the incompatibility test cases corresponding to the incompatibility information table;

[0113] Module 701 is used to determine whether the code modification location is at the second level or above;

[0114] Report module 705 is used to issue incompatibility reports that carry identification information of incompatible test cases, code characteristics, and code modification locations.

[0115] Further optional, such as Figure 7 As shown, in one embodiment of this disclosure, the test case screening device 700 further includes:

[0116] The generation module 707 is used to generate modification suggestions based on code characteristics if the code modification location is in the first level.

[0117] Report module 705 is used to issue incompatibility reports that carry identification information of incompatible test cases, code characteristics, code modification locations, and modification suggestions.

[0118] Further optionally, in one embodiment of this disclosure, the extraction module 702 is used for:

[0119] Based on the incremental code of the function to be tested in the current test interface, extract the field names and Uniform Resource Locators (URLs) of the current test interface.

[0120] Further, optionally, in one embodiment of this disclosure, the extraction module is configured to:

[0121] Based on the incremental code of the function to be tested in the current test interface, static code analysis technology is used to extract the field names of the current test interface;

[0122] Based on the incremental code of the function to be tested in the current test interface, call chain analysis technology is used to obtain the Uniform Resource Locator (URL) of the current test interface associated with the incremental code.

[0123] Further optional, such as Figure 7 As shown, in one embodiment of this disclosure, the test case screening device 700 further includes:

[0124] Configuration module 708 is used to configure incompatibility information for test cases based on historical interface testing, and to configure the incompatibility information table.

[0125] The test case screening device 700 in this embodiment achieves the same implementation principle and technical effect as the above-mentioned related method embodiments by using the above-mentioned modules. For details, please refer to the description of the above-mentioned related method embodiments, which will not be repeated here.

[0126] The acquisition, storage, and application of user personal information involved in the technical solution disclosed herein comply with the provisions of relevant laws and regulations and do not violate public order and good morals.

[0127] According to embodiments of this disclosure, this disclosure also provides an electronic device, a readable storage medium, and a computer program product.

[0128] Figure 8 A schematic block diagram of an example electronic device 800 that can be used to implement embodiments of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the present disclosure described and / or claimed herein.

[0129] like Figure 8As shown, device 800 includes a computing unit 801, which can perform various appropriate actions and processes based on a computer program stored in read-only memory (ROM) 802 or a computer program loaded from storage unit 808 into random access memory (RAM) 803. RAM 803 may also store various programs and data required for the operation of device 800. The computing unit 801, ROM 802, and RAM 803 are interconnected via bus 804. Input / output (I / O) interface 805 is also connected to bus 804.

[0130] Multiple components in device 800 are connected to I / O interface 805, including: input unit 806, such as keyboard, mouse, etc.; output unit 807, such as various types of monitors, speakers, etc.; storage unit 808, such as disk, optical disk, etc.; and communication unit 809, such as network card, modem, wireless transceiver, etc. Communication unit 809 allows device 800 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.

[0131] The computing unit 801 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 801 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 801 performs the various methods and processes described above, such as the methods of this disclosure. For example, in some embodiments, the methods of this disclosure can be implemented as a computer software program tangibly contained in a machine-readable medium, such as storage unit 808. In some embodiments, part or all of the computer program can be loaded and / or installed on device 800 via ROM 802 and / or communication unit 809. When the computer program is loaded into RAM 803 and executed by the computing unit 801, one or more steps of the methods of this disclosure described above can be performed. Alternatively, in other embodiments, the computing unit 801 can be configured to perform the methods of this disclosure by any other suitable means (e.g., by means of firmware).

[0132] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.

[0133] The program code used to implement the methods of this disclosure may be written in any combination of one or more programming languages. This program code may be provided to a processor or controller of a general-purpose computer, special-purpose computer, or other programmable data processing apparatus, such that when executed by the processor or controller, the program code causes the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program code may be executed entirely on a machine, partially on a machine, as a standalone software package partially on a machine and partially on a remote machine, or entirely on a remote machine or server.

[0134] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

[0135] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device for displaying information to the user (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor); and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the computer. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).

[0136] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as a data server), or computing systems that include middleware components (e.g., an application server), or computing systems that include frontend components (e.g., a user computer with a graphical user interface or web browser through which a user can interact with embodiments of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., a communication network). Examples of communication networks include local area networks (LANs), wide area networks (WANs), and the Internet.

[0137] Computer systems can include clients and servers. Clients and servers are generally located far apart and typically interact via communication networks. Client-server relationships are created by computer programs running on the respective computers and having a client-server relationship with each other. Servers can be cloud servers, servers in distributed systems, or servers incorporating blockchain technology.

[0138] It should be understood that the various forms of processes shown above can be used to rearrange, add, or delete steps. For example, the steps described in this disclosure can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution disclosed in this disclosure can be achieved, and this is not limited herein.

[0139] The specific embodiments described above do not constitute a limitation on the scope of protection of this disclosure. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this disclosure should be included within the scope of protection of this disclosure.

Claims

1. A method for selecting test cases, comprising: The system checks whether the incremental code of the function to be tested in the current test interface matches any incompatibility features in a preset incompatibility information table; the incompatibility features include code features. The incompatibility information table also includes the scenarios corresponding to the code features and the locations where the code was modified. Upon a hit, it is determined that the function to be tested in the current test interface has incompatible test cases; Extract the attribute information of the current test interface; Based on the attribute information of the current test interface and the attribute information of the interfaces corresponding to each test case in the test case library, test cases that are incompatible with the function to be tested of the current test interface are filtered from the test case library. Obtain the code features in the incompatibility information table corresponding to the incompatible test cases; Based on the incompatibility information table and the code features in the incompatibility information table corresponding to the incompatible test cases, locate the code modification location; It is determined that the code modification is located at the second level or above; Issue an incompatibility report carrying the identification information of the incompatible test cases, the code characteristics, and the location of the code modifications.

2. The method according to claim 1, wherein, Check whether the incremental code of the function to be tested in the current test interface matches the incompatibility features in the preset incompatibility information table, including: Parse the incremental code of the function to be tested in the current test interface into a syntax tree; Obtain the code features of field nodes, method nodes, return nodes, and lines of code in the syntax tree; The code features of field nodes, method nodes, return nodes, or lines of code in the syntax tree are detected to match the code features in the incompatibility information table.

3. The method according to claim 2, wherein, Before parsing the incremental code of the function to be tested in the current test interface into a syntax tree, the method further includes: Obtain the scenario corresponding to the incremental code of the function to be tested in the current test interface; The scenario is detected and determined to be an incompatible scenario in the incompatibility information table.

4. The method according to claim 1, wherein, Before issuing an incompatibility report carrying identification information of the incompatible test cases, the code characteristics, and the location of the code modifications, the method includes: Obtain the identification information of the incompatible test cases.

5. The method according to claim 1, wherein, The method further includes: If the code modification location is at the first level, a modification suggestion is generated based on the code characteristics; Issue an incompatibility report containing the identification information of the incompatible test cases, the code characteristics, the location of the code modification, and the modification suggestions.

6. The method according to any one of claims 1-5, wherein, Extract the attribute information of the current test interface, including: Based on the incremental code of the function to be tested in the current test interface, extract the field names and Uniform Resource Locators (URLs) of the current test interface.

7. The method according to claim 6, wherein, Based on the incremental code of the function to be tested in the current test interface, extract the field names and Uniform Resource Locators (URLs) of the current test interface, including: Based on the incremental code of the function to be tested in the current test interface, static code analysis technology is used to extract the field names of the current test interface; Based on the incremental code of the function to be tested in the current test interface, call chain analysis technology is used to obtain the Uniform Resource Locator (URL) of the current test interface associated with the incremental code.

8. The method according to any one of claims 1-5, wherein, Before detecting whether the incremental code of the function to be tested in the current test interface hits the incompatibility feature in the preset incompatibility information table, the method further includes: Configure the incompatibility information table based on the incompatibility information of test cases from historical interface testing.

9. A test case filtering device, comprising: The determination module is used to detect whether the incremental code of the function to be tested in the current test interface hits the incompatibility features in the preset incompatibility information table; the incompatibility features include code features; The incompatibility information table also includes the scenarios corresponding to the code features and the code modification locations; in response to a hit, it is determined that the function to be tested in the current test interface has incompatible test cases; The extraction module is used to extract the attribute information of the current test interface; The filtering module is used to filter test cases that are incompatible with the function to be tested of the current test interface from the test case library based on the attribute information of the current test interface and the attribute information of the interface corresponding to each test case in the test case library. The acquisition module is used to acquire the code features in the incompatibility information table corresponding to the incompatible test cases; The location module is used to locate the code modification location based on the incompatibility information table and the code features in the incompatibility information table corresponding to the incompatible test cases; The determining module is further configured to determine that the code modification location is at the second level or above; The reporting module is used to issue an incompatibility report carrying the identification information of the incompatible test cases, the code characteristics, and the location of the code modifications.

10. The apparatus according to claim 9, wherein, The determining module is used for: Parse the incremental code of the function to be tested in the current test interface into a syntax tree; Obtain the code features of field nodes, method nodes, return nodes, and lines of code in the syntax tree; The code features of field nodes, method nodes, return nodes, or lines of code in the syntax tree are detected to match the code features in the incompatibility information table.

11. The apparatus according to claim 10, wherein, The device further includes: The acquisition module is used to acquire the scenario corresponding to the incremental code of the function to be tested in the current test interface; The determining module is further configured to detect and determine that the scene matches an incompatible scene in the incompatibility information table.

12. The apparatus according to claim 9, wherein: The acquisition module is also used to acquire the identification information of the incompatible test cases.

13. The apparatus according to claim 9, wherein, The device further includes: The generation module is used to generate modification suggestions based on the code characteristics if the code modification location is at the first level. The reporting module is also used to issue an incompatibility report carrying the identification information of the incompatible test cases, the code characteristics, the code modification location, and the modification suggestions.

14. The apparatus according to any one of claims 9-13, wherein, The extraction module is used for: Based on the incremental code of the function to be tested in the current test interface, extract the field names and Uniform Resource Locators (URLs) of the current test interface.

15. The apparatus according to claim 14, wherein, The extraction module is used for: Based on the incremental code of the function to be tested in the current test interface, static code analysis technology is used to extract the field names of the current test interface; Based on the incremental code of the function to be tested in the current test interface, call chain analysis technology is used to obtain the Uniform Resource Locator (URL) of the current test interface associated with the incremental code.

16. The apparatus according to any one of claims 9-13, wherein, The device further includes: The configuration module is used to configure the incompatibility information table based on the incompatibility information of test cases from historical interface testing.

17. An electronic device comprising: At least one processor; as well as A memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-8.

18. A non-transitory computer-readable storage medium storing computer instructions, wherein, The computer instructions are used to cause the computer to perform the method according to any one of claims 1-8.

19. A computer program product comprising a computer program that, when executed by a processor, implements the method according to any one of claims 1-8.