Method, device and regression testing system for regression testing based on call relations
Patent Information
- Application Number
- CN202311288597.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-10-07
- Publication Date
- 2026-11-03
- Estimated Expiration
- 2043-10-07
AI Technical Summary
现有回归测试分析在微服务架构中效率和可靠性较低,尤其在代码优化、需求调整和数据库实体变更时,难以识别功能变化并导致冗余调用关系和低效测试。
By obtaining the call relationships of test cases, component service code is generated, target call interfaces and target test cases are determined, and regression testing is performed only on the affected call relationships and test cases to reduce redundant calls.
It improves the efficiency and reliability of regression testing, accurately locates functional changes, reduces redundant call relationships, and improves analysis efficiency.
Smart Images

Figure CN117130939B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of regression testing technology, and more specifically, to a method, apparatus, computer-readable storage medium, and regression testing system for regression testing based on call relationships. Background Technology
[0002] With the application of microservice architecture technology in banking systems, each business function is defined as a microservice component. Its modularity, reusability, and replaceability allow for improved delivery quality and shorter delivery cycles through orchestration and composition. However, the complexity and variability of the composition and invocation relationships also exist. Therefore, changes in the internal logic of functions and the composition and invocation relationships caused by code optimization, requirement adjustments, quality checks for anomalies, and database entity changes can affect some service transaction functions to a certain extent.
[0003] Software regression testing is used in the later stages of rapid iteration during overall product testing to verify expected functional changes caused by developers' code requirement changes and database entity modifications. In actual regression testing, testers prefer to obtain the names of transactions that may cause functional changes or to directly pinpoint and analyze test cases. Existing static code analysis generates redundant call relationship data in multi-condition branching scenarios. Existing dynamic code analysis suffers from excessive hierarchical call relationships. Furthermore, both methods struggle to identify changes in transaction interface functionality caused by database entity modifications. Therefore, current regression testing analysis methods have relatively low efficiency and reliability. Summary of the Invention
[0004] The main objective of this application is to provide a method, apparatus, computer-readable storage medium, and regression testing system based on call relationships, so as to at least solve the problems of low efficiency and reliability of regression testing analysis in the prior art.
[0005] To achieve the above objectives, according to one aspect of this application, a method for regression testing based on call relationships is provided, comprising: acquiring multiple test cases for testing a target object; acquiring call relationships, wherein the call relationships are call relationships generated during the execution of the test cases or call relationships between two test cases; generating component service codes when the target object changes, wherein the target object is a database table and / or software code, and the component service codes correspond one-to-one with the changed target object; determining a target call interface based on the component service codes, and calling a target call relationship based on the target call interface, wherein the number of target call relationships is less than or equal to the number of call relationships, and the target call relationships are the call relationships affected by the change of the target object; and determining target test cases based on the target call relationships to perform regression testing based on the target test cases, wherein the number of target test cases is less than or equal to the number of test cases, and the target test cases are the test cases affected by the change of the target object.
[0006] Optionally, before obtaining the call relationship, the method further includes: performing test work according to multiple test cases and obtaining test information, wherein the test information is information on the execution order and relationship of multiple test cases during the test process; constructing a call relationship library according to the test information, wherein the call relationship library includes the call relationship and the business tracking number of the test case, and the business tracking number is used to track and locate the test case.
[0007] Optionally, when the target object is the software code, and when the target object changes, generating component service code includes: obtaining the software code submitted for the Nth time and the software code submitted for the (N+1)th time, where N≥1; comparing whether the software code submitted for the Nth time and the software code submitted for the (N+1)th time are the same; if the software code submitted for the Nth time and the software code submitted for the (N+1)th time are different, determining that the parts of the different software code submitted for the Nth time and at least a part of the software code submitted for the (N+1)th time are difference code regions; generating component service code based on the difference code regions, wherein the component service code is mapped to the difference code regions.
[0008] Optionally, when the target object is the data table of the database, and when the target object changes, generating a component service code includes: obtaining the table structure of the data table saved for the Nth time and the table structure of the data table saved for the (N+1)th time; comparing whether the table structure of the data table saved for the Nth time and the table structure of the data table saved for the (N+1)th time are the same; and if the table structure of the data table saved for the Nth time and the table structure of the data table saved for the (N+1)th time are different, generating the component service code based on the ID of the data table saved for the Nth time and the ID of the data table saved for the (N+1)th time, wherein the component service code is mapped to the ID of the data table saved for the Nth time and the ID of the data table saved for the (N+1)th time.
[0009] Optionally, after obtaining the call relationship, the method further includes: obtaining multiple microservice components, wherein the microservice components are used to perform test work according to the test case; determining the component-level call relationship according to the call relationship, wherein the component-level call relationship is the call relationship between two of the microservice components or the relationship between the microservice component and the aggregation component; constructing a component-level call relationship library according to the component-level call relationship, wherein the component-level call relationship library includes the component-level call relationship, business tracking number and transaction code, wherein the transaction code is the code of the transaction that implements the business request, and the business request corresponds to at least one of the test cases.
[0010] Optionally, determining the target test case based on the target call relationship includes: searching for the target business tracking number and the target transaction code in the component-level call relationship database based on the target call relationship, wherein the target business tracking number is the business tracking number affected by changes to the target object, and the target transaction code is the transaction code affected by changes to the target object; filtering out the test cases that are not affected by changes to the target object based on the target business tracking number and the target transaction code to obtain the target test case.
[0011] Optionally, the component-level call relationship library further includes the component service code, and the component service code and the component-level call relationship correspond one-to-one. After determining the target test case based on the target call relationship, the method further includes: extracting the target component service code, wherein the target component service code is one of a plurality of component service codes; searching for the target component-level call relationship corresponding to the target component service code in the component-level call relationship library; if the target component-level call relationship corresponding to the target component service code is found, retaining the target component-level call relationship; if the target component-level call relationship corresponding to the target component service code is not found, deleting the target component-level call relationship.
[0012] According to another aspect of this application, an apparatus for regression testing based on call relationships is provided, comprising: a first acquisition unit for acquiring multiple test cases, the test cases being used to test a target object; a second acquisition unit for acquiring call relationships, wherein the call relationships are call relationships generated during the execution of the test cases or call relationships between two test cases; a generation unit for generating component service codes when the target object changes, wherein the target object is a database table and / or software code, and the component service codes correspond one-to-one with the changed target object; a first determination unit for determining a target call interface based on the component service codes, and calling a target call relationship based on the target call interface, wherein the number of target call relationships is less than or equal to the number of call relationships, and the target call relationships are the call relationships affected by the change of the target object; and a second determination unit for determining target test cases based on the target call relationships, so that regression testing is performed based on the target test cases, wherein the number of target test cases is less than or equal to the number of test cases, and the target test cases are the test cases affected by the change of the target object.
[0013] According to another aspect of this application, a computer-readable storage medium is provided, the computer-readable storage medium including a stored program, wherein, when the program is executed, it controls the device where the computer-readable storage medium is located to perform any of the methods for regression testing based on call relationships.
[0014] According to another aspect of this application, a regression testing system is provided, comprising: one or more processors, a memory, and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, the one or more programs including a method for performing any of the call-based regression tests described above.
[0015] Applying the technical solution of this application, the call relationship between test cases is first extracted. If subsequent changes occur to the data table and / or code, a component service code can be generated. This component service code is used to map the changed data table and / or code. If existing code undergoes a region change, its component service code is directly obtained (without being generated again) to trace the target interface. If new code is added, a new component service code will be generated. This new component service code is then called, meaning the code region mapped by its parent component code will definitely change. The component service code corresponding to this code region change is obtained to trace the target interface; the newly generated component service code is not needed. If a component service code is deleted, similarly, the code region of the parent caller will definitely be deleted; the component service code called by the parent is sufficient. When a database table is changed, the ID of the changed database table is identified. The component service code that operates on this database table records this ID information. The component service code with this ID information is used to trace the target interface or test case. The target call interface can be used to call the call relationship between test cases. This allows only the affected call relationship to be called, while unaffected non-target call relationships are no longer used. This avoids redundancy or too many call relationships. At the same time, whether it is a database table change or a code change, it can be identified when the change occurs. Therefore, this solution can identify the interface. Furthermore, during regression testing, the target test case can be determined based on the target call relationship. This allows regression testing to be performed only on the affected test cases, improving the efficiency and reliability of regression test analysis. Attached Figure Description
[0016] The accompanying drawings, which form part of this application, are used to provide a further understanding of this application. The illustrative embodiments and descriptions of this application are used to explain this application and do not constitute an undue limitation of this application. In the drawings:
[0017] Figure 1 A hardware structure block diagram of a mobile terminal for performing a method for regression testing based on call relationships, according to an embodiment of this application, is shown.
[0018] Figure 2 A flowchart illustrating a regression testing method based on call relationships according to an embodiment of this application is shown.
[0019] Figure 3 A schematic diagram of the calling relationship is shown;
[0020] Figure 4 A schematic diagram illustrating the component hierarchy call relationship is shown;
[0021] Figure 5A flowchart illustrating another method for regression testing based on call relationships is shown.
[0022] Figure 6 A structural block diagram of an apparatus for regression testing based on call relationships, provided according to an embodiment of this application, is shown.
[0023] The above figures include the following reference numerals:
[0024] 102. Processor; 104. Memory; 106. Transmission device; 108. Input / output device. Detailed Implementation
[0025] It should be noted that, unless otherwise specified, the embodiments and features described in this application can be combined with each other. This application will now be described in detail with reference to the accompanying drawings and embodiments.
[0026] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.
[0027] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate for the embodiments of this application described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0028] In some solutions, the impact of code optimization, requirement adjustments, anomalies, or database entity changes on the code layer or database entity layer is typically addressed through static and dynamic code analysis. However, these methods have the following limitations: 1) Static code analysis generates parsed files from bytecode and analyzes call relationships. In cases with multiple conditional branches, this can produce redundant call relationship data, increasing the number of transaction interfaces in regression testing. 2) Dynamic code analysis identifies class and method call relationships based on business call chains. However, calls to internal functions and external interface methods can generate excessive call chains with unclear hierarchical structures. Furthermore, both methods struggle to assess the impact of database entity changes on the scope of transaction service interfaces.
[0029] As described in the background section, the efficiency and reliability of regression test analysis in the prior art are low. To solve the above problems, embodiments of this application provide a method, apparatus, computer-readable storage medium, and regression test system based on call relationships.
[0030] The technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention.
[0031] The methods and embodiments provided in this application can be executed on a mobile terminal, computer terminal, or similar computing device. Taking running on a mobile terminal as an example, Figure 1 This is a hardware structure block diagram of a mobile terminal for a regression testing method based on call relationships, according to an embodiment of the present invention. Figure 1 As shown, a mobile terminal may include one or more ( Figure 1 Only one is shown in the diagram. A processor 102 (which may include, but is not limited to, a microprocessor MCU or a programmable logic device FPGA, etc.) and a memory 104 for storing data are also shown. The mobile terminal may further include a transmission device 106 for communication functions and an input / output device 108. Those skilled in the art will understand that... Figure 1 The structure shown is for illustrative purposes only and does not limit the structure of the mobile terminal described above. For example, the mobile terminal may also include components that are more... Figure 1 The more or fewer components shown, or having the same Figure 1 The different configurations shown.
[0032] The memory 104 can be used to store computer programs, such as application software programs and modules, like the computer program corresponding to the device information display method in this embodiment of the invention. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, thereby implementing the above-described method. The memory 104 may include high-speed random access memory and non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include memory remotely located relative to the processor 102, and these remote memories can be connected to the mobile terminal via a network. Examples of the aforementioned networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof. The transmission device 106 is used to receive or send data via a network. Specific examples of the aforementioned networks may include wireless networks provided by the mobile terminal's communication provider. In one example, the transmission device 106 includes a network interface controller (NIC), which can be connected to other network devices via a base station to communicate with the Internet. In one example, the transmission device 106 may be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0033] This embodiment provides a method for regression testing based on call relationships that runs on a mobile terminal, computer terminal, or similar computing device. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.
[0034] Figure 2 This is a flowchart illustrating a regression testing method based on call relationships according to an embodiment of this application.
[0035] like Figure 2 As shown, the method includes the following steps:
[0036] Step S201: Obtain multiple test cases, which are used to test the target object;
[0037] Specifically, a test case refers to a set of specific operational steps, input data, and expected results designed to verify whether software or a system functions correctly, meets requirements, or achieves expected results. Test cases can include operations under normal conditions, operations under abnormal conditions, boundary condition tests, etc. By executing these test cases, defects and problems in the software or system can be discovered. Obtaining multiple test cases means obtaining multiple different combinations of operational steps, input data, and expected results to cover as many functions and scenarios as possible, thereby improving the comprehensiveness and effectiveness of testing.
[0038] Step S202: Obtain the call relationship, wherein the call relationship is the call relationship generated during the execution of the test case or the call relationship between two test cases.
[0039] Specifically, the calling relationships generated during test case execution refer to the target calling interface calling component service code and the component service code calling component service code.
[0040] Specifically, the calling relationship between test cases refers to whether one test case calls other test cases during execution. This calling relationship can be sequential, conditional, or cyclical. The calling relationship between test cases can be used to describe the execution order and dependencies of test cases. For example, one test case may need to execute before another can, or the execution result of one test case may affect the execution of other test cases. The calling relationship between test cases can be managed and controlled using test case design tools or test management tools.
[0041] Step S203: In the event of a change in the target object, generate component service code, wherein the target object is a database table and / or software code, and the component service code corresponds one-to-one with the changed target object.
[0042] Specifically, the component service code is used to map the code implementation area of a certain interface function. The component service code records relevant information about this area, including hierarchical structure, module aggregation information / entity ID information, entity operation flag (query / maintenance class flag code) and sequence number.
[0043] Specifically, component service codes can be annotated. These codes uniquely map to the implementation class area of interface methods in the code and are annotated in areas such as interface definition methods and implementation classes. The composition rules for component service codes are: hierarchical information + module aggregation / entity number + query / maintenance class identifier + sequence number.
[0044] Specifically, in this step, if the target object changes, component service code can be generated. This component service code can be mapped to the changed target object. No operation is performed on the target object that has not changed. Subsequently, only the affected test cases can be selected.
[0045] Step S204: Determine the target call interface according to the above component service code, and call the target call relationship according to the above target call interface, wherein the number of the above target call relationships is less than or equal to the number of the above call relationships, and the above target call relationships are the above call relationships affected by the change of the above target object;
[0046] Specifically, there can be at least one calling interface, which can be determined based on the calling relationship of the test case. Different calling interfaces correspond to different calling relationships. In this solution, we only need to find the calling relationship affected by the change of the target object. There are many calling interfaces, and both affected and unaffected ones have corresponding calling interfaces. Therefore, if we want to find the affected calling interface, we can use the previously generated component service code to find the target calling interface. The target calling interface is used to call the target calling relationship, which allows us to retrieve the affected calling relationship.
[0047] Step S205: Determine target test cases based on the above target call relationship so that regression testing can be performed based on the above target test cases. The number of above target test cases is less than or equal to the number of above test cases. The above target test cases are the test cases affected by changes to the above target object.
[0048] Specifically, after determining the target call relationship in the aforementioned steps, the target call relationship can be used to extract the target test cases in the test cases. In this way, the test cases affected by the change of the target object can be found. Therefore, when performing regression testing, only the test cases affected by the change of the target object can be subjected to regression testing.
[0049] This embodiment first extracts the call relationships between test cases. If subsequent changes occur to the data table and / or code, a component service code can be generated. This component service code is used to map the changed data table and / or code. If existing code undergoes a region change, its component service code is directly obtained (without being generated again) to trace the target interface. If new code is added, a new component service code is generated. This new component service code is then called, meaning the code region mapped by its parent component code has definitely changed. The component service code corresponding to this code region change is obtained to trace the target interface; the newly generated component service code is not needed. If a component service code is deleted, the same applies; the code region of the parent caller will definitely be deleted, and the component service code called by the parent is identified. If it is a data table or / or code change... According to database table changes, the ID of the changed database table will be identified. The component service code that operates on the database table in the code will record this ID information. The component service code with this ID information is identified to trace the target interface or test case. The target call interface can be used to call the call relationship between test cases. This way, only the affected call relationship can be called, and the unaffected non-target call relationship will not be used. This can avoid redundancy or too many call relationships. At the same time, whether it is a database table change or a code change, it can be identified when the change occurs. Therefore, this solution can identify the interface. Furthermore, in regression testing, the target test case can be determined based on the target call relationship. This way, regression testing can be performed only on the affected test cases, which improves the efficiency and reliability of regression test analysis.
[0050] Specifically, the solution proposed in this application focuses on how to reduce redundant call relationships, simplify the number of call relationships, and increase the analysis of the impact of database changes, so as to achieve efficient and reliable regression test analysis.
[0051] If there are multiple and relatively scattered call relationships, a management tool can be used to organize and manage them. This tool can be a call relationship database. In the specific implementation, before obtaining the call relationships, the above method also includes the following steps: executing tests based on multiple test cases and obtaining test information, wherein the test information is the order and relationship of the execution of multiple test cases during the test; constructing a call relationship database based on the test information, wherein the call relationship database includes the call relationships and the business tracking numbers of the test cases, and the business tracking numbers are used to track and locate the test cases.
[0052] In this solution, business automated test cases can be executed (a set of request parameters based on business scenarios, each case has a unique business tracking number). As a relatively complete set of test cases, the automated test cases basically cover the business scenarios and can serve as the basis for building the initial combined call relationship library. When performing regression test analysis, the test cases can be quickly located based on the business tracking number and transaction code, thereby further improving the efficiency of regression testing.
[0053] Specifically, Skywalking technology can be used to proxy monitoring and information tracking, record service transaction call chain related information, and store data in the format of (business tracking number, parent ID, horizontal ID, component service code).
[0054] To determine software code version changes and track entity changes in the software code, and then generate component service codes based on these changes, when the target object is the aforementioned software code, and when the target object changes, generating component service codes can be achieved through the following steps: Obtain the software code from the Nth submission and the software code from the (N+1)th submission, where N≥1; compare whether the software code from the Nth submission and the software code from the (N+1)th submission are the same; if the software code from the Nth submission and the software code from the (N+1)th submission are different, determine the portions of the different software code from the Nth submission and at least a portion of the software code from the (N+1)th submission as difference code regions; generate the component service codes based on the difference code regions, wherein the component service codes are mapped to the difference code regions.
[0055] In this scheme, if the change is in the region code (software code), the component service code mapping region to which the difference code belongs can be obtained by using a distributed version control system to process the difference code region before and after the iteration. The component service code to which the code belongs can be identified. In this way, the component service code corresponding to the changed software code can be generated when the software code changes. Then, the affected test cases can be found based on the changed software code, thereby improving the efficiency and reliability of regression test analysis.
[0056] To determine changes in the structure of a database table and then generate component service codes based on these changes, when the target object is the aforementioned database table, generating component service codes when the target object changes can be achieved through the following steps: obtaining the table structure of the aforementioned table saved for the Nth time and the table structure of the aforementioned table saved for the N+1th time; comparing whether the table structures of the aforementioned table saved for the Nth time and the aforementioned table saved for the N+1th time are the same; if the table structures of the aforementioned table saved for the Nth time and the aforementioned table saved for the N+1th time are different, generating the aforementioned component service codes based on the IDs of the aforementioned table saved for the Nth time and the aforementioned table saved for the N+1th time, wherein the aforementioned component service codes are mapped to the IDs of the aforementioned table saved for the Nth time and the aforementioned table saved for the N+1th time.
[0057] In this solution, if a database entity (data table structure) changes, the entity ID is mapped to the component service code information. The component service code related to the operation of the entity is located by the entity ID and the hierarchical information (data access layer). In this way, when the table structure changes, the component service code corresponding to the changed table structure can be generated. Subsequently, the affected test cases can be found based on the changed table structure, thereby improving the efficiency and reliability of regression test analysis.
[0058] There are calling relationships between test cases, and implementing test cases requires running microservice components. Therefore, the calling relationships between microservice components can also be determined. In some embodiments, after obtaining the calling relationships, the above method further includes the following steps: obtaining multiple microservice components, wherein the component-level calling relationship is the calling relationship between two of the microservice components or the relationship between the microservice component and the aggregation component, wherein the component-level calling relationship is the calling relationship between any two of the microservice components; constructing a component-level calling relationship library based on the component-level calling relationship, wherein the component-level calling relationship library includes the component-level calling relationship, business tracking number, and transaction code, wherein the transaction code is the code of the transaction that implements the business request, and the business request corresponds to at least one of the above test cases.
[0059] Specifically, an aggregated component is a component consisting of services of the same type.
[0060] In this solution, each business case execution generates a call chain relationship. This business call chain information is integrated and deduplicated based on the component hierarchy information to form a component hierarchy call relationship. When all case call chains are integrated, a component hierarchy call relationship library is formed. This allows the hierarchical call relationships between microservice components to be stored. As a result, the affected microservice components can be identified based on the hierarchical call relationships between microservice components. Subsequently, regression testing can be performed on the affected microservice components, thereby further improving the efficiency and reliability of regression testing analysis.
[0061] Specifically, the component-level call relationship can be a call relationship structure formed by the dependency relationship between the transaction service and the component, or it can be a call relationship structure formed by the dependency relationship between components.
[0062] As mentioned above, the storage data format for component hierarchical call relationships can be (business tracking number, transaction code, hierarchy, [component service code|component service code]).
[0063] Specifically, such as Figure 3 As shown, business requests can be sent to call the transaction interface. The method call chain information is identified based on log information of the same business tracking number. The information is stored in the format of [business tracking number, parent ID, horizontal ID, component service code]. The component service code is a mapping of a certain area code (interface method, interface method implementation class, etc.), and is recorded in annotation form. Its encoding rules include the hierarchical information of this part of the area code (divided according to the project hierarchy, such as service presentation layer, business logic layer, basic component layer, data access layer, etc.), module aggregation information / entity ID information, operation information, and sequence number. Therefore, changes in area code or entity can directly locate the affected service component code. When a service transaction interface executes multiple business cases, it generates multiple method call chains, which need to be further integrated to form the component-level call relationship of the transaction. After multiple service transactions are executed, a component-level call relationship library is generated. Based on the combined call relationship chain, the component-level call relationship is formed by integrating the call chain information according to the component hierarchy, as shown in the example. Figure 4 As shown.
[0064] The number of specific component layers mentioned above is not limited and does not necessarily follow the above rules. Figure 4 The service presentation layer, business logic layer, infrastructure layer, and data access layer shown in the diagram can also be designed to have different relationships between different component layers based on different business requests.
[0065] In some embodiments, determining target test cases based on the aforementioned target call relationship can be achieved through the following steps: Searching for the target business tracking number and target transaction code in the aforementioned component-level call relationship database based on the aforementioned target call relationship, wherein the aforementioned target business tracking number is the business tracking number affected by changes to the aforementioned target object, and the aforementioned target transaction code is the transaction code affected by changes to the aforementioned target object; filtering out the test cases unaffected by changes to the aforementioned target object based on the aforementioned target business tracking number and the aforementioned target transaction code, thus obtaining the aforementioned target test cases.
[0066] In this solution, the affected component service code is used to retrieve the affected case business tracking number and transaction code from the component-level call relationship database. By combining the business test case number with the component call relationship, test cases can be effectively filtered, further improving regression testing efficiency.
[0067] In the specific implementation process, the aforementioned component-level call relationship library also includes the aforementioned component service codes. Each component service code corresponds one-to-one with a component-level call relationship. After determining the target test case based on the aforementioned target call relationship, the method further includes the following steps: extracting the target component service code, wherein the target component service code is one of multiple aforementioned component service codes; searching for the target component-level call relationship corresponding to the aforementioned target component service code in the aforementioned component-level call relationship library; if the target component-level call relationship corresponding to the aforementioned target component service code is found, retaining the target component-level call relationship; if the target component-level call relationship corresponding to the aforementioned target component service code is not found, deleting the target component-level call relationship.
[0068] In this solution, during regression test analysis, the affected business tracking number can be executed to analyze whether the test case is invalid, i.e., whether the target component service code corresponding to the target component's hierarchical call relationship can be found in the component hierarchy call relationship database. Only newly added component service codes will not be found. The newly added component service codes will not be used to trace the target interface (or a specific test case). If existing code undergoes a regional code change, its component service code is directly obtained, and the target interface (or a specific test case) is traced through the call relationship. If newly added code generates a new component service code, this new component service code, which is the code mapped to its parent component code, is called. The code region will definitely change. Obtain the component service code corresponding to the code change in this region to trace the target interface. There is no need to use the newly generated component service code. If the component service code is deleted, the same applies. The upper-level caller's code region will definitely delete the call to this component, causing code changes. Just identify the upper-level caller's component service code. If the database table is changed, the ID of the changed database table will be identified. The component service code that operates on the database table in the code will record this ID information. Identify the component service code with this ID information to trace the target interface or test case. The test case is affected. If it fails, the original call relationship generated for the test case will be deleted. Otherwise, it will be re-executed and a new call relationship will be generated.
[0069] Additionally, new combined call relationships can be generated incrementally and iteratively based on the affected transaction codes by adding test cases for analysis.
[0070] Specifically, the solution in this application first generates a component-level call relationship library based on a dynamic code business call chain, reducing redundant call relationships through code execution. Second, it maps region codes to unique component service codes, such as using component service codes to annotate the implementation class regions of interface methods, thus shifting the focus away from internal function call relationships and towards the combined call relationships between interfaces, reducing the complexity of the call chain. Finally, it maps region codes and entity information (data tables) to component service codes, allowing the parsing of component service code information to obtain code hierarchy information, module information, and operation entity information, which is used to locate the component service codes affected by database entity changes. Therefore, modifications to codes within a region can locate unique component service codes, and database entity changes can obtain component service codes in the data access layer, thereby tracing the affected transaction names and business test cases through the component-level call relationship library.
[0071] This solution generates a component-level call relationship library by dynamically analyzing transaction codes for automated business scenario cases. By recording regional code mappings, hierarchical structure divisions, and entity operation information through component service codes, it becomes possible to identify affected service transactions and business case numbers by tracing the affected component service codes in the event of changes in regional codes or database entities. By combining business test case numbers with component call relationships, it effectively filters potentially impactful test cases, improving regression testing efficiency.
[0072] By adopting an iterative and incremental approach, a component-level call relationship library is generated based on business scenario instances, reducing the establishment of redundant call relationships. The region code and database entity information are uniquely marked by the component service code. By identifying the affected component service codes caused by changes in region codes and database entities, the affected service transactions can be traced. This can be used to assess the scope impact of changes, fix business test cases, and reduce the number of regression test transaction interfaces.
[0073] Specifically, the solution proposed in this application adopts an incremental and iterative approach. It annotates regional codes through component service codes, collects and combines call relationship chains based on business scenario automated test cases to form a component-level call relationship library, identifies the component service codes affected by regional code changes or database entity changes, and traces the affected service transactions and business case numbers in the component-level call relationship library. This improves the efficiency and accuracy of business regression testing and provides the selection of the business regression scope.
[0074] To enable those skilled in the art to better understand the technical solution of this application, the implementation process of the regression testing method based on call relationship of this application will be described in detail below with reference to specific embodiments.
[0075] This embodiment relates to a specific method for regression testing based on call relationships, such as... Figure 5 As shown, it includes the following steps:
[0076] Step S1: Annotation of component service codes. Component service codes uniquely map to the implementation class area of interface methods in the code and will be annotated in areas such as interface definition methods and implementation classes. Component service code composition rules: Hierarchical information + module aggregation / entity number + query / maintenance class identifier code + sequence number.
[0077] Step S2: Execute business automated test cases (a set of request parameters based on business scenarios, each case has a unique business tracking number). As relatively complete test cases, automated test cases basically cover business scenarios and can be used as the basis for building the initial combined call relationship library. When performing regression test analysis, test cases can be quickly located based on business tracking number and transaction code, thus improving regression test efficiency.
[0078] Step S3: Use Skywalking technology to proxy monitoring and information tracking, record service transaction call chain related information, and store the data in the format of (business tracking number, parent ID, horizontal ID, component service code).
[0079] Step S4: Since each business case execution generates a link call relationship, the business call chain information will be integrated and deduplicated according to the component level information to form a component level call relationship. The data storage format is (business tracking number, transaction code, hierarchy, [component service code|component service code]). When all case link relationships are integrated, a component level call relationship library is formed.
[0080] Step S5: If it is a change in the region code, obtain the component service code mapping area to which the difference code belongs before and after the iteration is processed by a distributed version control system, and identify the component service code to which the code belongs; if it is a change in the database entity, the entity ID will be mapped in the component service code information, and the component service code related to the operation of the entity will be located by the entity ID and the hierarchical information (data access layer).
[0081] Step S6: Based on the affected component service code, retrieve the affected case business tracking number and transaction code from the component-level call relationship database. By combining the business test case number with the component call relationship, test cases are effectively filtered, improving regression testing efficiency.
[0082] Step S7: Regression test analysis. Analyze whether the regression test cases for the affected business tracking numbers are invalid. If invalid, delete the call relationship. At the same time, based on the affected transaction codes, incrementally iterate and generate new combined call relationships by adding test cases for analysis.
[0083] This application also provides an apparatus for regression testing based on call relationships. It should be noted that the apparatus for regression testing based on call relationships in this application can be used to execute the method for regression testing based on call relationships provided in this application. This apparatus is used to implement the above embodiments and preferred embodiments; details already described will not be repeated. As used below, the term "module" can refer to a combination of software and / or hardware that implements a predetermined function. Although the apparatus described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.
[0084] The following describes the apparatus for regression testing based on call relationships provided in the embodiments of this application.
[0085] Figure 6 This is a structural block diagram of an apparatus for regression testing based on call relationships, according to an embodiment of this application. Figure 6 As shown, the device includes:
[0086] The first acquisition unit 100 is used to acquire multiple test cases, which are used to test the target object;
[0087] The second acquisition unit 200 is used to acquire the call relationship, wherein the call relationship is the call relationship generated during the execution of the test case or the call relationship between two test cases.
[0088] The generation unit 300 is used to generate component service codes when the target object changes, wherein the target object is a database table and / or software code, and the component service codes correspond one-to-one with the changed target object.
[0089] The first determining unit 400 is used to determine the target calling interface according to the component service code, and to call the target calling relationship according to the target calling interface, wherein the number of the target calling relationships is less than or equal to the number of the calling relationships, and the target calling relationship is the calling relationship affected by the change of the target object;
[0090] The second determining unit 500 is used to determine target test cases based on the above target call relationship, so as to perform regression testing based on the above target test cases, wherein the number of above target test cases is less than or equal to the number of above test cases, and the above target test cases are the test cases affected by changes in the above target object.
[0091] This embodiment first extracts the call relationships between test cases. If subsequent changes occur to the data table and / or code, a component service code can be generated. This component service code is used to map the changed data table and / or code. If existing code undergoes a region change, its component service code is directly obtained (without being generated again) to trace the target interface. If new code is added, a new component service code is generated. This new component service code is then called, meaning the code region mapped by its parent component code has definitely changed. The component service code corresponding to this code region change is obtained to trace the target interface; the newly generated component service code is not needed. If a component service code is deleted, the same applies; the code region of the parent caller will definitely be deleted, and the component service code called by the parent is identified. If it is a data table or / or code change... According to database table changes, the ID of the changed database table will be identified. The component service code that operates on the database table in the code will record this ID information. The component service code with this ID information is identified to trace the target interface or test case. The target call interface can be used to call the call relationship between test cases. This way, only the affected call relationship can be called, and the unaffected non-target call relationship will not be used. This can avoid redundancy or too many call relationships. At the same time, whether it is a database table change or a code change, it can be identified when the change occurs. Therefore, this solution can identify the interface. Furthermore, in regression testing, the target test case can be determined based on the target call relationship. This way, regression testing can be performed only on the affected test cases, which improves the efficiency and reliability of regression test analysis.
[0092] If there are multiple and relatively scattered call relationships, a management tool can be used to organize and manage them. This management tool can be a call relationship library. In specific implementation, the above-mentioned device also includes a testing unit and a first construction unit. The testing unit is used to perform testing work based on multiple test cases before obtaining the call relationships and to obtain test information. The test information is the information on the execution order and relationship of the multiple test cases during the testing process. The first construction unit is used to construct a call relationship library based on the test information. The call relationship library includes the call relationships and the business tracking numbers of the test cases. The business tracking numbers are used to track and locate the test cases.
[0093] In this solution, business automated test cases can be executed (a set of request parameters based on business scenarios, each case has a unique business tracking number). As a relatively complete set of test cases, the automated test cases basically cover the business scenarios and can serve as the basis for building the initial combined call relationship library. When performing regression test analysis, the test cases can be quickly located based on the business tracking number and transaction code, thereby further improving the efficiency of regression testing.
[0094] To determine software code version changes and track software code entity changes, and further generate component service codes based on the software code changes, the generation unit includes a first acquisition module, a first comparison module, a determination module, and a first generation module. The first acquisition module, when the target object is the software code, acquires the software code submitted for the Nth submission and the software code submitted for the (N+1)th submission, where N ≥ 1. The first comparison module compares whether the software code submitted for the Nth submission and the software code submitted for the (N+1)th submission are the same. The determination module, when the software code submitted for the Nth submission and the software code submitted for the (N+1)th submission are different, determines that portions of the different software code submitted for the Nth submission and at least a portion of the different software code submitted for the (N+1)th submission are difference code regions. The first generation module generates the component service codes based on the difference code regions, wherein the component service codes are mapped to the difference code regions.
[0095] In this scheme, if the change is in the region code (software code), the component service code mapping region to which the difference code belongs can be obtained by using a distributed version control system to process the difference code region before and after the iteration. The component service code to which the code belongs can be identified. In this way, the component service code corresponding to the changed software code can be generated when the software code changes. Then, the affected test cases can be found based on the changed software code, thereby improving the efficiency and reliability of regression test analysis.
[0096] To determine the structural changes of the database tables and then generate component service codes based on these changes, the generation unit includes a second acquisition module, a second comparison module, and a second generation module. The second acquisition module, when the target object is the database table, acquires the table structure of the Nth saved table and the table structure of the (N+1)th saved table. The second comparison module compares whether the table structures of the Nth saved table and the (N+1)th saved table are the same. The second generation module, when the table structures of the Nth saved table and the (N+1)th saved table are different, generates the component service codes based on the IDs of the Nth saved table and the (N+1)th saved table, wherein the component service codes are mapped to the IDs of the Nth saved table and the (N+1)th saved table.
[0097] In this solution, if a database entity (data table structure) changes, the entity ID is mapped to the component service code information. The component service code related to the operation of the entity is located by the entity ID and the hierarchical information (data access layer). In this way, when the table structure changes, the component service code corresponding to the changed table structure can be generated. Subsequently, the affected test cases can be found based on the changed table structure, thereby improving the efficiency and reliability of regression test analysis.
[0098] There are calling relationships between test cases, and implementing test cases requires running microservice components. Therefore, the calling relationships between microservice components can also be determined. In some embodiments, the above-mentioned apparatus further includes a third acquisition unit, a third determination unit, and a second construction unit. The third acquisition unit is used to acquire multiple microservice components after acquiring the calling relationships, wherein the microservice components are used to perform test work according to the test cases. The third determination unit is used to determine the component-level calling relationship according to the calling relationships, wherein the component-level calling relationship is the calling relationship between two of the microservice components or the relationship between the microservice component and the aggregation component. The second construction unit is used to construct a component-level calling relationship library according to the component-level calling relationship, wherein the component-level calling relationship library includes the component-level calling relationship, business tracking number, and transaction code, wherein the transaction code is the code of the transaction that implements the business request, and the business request corresponds to at least one of the test cases.
[0099] In this solution, each business case execution generates a call chain relationship. This business call chain information is integrated and deduplicated based on the component hierarchy information to form a component hierarchy call relationship. When all case call chains are integrated, a component hierarchy call relationship library is formed. This allows the hierarchical call relationships between microservice components to be stored. As a result, the affected microservice components can be identified based on the hierarchical call relationships between microservice components. Subsequently, regression testing can be performed on the affected microservice components, thereby further improving the efficiency and reliability of regression testing analysis.
[0100] In some embodiments, the second determining unit includes a search module and a filtering module. The search module is used to search for a target business tracking number and a target transaction code in the component-level call relationship database according to the target call relationship. The target business tracking number is the business tracking number affected by changes to the target object, and the target transaction code is the transaction code affected by changes to the target object. The filtering module is used to filter out the test cases that are not affected by changes to the target object based on the target business tracking number and the target transaction code, thereby obtaining the target test cases.
[0101] In this solution, the affected component service code is used to retrieve the affected case business tracking number and transaction code from the component-level call relationship database. By combining the business test case number with the component call relationship, test cases can be effectively filtered, further improving regression testing efficiency.
[0102] In the specific implementation process, the aforementioned component-level call relationship database also includes the aforementioned component service codes, and the aforementioned component service codes correspond one-to-one with the aforementioned component-level call relationships. The aforementioned device also includes an extraction unit, a search unit, and a processing unit. The extraction unit is used to extract the target component service code after determining the target test case based on the aforementioned target call relationship, wherein the aforementioned target component service code is one of multiple aforementioned component service codes. The search unit is used to search for the target component-level call relationship corresponding to the aforementioned target component service code in the aforementioned component-level call relationship database. The processing unit is used to retain the aforementioned target component-level call relationship if the aforementioned target component service code is found, and to delete the aforementioned target component-level call relationship if the aforementioned target component service code is not found.
[0103] In this solution, during regression test analysis, the affected business tracking number can be executed to analyze whether the test case is invalid, i.e., whether the target component service code corresponding to the target component's hierarchical call relationship can be found in the component hierarchy call relationship database. Only newly added component service codes will not be found. The newly added component service codes will not be used to trace the target interface (or a specific test case). If existing code undergoes a regional code change, its component service code is directly obtained, and the target interface (or a specific test case) is traced through the call relationship. If newly added code generates a new component service code, this new component service code, which is the code mapped to its parent component code, is called. The code region will definitely change. Obtain the component service code corresponding to the code change in this region to trace the target interface. There is no need to use the newly generated component service code. If the component service code is deleted, the same applies. The upper-level caller's code region will definitely delete the call to this component, causing code changes. Just identify the upper-level caller's component service code. If the database table is changed, the ID of the changed database table will be identified. The component service code that operates on the database table in the code will record this ID information. Identify the component service code with this ID information to trace the target interface or test case. The test case is affected. If it fails, the original call relationship generated for the test case will be deleted. Otherwise, it will be re-executed and a new call relationship will be generated.
[0104] The aforementioned regression testing apparatus based on call relationships includes a processor and a memory. The first acquisition unit, second acquisition unit, generation unit, first determination unit, and second determination unit are all stored as program units in the memory. The processor executes these program units stored in the memory to achieve the corresponding functions. All of the above modules reside in the same processor; alternatively, the modules may be located in different processors in any combination.
[0105] The processor contains a kernel, which retrieves the corresponding program units from memory. One or more kernels can be configured, and adjusting kernel parameters can improve the efficiency and reliability of regression test analysis.
[0106] The memory may include non-permanent memory in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM, and the memory includes at least one memory chip.
[0107] This invention provides a computer-readable storage medium including a stored program, wherein, when the program is executed, it controls the device where the computer-readable storage medium is located to perform the aforementioned method for regression testing based on call relationships.
[0108] This invention provides a processor for running a program, wherein the program executes the aforementioned method for regression testing based on call relationships.
[0109] This application also provides a regression testing system, including one or more processors, a memory, and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, and the one or more programs include a method for performing any of the above-described call-based regression tests.
[0110] This invention provides a device including a processor, a memory, and a program stored in the memory and executable on the processor. When the processor executes the program, it implements method steps for regression testing based on call relationships. The device described herein can be a server, PC, tablet, mobile phone, etc.
[0111] This application also provides a computer program product that, when executed on a data processing device, is adapted to perform method steps for initializing regression tests with at least a call relationship.
[0112] It is obvious to those skilled in the art that the modules or steps of the present invention described above can be implemented using general-purpose computing devices. They can be centralized on a single computing device or distributed across a network of multiple computing devices. They can be implemented using computer-executable program code, and thus can be stored in a storage device for execution by a computing device. In some cases, the steps shown or described can be performed in a different order than those described herein, or they can be fabricated as separate integrated circuit modules, or multiple modules or steps can be fabricated as a single integrated circuit module. Thus, the present invention is not limited to any particular combination of hardware and software.
[0113] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0114] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0115] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0116] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0117] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0118] Memory may include non-persistent memory in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.
[0119] Computer-readable media includes both permanent and non-permanent, removable and non-removable media that can store information using any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic magnetic disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.
[0120] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.
[0121] As can be seen from the above description, the embodiments of this application achieve the following technical effects:
[0122] 1) The regression testing method based on call relationships in this application first extracts the call relationships between test cases. When subsequent changes occur to the data table and / or code, a component service code can be generated. This component service code is used to map the changed data table and / or code. If the region change is made to existing code, its component service code is directly obtained (without being generated again) to trace the target interface. If new code is added, a new component service code is generated. This new component service code is then called, meaning the code region mapped by its parent component code has definitely changed. The component service code corresponding to this code region change is obtained to trace the target interface; the newly generated component service code is not needed. If a component service code is deleted, the same applies; the code region of the parent caller will definitely be deleted. The component service code of the parent caller is identified. The code is sufficient; if it's a database table change, the ID of the changed database table will be identified. The component service code that operates on that database table will record this ID information. The component service code with this ID information is identified to trace the target interface or test case. The target call interface can be used to call the call relationship between test cases. This way, only the affected call relationship can be called, and the unaffected non-target call relationship will no longer be used. This can avoid redundancy or too many call relationships. At the same time, whether it is a database table change or a code change, it can be identified when the change occurs. Therefore, this solution can identify the interface. Furthermore, during regression testing, the target test case can be determined based on the target call relationship. This way, regression testing can be performed only on the affected test cases, improving the efficiency and reliability of regression test analysis.
[0123] 2) The regression testing apparatus based on call relationships in this application first extracts the call relationships between test cases. If subsequent changes occur to the data table and / or code, a component service code can be generated. This component service code is used to map the changed data table and / or code. If existing code undergoes a region change, its component service code is directly obtained (without being generated again) to trace the target interface. If new code is added, a new component service code is generated. This new component service code is then called, meaning the code region mapped by its parent component code has definitely changed. The component service code corresponding to this code region change is obtained to trace the target interface; the newly generated component service code is not needed. If a component service code is deleted, similarly, the code region of the parent caller will definitely be deleted. The component service code of the parent caller is identified. The code is sufficient; if it's a database table change, the ID of the changed database table will be identified. The component service code that operates on that database table will record this ID information. The component service code with this ID information is identified to trace the target interface or test case. The target call interface can be used to call the call relationship between test cases. This way, only the affected call relationship can be called, and the unaffected non-target call relationship will no longer be used. This can avoid redundancy or too many call relationships. At the same time, whether it is a database table change or a code change, it can be identified when the change occurs. Therefore, this solution can identify the interface. Furthermore, during regression testing, the target test case can be determined based on the target call relationship. This way, regression testing can be performed only on the affected test cases, improving the efficiency and reliability of regression test analysis.
[0124] The above description is merely a preferred embodiment of this application and is not intended to limit this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.
Claims
1. A regression testing method based on call relationships, characterized in that, include: Obtain multiple test cases, which are used to test the target object; Obtain the call relationship, wherein the call relationship is a call relationship generated during the execution of the test case or a call relationship between two test cases; In the event of a change in the target object, component service code is generated, wherein the target object is a database table and / or software code, and the component service code corresponds one-to-one with the changed target object; The target call interface is determined based on the component service code, and the target call relationship is called based on the target call interface. The number of target call relationships is less than or equal to the number of call relationships. The target call relationship is the call relationship affected by the change of the target object. Target test cases are determined based on the target call relationship so that regression testing can be performed based on the target test cases. The number of target test cases is less than or equal to the number of test cases. The target test cases are the test cases that are affected by changes to the target object. When the target object is the software code, and when the target object changes, generating component service code includes: obtaining the software code submitted for the Nth time and the software code submitted for the (N+1)th time, where N≥1; comparing whether the software code submitted for the Nth time and the software code submitted for the (N+1)th time are the same; if the software code submitted for the Nth time and the software code submitted for the (N+1)th time are different, determining that the portion of the software code submitted for the Nth time that is different from at least a portion of the software code submitted for the (N+1)th time is a difference code region; generating the component service code based on the difference code region, wherein the component service code is mapped to the difference code region; When the target object is the data table of the database, and when the target object changes, generating a component service code includes: obtaining the table structure of the data table saved for the Nth time and the table structure of the data table saved for the (N+1)th time; comparing whether the table structure of the data table saved for the Nth time and the table structure of the data table saved for the (N+1)th time are the same; and if the table structure of the data table saved for the Nth time and the table structure of the data table saved for the (N+1)th time are different, generating the component service code based on the ID of the data table saved for the Nth time and the ID of the data table saved for the (N+1)th time, wherein the component service code is mapped to the ID of the data table saved for the Nth time and the ID of the data table saved for the (N+1)th time.
2. The method according to claim 1, characterized in that, Before obtaining the call relationship, the method also includes: The test work is performed based on multiple test cases, and test information is obtained, wherein the test information is the information on the order and relationship of the execution of multiple test cases during the test process; A call relationship database is constructed based on the test information. The call relationship database includes the call relationship and the business tracking number of the test case. The business tracking number is used to track and locate the test case.
3. The method according to claim 1, characterized in that, After obtaining the call relationship, the method further includes: Obtain multiple microservice components, wherein the microservice components are used to perform test tasks according to the test cases; The component-level call relationship is determined based on the call relationship, wherein the component-level call relationship is the call relationship between two microservice components or the relationship between a microservice component and an aggregation component; A component-level call relationship library is constructed based on the component-level call relationship. The component-level call relationship library includes the component-level call relationship, business tracking number, and transaction code. The transaction code is the code of the transaction that implements the business request, and the business request corresponds to at least one of the test cases.
4. The method according to claim 3, characterized in that, The target test cases are determined based on the target call relationship, including: Based on the target call relationship, the target business tracking number and target transaction code are searched in the component-level call relationship database, wherein the target business tracking number is the business tracking number affected by the change of the target object, and the target transaction code is the transaction code affected by the change of the target object; Based on the target business tracking number and the target transaction code, filter out the test cases that are unaffected by changes to the target object to obtain the target test cases.
5. The method according to claim 3, characterized in that, The component-level call relationship database also includes the component service code, and the component service code corresponds one-to-one with the component-level call relationship. After determining the target test case based on the target call relationship, the method further includes: Extract the target component service code, wherein the target component service code is one of a plurality of component service codes; Search the target component hierarchical call relationship corresponding to the target component service code in the component hierarchy call relationship database; If the target component service code is found to correspond to the target component hierarchical call relationship, the target component hierarchical call relationship is retained; if the target component service code is not found to correspond to the target component hierarchical call relationship, the target component service code is deleted.
6. An apparatus for regression testing based on call relationships, characterized in that, include: The first acquisition unit is used to acquire multiple test cases, which are used to test the target object; The second acquisition unit is used to acquire the call relationship, wherein the call relationship is the call relationship generated during the execution of the test case or the call relationship between two test cases; A generation unit is configured to generate component service codes when the target object changes, wherein the target object is a database table and / or software code, and the component service codes correspond one-to-one with the changed target object; The first determining unit is configured to determine a target calling interface based on the component service code, and call a target calling relationship based on the target calling interface, wherein the number of target calling relationships is less than or equal to the number of calling relationships, and the target calling relationship is the calling relationship affected by the change of the target object; The second determining unit is configured to determine target test cases based on the target call relationship, so as to perform regression testing based on the target test cases, wherein the number of target test cases is less than or equal to the number of test cases, and the target test cases are the test cases affected by changes to the target object; The generation unit includes a first acquisition module, a first comparison module, a determination module, and a first generation module. The first acquisition module is used to acquire the software code submitted for the Nth time and the software code submitted for the (N+1)th time when the target object is the software code, where N≥1. The first comparison module is used to compare whether the software code submitted for the Nth time and the software code submitted for the (N+1)th time are the same. The determination module is used to determine, when the software code submitted for the Nth time and the software code submitted for the (N+1)th time are different, the different parts of a portion of the software code submitted for the Nth time and at least a portion of the software code submitted for the (N+1)th time are different as a difference code region. The first generation module is used to generate the component service code based on the difference code region, wherein the component service code is mapped to the difference code region. The generation unit includes a second acquisition module, a second comparison module, and a second generation module. The second acquisition module is used to acquire the table structure of the data table saved for the Nth time and the table structure of the data table saved for the N+1th time when the target object is the data table of the database. The second comparison module is used to compare whether the table structure of the data table saved for the Nth time and the table structure of the data table saved for the N+1th time are the same. The second generation module is used to generate the component service code based on the ID of the data table saved for the Nth time and the ID of the data table saved for the N+1th time when the table structure of the data table saved for the Nth time and the table structure of the data table saved for the N+1th time are different, wherein the component service code is mapped to the ID of the data table saved for the Nth time and the ID of the data table saved for the N+1th time.
7. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes a stored program, wherein, when the program is executed, it controls the device on which the computer-readable storage medium is located to perform the method of regression testing based on call relationships as described in any one of claims 1 to 5.
8. A regression testing system, characterized in that, include: One or more processors, a memory, and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, the one or more programs including instructions for performing the method of call-based regression testing as described in any one of claims 1 to 5.
Citation Information
Patent Citations
Call relation dependence graph based regression testing method and system
CN103699488A
Regression test method and test device for JAVA program
CN114816984A
