Information recording method, apparatus, device, storage medium, and program product

CN115629986BActive Publication Date: 2026-08-11CHINA CONSTRUCTION BANK +1
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-10-31
Publication Date
2026-08-11

AI Technical Summary

Benefits of technology

[0028]本发明实施例中,接收客户端发送的当前测试案例对应的包含当前测试案例的案例标识的业务测试请求,基于业务测试请求执行待测试应用程序中用于响应业务测试请求的第一目标程序代码中的第一代码模块,以通过第一代码模块中包含的预先插入的插桩代码记录案例标识与当前第一代码模块的模块标识的关联关系,相当于通过第一代码模块中包含的预先插入的插桩代码准确高效地构建测试案例的案例标识与第一代码模块的模块标识的映射关系,也即实现了准确高效的构建测试案例与应用程序中代码模块的映射关系,从而在应用程序发生变更后,可以基于该映射关系确定应用程序中变更的代码模块对应的测试案例,进而使用该测试案例对变更后的应用程序进行测试,有效提高了精准测试的测试效率。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115629986B_ABST
    Figure CN115629986B_ABST
Patent Text Reader

Abstract

This invention discloses an information recording method, apparatus, device, storage medium, and program product. This invention relates to the field of artificial intelligence. The method includes: receiving a business test request sent by a client, which contains a case identifier corresponding to the current test case; executing first target program code in the application under test for responding to the business test request based on the business test request; the first target program code includes at least one first code module, each first code module containing pre-inserted instrumentation code, the instrumentation code being used to record the association between the case identifier and the module identifier of the current first code module. The technical solution of this invention achieves accurate and efficient construction of a mapping relationship between test cases and code modules in the application, and determines the test case corresponding to a changed code module in the application based on this mapping relationship, so as to use the test case to test the changed application, thereby improving the testing efficiency of accurate testing.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present invention relate to the field of artificial intelligence, and in particular to an information recording method, apparatus, device, storage medium and program product. Background Technology

[0002] As financial transactions become increasingly complex, the related software code logic also becomes more intricate, resulting in a larger and larger codebase. Furthermore, the software's functionality requires continuous improvement and optimization, necessitating ongoing code modifications.

[0003] Currently, precise testing is gaining increasing importance in the software testing industry; this involves testing only the changed features and code. Precise testing can significantly improve testing efficiency. However, conducting precise testing generally requires pre-establishing a mapping relationship between each test case and the classes and methods in the software—that is, determining which test case will trigger the execution of which classes and methods. When code changes, the classes and methods corresponding to the changed code are identified, and then, based on the previously established mapping relationship, the test cases that need to be executed are determined.

[0004] It is evident that how to accurately and efficiently construct the above mapping relationship is a problem that urgently needs to be solved. Summary of the Invention

[0005] This invention provides an information recording method, apparatus, device, storage medium, and program product to accurately and efficiently construct the mapping relationship between test cases and code modules in applications, thereby improving the testing efficiency of precision testing.

[0006] In a first aspect, embodiments of the present invention provide an information recording method applied to a server, the method comprising:

[0007] Receive a business test request sent by the client corresponding to the current test case; wherein, the business test request contains the case identifier of the current test case;

[0008] Based on the business test request, execute the first target program code in the application under test used to respond to the business test request;

[0009] The first target program code includes at least one first code module, and each first code module contains pre-inserted instrumentation code, which is used to record the association between the case identifier and the module identifier of the current first code module.

[0010] Secondly, embodiments of the present invention also provide an information recording method applied to a client, the method comprising:

[0011] Retrieve the case identifier of the current test case entered through the test interface;

[0012] Generate a business test request containing the case identifier; wherein, the business test request is the business request corresponding to the current test case;

[0013] The business test request is sent to the server so that the server executes the first target program code in the application under test to respond to the business test request; wherein the first target program code includes at least one first code module, each first code module contains pre-inserted instrumentation code, the instrumentation code being used to record the association relationship between the case identifier and the module identifier of the current first code module.

[0014] Thirdly, embodiments of the present invention also provide an information recording device configured on a server, the device comprising:

[0015] The request receiving module is used to receive a business test request corresponding to the current test case sent by the client; wherein, the business test request contains the case identifier of the current test case;

[0016] The request-response module is used to execute the first target program code in the application under test for responding to the business test request based on the business test request;

[0017] The first target program code includes at least one first code module, and each first code module contains pre-inserted instrumentation code, which is used to record the association between the case identifier and the module identifier of the current first code module.

[0018] Fourthly, embodiments of the present invention also provide an information recording device configured on a client, the device comprising:

[0019] The case identifier acquisition module is used to acquire the case identifier of the current test case entered through the test interface;

[0020] A request generation module is used to generate a business test request containing the case identifier; wherein, the business test request is the business request corresponding to the current test case;

[0021] A request sending module is used to send the business test request to the server, so that the server executes first target program code in the application under test to respond to the business test request based on the business test request; wherein, the first target program code includes at least one first code module, each first code module contains pre-inserted instrumentation code, the instrumentation code being used to record the association relationship between the case identifier and the module identifier of the current first code module.

[0022] Fifthly, embodiments of the present invention also provide an electronic device, the electronic device comprising:

[0023] At least one processor; and

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

[0025] The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the information recording method according to any embodiment of the present invention.

[0026] Sixthly, embodiments of the present invention also provide a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the information recording method as described in any of the embodiments of the present invention.

[0027] In a seventh aspect, embodiments of the present invention also provide a computer program product, including a computer program that, when executed by a processor, implements the information recording method as described in any of the embodiments of the present invention.

[0028] In this embodiment of the invention, a business test request containing a case identifier of the current test case is received from the client. Based on the business test request, a first code module in the first target program code of the application under test, which is used to respond to the business test request, is executed. The association between the case identifier and the module identifier of the current first code module is recorded through pre-inserted instrumentation code contained in the first code module. This is equivalent to accurately and efficiently constructing the mapping relationship between the case identifier of the test case and the module identifier of the first code module through the pre-inserted instrumentation code contained in the first code module. That is, it realizes the accurate and efficient construction of the mapping relationship between test cases and code modules in the application. Thus, after the application changes, the test case corresponding to the changed code module in the application can be determined based on the mapping relationship, and then the test case can be used to test the changed application, which effectively improves the testing efficiency of accurate testing. Attached Figure Description

[0029] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of the present invention and should not be regarded as a limitation on the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.

[0030] Figure 1 A flowchart illustrating the information recording method provided in an embodiment of the present invention;

[0031] Figure 2 A flowchart illustrating the association between the instrumentation code record case identifier in the entry code module and the module identifier of the current code module in an embodiment of the present invention;

[0032] Figure 3 A flowchart illustrating the association between the instrumentation code record case identifier in the business code module and the module identifier of the current code module, as provided in this embodiment of the invention.

[0033] Figure 4 This is a flowchart illustrating the association between the instrumentation code record case identifier and the module identifier of the current code module in the outbound call code module provided in this embodiment of the invention.

[0034] Figure 5 A schematic diagram of an information recording method provided in an embodiment of the present invention;

[0035] Figure 6 A flowchart illustrating an information recording method applied to a client according to an embodiment of the present invention;

[0036] Figure 7 A schematic diagram of an information recording device configured on a server according to an embodiment of the present invention;

[0037] Figure 8 A schematic diagram of an information recording device configured on a client side according to an embodiment of the present invention;

[0038] Figure 9 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. Detailed Implementation

[0039] The present invention will now be described in further detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and not intended to limit it. Furthermore, it should be noted that, for ease of description, the accompanying drawings show only the parts relevant to the present invention, and not all of the structures.

[0040] It should be noted that similar reference numerals and letters in the following figures indicate similar items; therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures. Furthermore, in the description of this invention, terms such as "first," "second," etc., are used only for distinguishing descriptions and should not be construed as indicating or implying relative importance. The acquisition, storage, use, and processing of data in the technical solution of this invention all comply with relevant national laws and regulations.

[0041] Figure 1This is a flowchart illustrating an information recording method provided in an embodiment of the present invention. The information recording method provided in this embodiment is applied to a server-side application and can be applied to precision testing in software testing. For example, before precision testing, it establishes a mapping relationship between test cases and classes and methods in the software to determine the test cases that need to be executed. This method can be executed by the information recording device in this embodiment of the present invention, which can be implemented in software and / or hardware. In a specific embodiment, the device can be integrated into an electronic device, such as a computer or server. The following embodiments will illustrate this using the integration of the device into an electronic device as an example. Figure 1 The method may specifically include the following steps:

[0042] S101, Receive the business test request corresponding to the current test case sent by the client; wherein, the business test request contains the case identifier of the current test case.

[0043] The business test request can be a Hypertext Transfer Protocol (HTTP) request, and the HTTP request header can include a test case identifier. The test case identifier can be understood as the test case number of the current test case.

[0044] Specifically, the client can obtain the case identifier of the current test case entered through the test interface, then generate a business test request containing the case identifier and send the business test request to the server. The server can receive the business test request corresponding to the current test case sent by the client.

[0045] For example, a business test request could be a user login request. The client can obtain the case identifier (Case_0) of the current test case entered through the test interface, then generate a user login request containing the case identifier and send it to the server. The server can receive the user login request sent by the client, which includes the case identifier (Case_0) corresponding to the current test case.

[0046] S102, Execute the first target program code in the application under test to respond to the business test request based on the business test request; wherein, the first target program code includes at least one first code module, each first code module contains pre-inserted instrumentation code, the instrumentation code is used to record the association relationship between the case identifier and the module identifier of the current first code module.

[0047] Here, the first target program code can be understood as the program code in the application under test that responds to business test requests; the code module can be understood as a method / function in the software, and the module identifier can include at least one of the following: the method / function name, the class name of the class containing the method / function, and the classpath of the class. The association between the case identifier and the module identifier of the current first code module can be understood as the correspondence between the module identifier of the current first code module and the case identifier.

[0048] Specifically, the first target program code in the application under test, used to respond to the business test request, can be executed based on the business test request. The association between the case identifier and the module identifier of the current first code module is recorded through pre-inserted instrumentation code in the first code module included in the first target program code. Specifically, the case identifier can be obtained from the business test request through the pre-inserted instrumentation code in the first code module, and the module identifier of the current first code module can be obtained through reflection.

[0049] For example, the first code module can be a method in the application under test that responds to a user login request, and the method name of this method can be Method0. The case identifier Case_0 can be obtained from the user login request by executing the pre-inserted instrumentation code contained in the method Method0. The module identifier Method0 of the current first code module can then be obtained through reflection, and the association between the case identifier (Case_0) and the module identifier Method0 of the current first code module can be recorded.

[0050] In some embodiments, the first code module may include an entry code module for receiving business test requests. Figure 2 This is a flowchart illustrating the association between the instrumentation code record case identifier in the entry code module and the module identifier of the current code module, as provided in this embodiment of the invention. Figure 2 As shown, the method may specifically include the following steps:

[0051] S201, Read the case identifier from the business test request and assign the case identifier to a preset local variable; where the preset local variable is a variable that the current thread can access.

[0052] For example, if the business test request is an HTTP request, the case identifier in the HTTP request is Case_1, and the default local variable is JDK ThreadLocal; the case identifier Case_1 can be read from the HTTP request and assigned to the variable JDK ThreadLocal that the current thread can access.

[0053] S202, read the case identifier from the preset local variable, and use reflection to obtain the module identifier of the entry code module.

[0054] For example, the entry code module can be a function used to receive HTTP requests, and the function name can be Method1. The case identifier Case_1 can be read from a pre-defined local variable by executing the pre-inserted instrumentation code contained in the Method1 method, and the module identifier Method1 of the entry code module can be obtained using reflection.

[0055] S203, store the read case identifier and the module identifier of the obtained entry code module in the preset association information table.

[0056] For example, by executing the pre-inserted instrumentation code contained in the Method1 method, the read case identifier Case_1 and the obtained entry code module's module identifier Method1 can be stored in a preset association information table.

[0057] In this embodiment, the case identifier is read from the business test request, assigned to a preset local variable, the case identifier is read from the preset local variable, and the module identifier of the entry code module is obtained using a reflection mechanism. The read case identifier and the obtained module identifier of the entry code module are stored in a preset association information table. This can more accurately and efficiently store the case identifier and the obtained module identifier of the entry code module in the preset association information table, thereby improving the accuracy of information recording.

[0058] The first code module in this embodiment also includes a business code module for executing business processing logic. Figure 3 This is a flowchart illustrating the association between the instrumentation code record case identifier in the business code module and the module identifier of the current code module, as provided in this embodiment of the invention. Figure 3 As shown, the method may specifically include the following steps:

[0059] S301 reads the case identifier from the preset local variable and uses reflection to obtain the module identifier of the business code module.

[0060] The preset local variables may include the case identifier of the current test case.

[0061] For example, the case identifier read from a preset local variable could be Case_1.

[0062] S302, store the read case identifier and the module identifier of the obtained business code module in the preset association information table.

[0063] For example, the business code module can be a function in the application under test that responds to a business test request, and the function name of this function can be Method2; the module identifier of the business code module can be the function name Method2 corresponding to the function in the application under test that responds to the business test request. The read case identifier Case_1 and the obtained module identifier Method2 of the business code module can be stored in a preset association information table by executing the pre-inserted instrumentation code contained in the Method2 method.

[0064] In this embodiment, the case identifier is read from a preset local variable, and the module identifier of the business code module is obtained using a reflection mechanism. The read case identifier and the obtained module identifier of the business code module are stored in a preset association information table, which can more accurately and efficiently store the case identifier and the obtained module identifier of the business code module in the preset association information table.

[0065] The first code module in this embodiment also includes an outbound call code module for sending outbound call requests. Figure 4 This is a flowchart illustrating the association between the instrumentation code record case identifier and the module identifier of the current code module in the outbound call code module provided in this embodiment of the invention. Figure 4 As shown, the method may specifically include the following steps:

[0066] S401 reads the case identifier from the preset local variable and uses reflection to obtain the module identifier of the outbound call code module.

[0067] For example, the case identifier can be read from a preset local variable as Case_1, and the module identifier Method3 of the outbound call code module can be obtained using reflection.

[0068] S402, store the read case identifier and the module identifier of the obtained outbound call code module in the preset association information table.

[0069] For example, the outbound call code module can be a function in the application under test that responds to a business test request; the module identifier of the outbound call code module can be the function name Method3 corresponding to the function in the application under test that responds to the business test request. The pre-inserted instrumentation code contained in the Method3 can be used to store the read case identifier Case_1 and the obtained outbound call code module's module identifier Method3, as well as the read case identifier Case_1 and the obtained business code module's module identifier Method2, and the read case identifier Case_1 and the obtained entry code module's module identifier Method1, into the preset association information table shown in Table 1.

[0070] Table 1 Preset Association Information Table

[0071] Case Identifier Module identifier Case 1 Method 1 Case 1 Method 2 Case 1 Method 3

[0072] In this embodiment, the case identifier is read from a preset local variable, and the module identifier of the outbound call code module is obtained using a reflection mechanism. The read case identifier and the obtained module identifier of the outbound call code module are stored in a preset association information table, which can more accurately and efficiently store the case identifier and the obtained module identifier of the outbound call code module in the preset association information table.

[0073] In this embodiment of the invention, a business test request containing a case identifier of the current test case is received from the client. Based on the business test request, a first code module in the first target program code of the application under test, which is used to respond to the business test request, is executed. The association between the case identifier and the module identifier of the current first code module is recorded through pre-inserted instrumentation code contained in the first code module. This is equivalent to accurately and efficiently constructing the mapping relationship between the case identifier of the test case and the module identifier of the first code module through the pre-inserted instrumentation code contained in the first code module. That is, it realizes the accurate and efficient construction of the mapping relationship between test cases and code modules in the application. Thus, after the application changes, the test case corresponding to the changed code module in the application can be determined based on the mapping relationship, and then the test case can be used to test the changed application, which effectively improves the testing efficiency of accurate testing.

[0074] In some embodiments, the association between the case identifier and the module identifier of the current first code module is recorded. Specifically, the association between the case identifier and the module identifier and the program identifier of the current application can be recorded. This allows for more accurate and efficient recording of the association between the case identifier and the module identifier and the program identifier of the current application. In precise testing, the case identifier of the test case to be executed can be determined more quickly based on the recorded association between the case identifier and the module identifier and the program identifier of the current application, thereby improving the testing efficiency and accuracy of precise testing.

[0075] For example, if the current application is APP1, the read case identifier Case_1, the obtained business code module identifier Method3, and the current application program identifier APP1 can be stored in a preset association information table.

[0076] In some embodiments, the instrumentation code in the outbound call code module can also be used for:

[0077] Add a case identifier to the outbound call request and send the outbound call request to other applications so that the other applications execute second target program code to respond to the outbound call request based on the outbound call request; wherein, the second target program code includes at least one second code module, each second code module contains pre-inserted instrumentation code, and the instrumentation code contained in the second code module is used to record the association relationship between the case identifier and the module identifier of the current second code module.

[0078] The second code module may include an entry code module, a business code module, and an outbound call code module; the specific method for associating the instrumentation code record case identifier contained in each code module with the module identifier of the current second code module is the same as the specific method for associating the instrumentation code record case identifier contained in the first code module with the module identifier of the current second code module.

[0079] For example, Figure 5 A schematic diagram of the information recording method provided in an embodiment of the present invention, such as... Figure 5 As shown, the application APP1 may include three first code modules: entry code module, business code module, and outbound call code module.

[0080] The entry point module in application APP1 can receive a business test request from the client, which includes a case identifier corresponding to the current test case. The entry point module can then read the case identifier from the business test request and assign it to a preset local variable. Next, the entry point module reads the case identifier from the preset local variable and uses reflection to obtain its own module identifier. Finally, the entry point module stores the read case identifier and the obtained module identifier in a preset association information table.

[0081] like Figure 5 As shown, there can be N business code modules, namely business code module 1...business code module N, where N is a positive integer. After the entry code module stores the read case identifier and the obtained module identifier of the entry code module in the preset association information table, business code module 1 in application APP1 reads the case identifier from the preset local variable, and uses reflection mechanism to obtain the module identifier of the business code module, and stores the read case identifier and the obtained module identifier of the business code module in the preset association information table.

[0082] like Figure 5As shown, after the business code module N stores the read case identifier and the obtained module identifier of the business code module in the preset association information table, if application APP1 needs to make an outbound call to APP2, the outbound call code module in application APP1 reads the case identifier from the preset local variable, and uses a reflection mechanism to obtain the module identifier of the outbound call code module. It then stores the read case identifier and the obtained module identifier of the outbound call code module in the preset association information table. Alternatively, a case identifier can be added to the outbound call request, and the outbound call request can be sent to APP2. This allows APP2 to execute the instrumentation code contained in each code module used to respond to the outbound call request, recording the association relationship between the case identifier and the module identifier of each current code module. The specific recording process is as follows: Figure 5 As shown.

[0083] The specific method for associating the instrumentation code record case identifiers with the module identifiers in each code module of APP2 is the same as that for associating the instrumentation code record case identifiers with the module identifiers in each code module of APP1, and will not be repeated here.

[0084] Accordingly, after application APP2 determines that an outbound call is needed, a case identifier can be added to the outbound call request, and the outbound call request can be sent to other applications so that other applications can execute the instrumentation code contained in each code module that responds to the outbound call request, in order to record the association between the case identifier and the module identifier of the current code module.

[0085] Table 2. Preset Association Information for Case Identifiers, Program Identifiers, and Module Identifiers

[0086] Case Identifier Program ID Classpath Class Name function name Case 1 App1 dir1 / dir2 Class1 Method 1 Case 1 App1 dir1 / dir2 Class1 Method 2 Case 1 APP1 dir1 / dir2 Class1 Method 1 Case 1 APP2 dir1 / dir2 / dir3 Class2 Method 2 … … … … …

[0087] Through the above Figure 5 The instrumentation code records the association between the case identifier and the module identifier of the current second code module, as well as the program identifier of the current application, in each code module of each application. This results in the preset association information table of case identifier, program identifier, and module identifier shown in Table 2.

[0088] As shown in Table 2, the program identifier corresponding to Case_1 is APP1, and the module identifier corresponding to Case_1 is the function name, the class name of the class containing the function, and the class path of the class. Among them, the function name is Method1, the class name of the class containing the function is Class1, and the class path of the class is dir1 / dir2.

[0089] In this embodiment, a case identifier is added to the outbound call request, and the outbound call request is sent to other applications. This allows other applications to execute second target program code to respond to the outbound call request. This enables other applications to accurately and efficiently construct the mapping relationship between the case identifier of the test case and the module identifier of the second code module through the pre-inserted instrumentation code contained in the second code module. This improves information recording efficiency and increases the flexibility of recording the mapping relationship information between the case identifier of the test case and the module identifier of the second code module. This solves the problem of low testing efficiency in precision testing due to the lack of pre-construction of the mapping relationship between test cases and classes and methods in the software, thereby improving the testing efficiency of precision testing.

[0090] In some embodiments, before receiving the business test request corresponding to the current test case sent by the client, the method further includes:

[0091] After detecting the compilation instructions of the application under test, the system obtains the preset instrumentation rules; determines the code modules in the application under test that need instrumentation code based on the preset instrumentation rules; obtains the instrumentation code corresponding to the type of the code module; and inserts the obtained instrumentation code into the preset position of the code module. This allows for faster determination of the code modules in the application under test that need instrumentation code based on the obtained preset instrumentation rules, and the insertion of the obtained instrumentation code into the preset position of the code module, thereby improving the efficiency of information recording.

[0092] Alternatively, after detecting the execution command of the application under test, for each code module executed during the execution of the application under test, obtain the preset instrumentation rules, determine whether the code module needs to be instrumented according to the preset instrumentation rules, and if so, obtain the instrumentation code corresponding to the type of the code module and insert the instrumentation code into the preset position of the code module.

[0093] Specifically, the code modules in the application under test that require instrumentation are determined according to preset instrumentation rules, including:

[0094] Step a1: Match the module identifiers of each code module in the application to be tested with the identifier feature information in the preset instrumentation rules.

[0095] The identifier feature information can be understood as the feature information corresponding to the module identifier of each code module in the preset instrumentation rules. The instrumentation rules can be either exact matching or fuzzy matching. For example, fuzzy matching can be achieved through preset regular expressions, which can include matching a single character, matching multiple characters, matching the beginning and the end, etc.

[0096] Step a2: Based on the matching results, determine the code modules in each code module that require instrumentation code.

[0097] Specifically, if the matching result is successful, it can be determined that the code module corresponding to the successfully matched module identifier is the code module into which instrumentation code needs to be inserted.

[0098] In this embodiment, the matching results of matching the module identifiers of each code module in the application under test with the identifier feature information in the preset instrumentation rules can be used to more accurately and quickly determine the code modules in each code module that need to be instrumented.

[0099] Specifically, it retrieves the instrumentation code corresponding to the type of the code module, including:

[0100] Step b1: Obtain the module characteristics of the code module and determine the type of the code module based on the module characteristics; wherein, the module characteristics include: module identifier and / or position in the call chain.

[0101] The code module types can include entry point code modules, business logic code modules, and outbound call code modules. Module identifiers can include the method / function names of the code module, as well as the class name of the class containing the method / function. The position in the call chain can be understood as the location of the code module's method / function within the call chain; this position can be at the beginning, middle, or end. For example, the entry point code module is at the beginning of the call chain, the business logic module's function is in the middle, and the outbound call code module is at the end. The call chain contains the call relationships and order between code modules.

[0102] Step b2: Read the instrumentation code corresponding to the type of the code module from the configuration file.

[0103] For example, the instrumentation rule can be an exact match; the module identifier of the entry code module is Method1, the module identifier of the business code module is Method2, and the module identifier of the outbound call code module is Method3; the identifier feature information in the preset instrumentation rule is Method2.

[0104] After detecting the compilation instructions of the application under test, the obtained preset instrumentation rule is an exact match. The module identifiers (Method1, Method2, Method3) of each code module in the application under test are matched against the identifier feature information (Method2) in the preset instrumentation rule. If the match is successful, the code module corresponding to the module identifier (Method2) is identified as the one requiring instrumentation. Then, the module feature of the code module corresponding to the module identifier (Method2) is obtained (the module identifier is Method2, and the code module's position in the call chain is in the middle). Based on the module identifier and its position in the call chain, the code module type is determined to be a business code module. The instrumentation code corresponding to the business code module type is read from the configuration file and inserted into the beginning or middle of the business code module.

[0105] In this embodiment, the module characteristics of the code module are obtained, and the type of the code module is determined based on the module characteristics. The module characteristics include: module identifier and / or position in the call chain. The instrumentation code corresponding to the type of the code module is read from the configuration file. Based on the module identifier and / or position in the call chain included in the module characteristics, the type of the code module can be accurately determined. Then, the instrumentation code corresponding to the type of the code module can be quickly read from the configuration file, which improves the insertion speed of inserting the instrumentation code into the preset position of the code module, thereby improving the efficiency and accuracy of information recording.

[0106] Figure 6 This is a flowchart illustrating an information recording method applied to a client according to an embodiment of the present invention. This information recording method is applied to a client and can be applied to precise testing in software testing. For example, before precise testing, the case identifier of the current test case is added to the business test request to facilitate the construction of a mapping relationship between test cases and classes and methods in the software. This method can be executed by the information recording device applied to the client according to this embodiment of the present invention, which can be implemented in software and / or hardware. In a specific embodiment, the device can be integrated into an electronic device, such as a computer or server. The following embodiments will illustrate this using the integration of the device into an electronic device as an example. Figure 6 The method may specifically include the following steps:

[0107] S601, obtain the case identifier of the current test case entered through the test interface.

[0108] S602, Generate a business test request containing a case identifier; wherein, the business test request is the business request corresponding to the current test case.

[0109] The business test request is an HTTP request, and the HTTP request header contains a case identifier.

[0110] S603, a business test request is sent to the server so that the server executes the first target program code in the application to be tested to respond to the business test request based on the business test request; wherein, the first target program code includes at least one first code module, each first code module contains pre-inserted instrumentation code, the instrumentation code is used to record the association relationship between the case identifier and the module identifier of the current first code module.

[0111] For example, if the business test request is a user login request, the case identifier of the current test case is Case_0. The system retrieves the case identifier Case_0, username, and password entered by the user through the test interface. It then adds these elements to the user login request, generating a user login request containing the case identifier (Case_0), username, and password. This user login request is then sent to the server, allowing the server to execute the first target program code in the application under test to respond to the user login request.

[0112] In this embodiment, the case identifier of the current test case input through the test interface is obtained, a business test request containing the case identifier is generated, and the business test request is sent to the server. The server then executes the first target program code in the application under test to respond to the business test request based on the business test request. This achieves accurate and efficient construction of the mapping relationship between the case identifier of the test case and the module identifier of the first code module through the pre-inserted instrumentation code contained in the first code module. This enables accurate and efficient construction of the mapping relationship between the test case and the code module in the application. Therefore, after the application changes, the test case corresponding to the changed code module in the application can be determined based on this mapping relationship, and the changed application can be tested using the test case, effectively improving the testing efficiency of accurate testing.

[0113] Figure 7 This is a schematic diagram of an information recording device configured on a server according to an embodiment of the present invention. This embodiment is applicable to precision testing in software testing, for example, establishing a mapping relationship between test cases and classes and methods in the software before precision testing, and determining the test cases to be executed. This device can be implemented in software and / or hardware, and can be integrated into electronic devices, such as… Figure 7 As shown, the information recording device specifically includes:

[0114] The request receiving module 701 is used to receive a business test request corresponding to the current test case sent by the client; wherein, the business test request includes the case identifier of the current test case;

[0115] Request response module 702 is used to execute first target program code in the application under test for responding to the business test request based on the business test request;

[0116] The first target program code includes at least one first code module, and each first code module contains pre-inserted instrumentation code, which is used to record the association between the case identifier and the module identifier of the current first code module.

[0117] Optionally, the first code module includes an entry code module for receiving the business test request;

[0118] The instrumentation code in the entry code module records the association between the case identifier and the module identifier of the current code module, including:

[0119] The case identifier is read from the business test request and assigned to a preset local variable; wherein, the preset local variable is a variable that the current thread can access;

[0120] The case identifier is read from the preset local variable, and the module identifier of the entry code module is obtained using reflection.

[0121] The read case identifier and the obtained entry code module identifier are stored in a preset association information table.

[0122] Optionally, the first code module further includes a business code module for executing business processing logic;

[0123] The instrumentation code in the business code module records the association between the case identifier and the module identifier of the current code module, including:

[0124] The case identifier is read from the preset local variable, and the module identifier of the business code module is obtained using reflection.

[0125] The read case identifier and the obtained business code module identifier are stored in a preset association information table.

[0126] Optionally, the first code module further includes an outbound call code module for sending outbound call requests;

[0127] The instrumentation code in the outbound call code module records the association between the case identifier and the module identifier of the current code module, including:

[0128] The case identifier is read from the preset local variable, and the module identifier of the outbound call code module is obtained using a reflection mechanism;

[0129] The case identifier read and the module identifier of the obtained outbound call code module are stored in a preset association information table.

[0130] Optionally, the instrumentation code in the outbound call code module is also used for:

[0131] The case identifier is added to the outbound call request, and the outbound call request is sent to other applications so that the other applications execute second target program code to respond to the outbound call request based on the outbound call request; wherein, the second target program code includes at least one second code module, each second code module contains pre-inserted instrumentation code, and the instrumentation code contained in the second code module is used to record the association relationship between the case identifier and the module identifier of the current second code module.

[0132] Optionally, the request-response module 702 records the association between the case identifier and the module identifier, including:

[0133] Record the association between the case identifier, the module identifier, and the program identifier of the current application.

[0134] Furthermore, the device also includes:

[0135] The first acquisition module is configured to, upon detecting compilation instructions for the application under test, acquire preset instrumentation rules; determine, according to the preset instrumentation rules, code modules in the application under test that require instrumentation code; acquire instrumentation code corresponding to the type of the code module; and insert the acquired instrumentation code into a preset position of the code module; or,

[0136] The second acquisition module is used to, after detecting the running instruction for the application under test, acquire preset instrumentation rules for each code module executed during the running process of the application under test, determine whether the code module needs to be instrumented according to the preset instrumentation rules, and if so, acquire the instrumentation code corresponding to the type of the code module and insert the instrumentation code into the preset position of the code module.

[0137] Optionally, the first acquisition module determines the code modules in the application to be tested that require instrumentation code based on the preset instrumentation rules, including:

[0138] The module identifiers of each code module in the application under test are matched with the identifier feature information in the preset instrumentation rules, and the code modules that need to be instrumented are determined according to the matching results.

[0139] Optionally, the first acquisition module or the second acquisition module acquires instrumentation code corresponding to the type of the code module, including:

[0140] Obtain the module characteristics of the code module, and determine the type of the code module based on the module characteristics; wherein, the module characteristics include: module identifier and / or position in the call chain;

[0141] Read the instrumentation code corresponding to the type of the code module from the configuration file.

[0142] Optionally, the business test request is a Hypertext Transfer Protocol (HTTP) request, and the case identifier is included in the request header of the HTTP request.

[0143] The information recording device provided in the embodiments of the present invention can execute the information recording method applied to the server provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the method execution.

[0144] Figure 8 This is a schematic diagram of an information recording device configured on a client side according to an embodiment of the present invention. This embodiment is applicable to precision testing in software testing, such as adding the case identifier of the current test case to the business test request before precision testing, to facilitate the establishment of a mapping relationship between test cases and classes and methods in the software before precision testing. This device can be implemented in software and / or hardware, and can be integrated into an electronic device, such as... Figure 8 As shown, the information recording device specifically includes:

[0145] The case identifier acquisition module 801 is used to acquire the case identifier of the current test case entered through the test interface;

[0146] The request generation module 802 is used to generate a business test request containing the case identifier; wherein, the business test request is the business request corresponding to the current test case;

[0147] The request sending module 803 is used to send the business test request to the server so that the server executes the first target program code in the application under test to respond to the business test request based on the business test request; wherein, the first target program code includes at least one first code module, each first code module contains pre-inserted instrumentation code, the instrumentation code is used to record the association relationship between the case identifier and the module identifier of the current first code module.

[0148] Optionally, the business test request is a Hypertext Transfer Protocol (HTTP) request, and the case identifier is included in the request header of the HTTP request.

[0149] The information recording device provided in the embodiments of the present invention can execute the information recording method applied to the client provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the method execution.

[0150] Figure 9 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. Figure 9 A block diagram is shown of an exemplary electronic device 12 suitable for implementing embodiments of the present invention. Figure 9 The electronic device 12 shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of the present invention.

[0151] like Figure 9 As shown, the electronic device 12 is represented in the form of a general-purpose computing device. The components of the electronic device 12 may include, but are not limited to: one or more processors or processing units 16, system memory 28, and bus 18 connecting different system components (including system memory 28 and processing unit 16).

[0152] Bus 18 represents one or more of several bus architectures, including a memory bus or memory controller, a peripheral bus, a graphics acceleration port, a processor, or a local bus using any of the various bus architectures. For example, these architectures include, but are not limited to, the Industry Standard Architecture (ISA) bus, the Micro Channel Architecture (MAC) bus, the Enhanced ISA bus, the Video Electronics Standards Association (VESA) local bus, and the Peripheral Component Interconnect (PCI) bus.

[0153] Electronic device 12 typically includes a variety of computer system readable media. These media can be any available media that can be accessed by electronic device 12, including volatile and non-volatile media, removable and non-removable media.

[0154] System memory 28 may include computer system readable media in the form of volatile memory, such as random access memory (RAM) 30 and / or cache memory 32. Electronic device 12 may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, storage system 34 may be used to read and write non-removable, non-volatile magnetic media (… Figure 9 Not shown; usually referred to as a "hard drive"). Although Figure 9Not shown, a disk drive for reading and writing to a removable non-volatile disk (e.g., a "floppy disk") and an optical disk drive for reading and writing to a removable non-volatile optical disk (e.g., a CD-ROM, DVD-ROM, or other optical media) may be provided. In these cases, each drive may be connected to bus 18 via one or more data media interfaces. Memory 28 may include at least one program product having a set (e.g., at least one) of program modules configured to perform the functions of the embodiments of the present invention.

[0155] A program / utility 40 having a set (at least one) of program modules 42 may be stored, for example, in memory 28. Such program modules 42 include—but are not limited to—an operating system, one or more application programs, other program modules, and program data. Each or some combination of these examples may include an implementation of a network environment. Program modules 42 typically perform the functions and / or methods described in the embodiments of the present invention.

[0156] Electronic device 12 can also communicate with one or more external devices 14 (e.g., keyboard, pointing device, display 24, etc.), and with one or more devices that enable a user to interact with electronic device 12, and / or with any device that enables electronic device 12 to communicate with one or more other computing devices (e.g., network card, modem, etc.). This communication can be performed via input / output (I / O) interface 22. Furthermore, in this embodiment, electronic device 12 and display 24 are not separate entities, but are embedded in a mirror, so that when the display surface of display 24 is not displayed, the display surface of display 24 and the mirror surface visually blend together. Additionally, electronic device 12 can also communicate with one or more networks (e.g., local area network (LAN), wide area network (WAN), and / or public networks, such as the Internet) via network adapter 20. As shown, network adapter 20 communicates with other modules of electronic device 12 via bus 18. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with electronic device 12, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.

[0157] The processing unit 16 executes various functional applications and data processing by running programs stored in the system memory 28. For example, it implements an information recording method for a server provided in this embodiment of the invention: receiving a business test request corresponding to the current test case sent by the client; wherein the business test request contains a case identifier of the current test case; executing first target program code in the application to be tested to respond to the business test request based on the business test request; wherein the first target program code includes at least one first code module, each first code module contains pre-inserted instrumentation code, the instrumentation code being used to record the association relationship between the case identifier and the module identifier of the current first code module. In this embodiment of the invention, a business test request containing a case identifier of the current test case is received from the client. Based on the business test request, a first code module in the first target program code of the application under test, which is used to respond to the business test request, is executed. The association between the case identifier and the module identifier of the current first code module is recorded through pre-inserted instrumentation code contained in the first code module. This is equivalent to accurately and efficiently constructing the mapping relationship between the case identifier of the test case and the module identifier of the first code module through the pre-inserted instrumentation code contained in the first code module. In other words, it realizes the accurate and efficient construction of the mapping relationship between test cases and code modules in the application. Thus, after the application changes, the test case corresponding to the changed code module in the application can be determined based on the mapping relationship, and then the test case can be used to test the changed application, effectively improving the testing efficiency of accurate testing. Alternatively, an information recording method for a client provided in this embodiment of the invention can be implemented as follows: obtaining the case identifier of the current test case input through the test interface; generating a business test request containing the case identifier; wherein the business test request is a business request corresponding to the current test case; sending the business test request to the server so that the server executes the first target program code in the application under test for responding to the business test request based on the business test request; wherein the first target program code includes at least one first code module, each first code module contains pre-inserted instrumentation code, the instrumentation code being used to record the association relationship between the case identifier and the module identifier of the current first code module.In this embodiment of the invention, the case identifier of the current test case input through the test interface is obtained, a business test request containing the case identifier is generated, and the business test request is sent to the server. The server then executes the first target program code in the application under test to respond to the business test request based on the business test request. This achieves accurate and efficient construction of the mapping relationship between the case identifier of the test case and the module identifier of the first code module through the pre-inserted instrumentation code contained in the first code module. This enables accurate and efficient construction of the mapping relationship between the test case and the code module in the application. Therefore, after the application is changed, the test case corresponding to the changed code module in the application can be determined based on the mapping relationship, and the changed application can be tested using the test case, effectively improving the testing efficiency of accurate testing.

[0158] This invention provides a computer-readable storage medium storing a computer program thereon. When executed by a processor, the program implements the information recording method for a server as provided in all embodiments of this invention: receiving a business test request corresponding to the current test case sent by a client; wherein the business test request includes a case identifier of the current test case; executing first target program code in the application under test for responding to the business test request based on the business test request; wherein the first target program code includes at least one first code module, each first code module including pre-inserted instrumentation code, the instrumentation code being used to record the association relationship between the case identifier and the module identifier of the current first code module. In this embodiment of the invention, a business test request containing a case identifier of the current test case is received from the client. Based on the business test request, a first code module in the first target program code of the application under test, which is used to respond to the business test request, is executed. The association between the case identifier and the module identifier of the current first code module is recorded through pre-inserted instrumentation code contained in the first code module. This is equivalent to accurately and efficiently constructing the mapping relationship between the case identifier of the test case and the module identifier of the first code module through the pre-inserted instrumentation code contained in the first code module. In other words, it realizes the accurate and efficient construction of the mapping relationship between test cases and code modules in the application. Thus, after the application changes, the test case corresponding to the changed code module in the application can be determined based on the mapping relationship, and then the test case can be used to test the changed application, effectively improving the testing efficiency of accurate testing. Alternatively, an information recording method for a client provided in this embodiment of the invention can be implemented as follows: obtaining the case identifier of the current test case input through the test interface; generating a business test request containing the case identifier; wherein the business test request is a business request corresponding to the current test case; sending the business test request to the server so that the server executes the first target program code in the application under test for responding to the business test request based on the business test request; wherein the first target program code includes at least one first code module, each first code module contains pre-inserted instrumentation code, the instrumentation code being used to record the association relationship between the case identifier and the module identifier of the current first code module.In this embodiment of the invention, the case identifier of the current test case input through the test interface is obtained, a business test request containing the case identifier is generated, and the business test request is sent to the server. The server then executes the first target program code in the application under test to respond to the business test request based on the business test request. This achieves accurate and efficient construction of the mapping relationship between the case identifier of the test case and the module identifier of the first code module through the pre-inserted instrumentation code contained in the first code module. This enables accurate and efficient construction of the mapping relationship between the test case and the code module in the application. Therefore, after the application is changed, the test case corresponding to the changed code module in the application can be determined based on the mapping relationship, and the changed application can be tested using the test case, effectively improving the testing efficiency of accurate testing.

[0159] Any combination of one or more computer-readable media may be used. A computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. A computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples (a non-exhaustive list) of computer-readable storage media include: an electrical connection having one or more wires, a portable computer disk, a hard disk, 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 device, magnetic storage device, or any suitable combination thereof. In this document, a computer-readable storage medium can be any tangible medium that contains or stores a program that can be used by or in connection with an instruction execution system, apparatus, or device.

[0160] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, capable of sending, propagating, or transmitting programs for use by or in connection with an instruction execution system, apparatus, or device.

[0161] Program code contained on a computer-readable medium may be transmitted using any suitable medium, including but not limited to wireless, wire, optical fiber, RF, etc., or any suitable combination thereof.

[0162] Computer program code for performing the operations of this invention can be written in one or more programming languages ​​or a combination thereof. Programming languages ​​include object-oriented programming languages ​​such as Java, Smalltalk, and C++, as well as conventional procedural programming languages ​​such as C or similar languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0163] This invention also provides a computer program product, including a computer program that, when executed by a processor, implements the information recording method provided in any embodiment of this application.

[0164] In implementing the computer program product, computer program code for performing the operations of this invention can be written in one or more programming languages ​​or a combination thereof. Programming languages ​​include object-oriented programming languages ​​such as Java, Smalltalk, and C++, as well as conventional procedural programming languages ​​such as C or similar languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0165] Note that the above description is merely a preferred embodiment of the present invention and the technical principles employed. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and various obvious changes, readjustments, and substitutions can be made without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in detail through the above embodiments, the present invention is not limited to the above embodiments, and may include many other equivalent embodiments without departing from the concept of the present invention, the scope of which is determined by the scope of the appended claims.

Claims

1. An information recording method, characterized in that, Applied to the server side, the method includes: Receive a business test request sent by the client corresponding to the current test case; wherein, the business test request contains the case identifier of the current test case; Based on the business test request, execute the first target program code in the application under test used to respond to the business test request; The first target program code includes at least one first code module, and each first code module contains pre-inserted instrumentation code, which is used to record the association between the case identifier and the module identifier of the current first code module; The first code module includes an entry code module for receiving the business test request; The instrumentation code in the entry code module records the association between the case identifier and the module identifier of the current code module, including: The case identifier is read from the business test request and assigned to a preset local variable; wherein, the preset local variable is a variable that the current thread can access; The case identifier is read from the preset local variable, and the module identifier of the entry code module is obtained using reflection. The read case identifier and the obtained entry code module identifier are stored in a preset association information table; The first code module further includes an outbound call code module for sending outbound call requests; The instrumentation code in the outbound call code module records the association between the case identifier and the module identifier of the current code module, including: The case identifier is read from the preset local variable, and the module identifier of the outbound call code module is obtained using a reflection mechanism; The case identifier read and the module identifier of the obtained outbound call code module are stored in a preset association information table; The instrumentation code in the outbound call code module is also used for: The case identifier is added to the outbound call request, and the outbound call request is sent to other applications so that the other applications execute second target program code to respond to the outbound call request based on the outbound call request; wherein, the second target program code includes at least one second code module, each second code module contains pre-inserted instrumentation code, and the instrumentation code contained in the second code module is used to record the association relationship between the case identifier and the module identifier of the current second code module.

2. The method according to claim 1, characterized in that, The first code module also includes a business code module for executing business processing logic; The instrumentation code in the business code module records the association between the case identifier and the module identifier of the current code module, including: The case identifier is read from the preset local variable, and the module identifier of the business code module is obtained using reflection. The read case identifier and the obtained business code module identifier are stored in a preset association information table.

3. The method according to any one of claims 1-2, characterized in that, The recording of the association between the case identifier and the module identifier includes: Record the association between the case identifier, the module identifier, and the program identifier of the current application.

4. The method according to any one of claims 1-2, characterized in that, Before receiving the business test request corresponding to the current test case sent by the client, the method further includes: After detecting compilation instructions for the application under test, a preset instrumentation rule is obtained; the code modules in the application under test that require instrumentation code are determined according to the preset instrumentation rule; the instrumentation code corresponding to the type of the code module is obtained; and the obtained instrumentation code is inserted into a preset position of the code module; or, After detecting the execution instruction for the application under test, for each code module executed during the execution of the application under test, a preset instrumentation rule is obtained. Based on the preset instrumentation rule, it is determined whether the code module needs to be instrumented. If so, the instrumentation code corresponding to the type of the code module is obtained and the instrumentation code is inserted into the preset position of the code module.

5. The method according to claim 4, characterized in that, The step of determining the code modules in the application to be tested that require instrumentation according to the preset instrumentation rules includes: The module identifiers of each code module in the application under test are matched with the identifier feature information in the preset instrumentation rules, and the code modules that need to be instrumented are determined according to the matching results.

6. The method according to claim 4, characterized in that, The step of obtaining the instrumentation code corresponding to the type of the code module includes: Obtain the module characteristics of the code module, and determine the type of the code module based on the module characteristics; wherein, the module characteristics include: module identifier and / or position in the call chain; Read the instrumentation code corresponding to the type of the code module from the configuration file.

7. The method according to any one of claims 1-2, characterized in that, The business test request is a Hypertext Transfer Protocol (HTTP) request, and the case identifier is included in the request header of the HTTP request.

8. An information recording method, characterized in that, Applied to a client, the method includes: Retrieve the case identifier of the current test case entered through the test interface; Generate a business test request containing the case identifier; wherein, the business test request is the business request corresponding to the current test case; The business test request is sent to the server so that the server executes the first target program code in the application under test to respond to the business test request; wherein, the first target program code includes at least one first code module, each first code module contains pre-inserted instrumentation code, the instrumentation code being used to record the association relationship between the case identifier and the module identifier of the current first code module; The first code module includes an entry code module for receiving the business test request; The instrumentation code in the entry code module records the association between the case identifier and the module identifier of the current code module, including: The case identifier is read from the business test request and assigned to a preset local variable; wherein, the preset local variable is a variable that the current thread can access; The case identifier is read from the preset local variable, and the module identifier of the entry code module is obtained using reflection. The read case identifier and the obtained entry code module identifier are stored in a preset association information table; The first code module further includes an outbound call code module for sending outbound call requests; The instrumentation code in the outbound call code module records the association between the case identifier and the module identifier of the current code module, including: The case identifier is read from the preset local variable, and the module identifier of the outbound call code module is obtained using a reflection mechanism; The case identifier read and the module identifier of the obtained outbound call code module are stored in a preset association information table; The instrumentation code in the outbound call code module is also used for: The case identifier is added to the outbound call request, and the outbound call request is sent to other applications so that the other applications execute second target program code to respond to the outbound call request based on the outbound call request; wherein, the second target program code includes at least one second code module, each second code module contains pre-inserted instrumentation code, and the instrumentation code contained in the second code module is used to record the association relationship between the case identifier and the module identifier of the current second code module.

9. The method according to claim 8, characterized in that, The business test request is a Hypertext Transfer Protocol (HTTP) request, and the case identifier is included in the request header of the HTTP request.

10. An information recording device, characterized in that, Configured on the server side, the device includes: The request receiving module is used to receive a business test request corresponding to the current test case sent by the client; wherein, the business test request contains the case identifier of the current test case; The request-response module is used to execute the first target program code in the application under test for responding to the business test request based on the business test request; The first target program code includes at least one first code module, and each first code module contains pre-inserted instrumentation code, which is used to record the association between the case identifier and the module identifier of the current first code module; The first code module includes an entry code module for receiving the business test request; The instrumentation code in the entry code module records the association between the case identifier and the module identifier of the current code module, including: The case identifier is read from the business test request and assigned to a preset local variable; wherein, the preset local variable is a variable that the current thread can access; The case identifier is read from the preset local variable, and the module identifier of the entry code module is obtained using reflection. The read case identifier and the obtained entry code module identifier are stored in a preset association information table; The first code module further includes an outbound call code module for sending outbound call requests; The instrumentation code in the outbound call code module records the association between the case identifier and the module identifier of the current code module, including: The case identifier is read from the preset local variable, and the module identifier of the outbound call code module is obtained using a reflection mechanism; The case identifier read and the module identifier of the obtained outbound call code module are stored in a preset association information table; The instrumentation code in the outbound call code module is also used for: The case identifier is added to the outbound call request, and the outbound call request is sent to other applications so that the other applications execute second target program code to respond to the outbound call request based on the outbound call request; wherein, the second target program code includes at least one second code module, each second code module contains pre-inserted instrumentation code, and the instrumentation code contained in the second code module is used to record the association relationship between the case identifier and the module identifier of the current second code module.

11. The apparatus according to claim 10, characterized in that, The device further includes: The first acquisition module is configured to, upon detecting compilation instructions for the application under test, acquire preset instrumentation rules; determine, according to the preset instrumentation rules, code modules in the application under test that require instrumentation code; acquire instrumentation code corresponding to the type of the code module; and insert the acquired instrumentation code into a preset position of the code module; or, The second acquisition module is used to, after detecting the running instruction for the application under test, acquire preset instrumentation rules for each code module executed during the running process of the application under test, determine whether the code module needs to be instrumented according to the preset instrumentation rules, and if so, acquire the instrumentation code corresponding to the type of the code module and insert the instrumentation code into the preset position of the code module.

12. An information recording device, characterized in that, Configured on a client, the device includes: The case identifier acquisition module is used to acquire the case identifier of the current test case entered through the test interface; A request generation module is used to generate a business test request containing the case identifier; wherein, the business test request is the business request corresponding to the current test case; A request sending module is used to send the business test request to the server, so that the server executes the first target program code in the application under test to respond to the business test request based on the business test request; wherein, the first target program code includes at least one first code module, each first code module contains pre-inserted instrumentation code, the instrumentation code is used to record the association relationship between the case identifier and the module identifier of the current first code module; The first code module includes an entry code module for receiving the business test request; The instrumentation code in the entry code module records the association between the case identifier and the module identifier of the current code module, including: The case identifier is read from the business test request and assigned to a preset local variable; wherein, the preset local variable is a variable that the current thread can access; The case identifier is read from the preset local variable, and the module identifier of the entry code module is obtained using reflection. The read case identifier and the obtained entry code module identifier are stored in a preset association information table; The first code module further includes an outbound call code module for sending outbound call requests; The instrumentation code in the outbound call code module records the association between the case identifier and the module identifier of the current code module, including: The case identifier is read from the preset local variable, and the module identifier of the outbound call code module is obtained using a reflection mechanism; The case identifier read and the module identifier of the obtained outbound call code module are stored in a preset association information table; The instrumentation code in the outbound call code module is also used for: The case identifier is added to the outbound call request, and the outbound call request is sent to other applications so that the other applications execute second target program code to respond to the outbound call request based on the outbound call request; wherein, the second target program code includes at least one second code module, each second code module contains pre-inserted instrumentation code, and the instrumentation code contained in the second code module is used to record the association relationship between the case identifier and the module identifier of the current second code module.

13. An electronic device, characterized in that, include: At least one processor; as well as A memory communicatively connected to the at least one processor; wherein, The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the information recording method according to any one of claims 1-7 or 8-9.

14. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the information recording method as described in any one of claims 1-7 or 8-9.

15. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the information recording method as described in any one of claims 1-7 or 8-9.

Citation Information

Patent Citations

  • Software testing method and device, electronic equipment and medium

    CN111858375A