Data processing method, electronic device, storage medium, and program product

By merging the method identifier and probe number when the class ID changes, the problem that existing code coverage statistics tools cannot merge execution records is solved, achieving efficient execution record merging and test cost savings.

CN122111850APending Publication Date: 2026-05-29SHANGHAI SHIZHUANG INFORMATION TECHNOLOGY CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
SHANGHAI SHIZHUANG INFORMATION TECHNOLOGY CO LTD
Filing Date
2026-02-10
Publication Date
2026-05-29

AI Technical Summary

Technical Problem

Existing code coverage statistics tools cannot merge program test records when class IDs change, resulting in high testing costs and low efficiency, especially when class content is frequently modified in agile iterations, making it impossible to effectively merge execution records.

Method used

By merging the first and second execution records to generate a third execution record when the class IDs are different, based on the same method identifier and number of probes, the execution status of the probes of the new version class can be determined directly using the execution records of the previous version class, thus reducing redundant testing.

Benefits of technology

It enables efficient merging of execution records when the class ID changes, saving testing processes and costs, reducing electronic device overhead, and improving the merging success rate. It is applicable to class execution record merging in languages ​​such as Java, Kotlin, and Scala.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122111850A_ABST
    Figure CN122111850A_ABST
Patent Text Reader

Abstract

The application relates to the computer technical field and discloses a data processing method, an electronic device, a storage medium and a program product. The method comprises the following steps: obtaining a first test record of a first program in a first version and a second test record of the first program in a second version. The first test record comprises a first execution record of a first type, and the second test record comprises a second execution record of a second type. The first type comprises M methods, and the first execution record indicates the method identifier of each method in the M methods and the first execution condition of the probe of each method. The second type comprises N methods, and the second execution record indicates the method identifier of each method in the N methods and the second execution condition of the probe of each method. The first execution record and the second execution record are combined into a third execution record based on the execution conditions of the probes of the methods with the same method identifier in the M methods and the N methods. In this way, the two execution conditions of each probe of the unchanged method in the class can be combined.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to a data processing method, electronic device, storage medium, and program product. Background Technology

[0002] Code coverage is a crucial metric for measuring the adequacy of program tests. Currently, widely used code coverage measurement tools in the industry (such as Jacoco) TM Typically, classes are used as the smallest unit for instrumentation. The implementation mechanism involves analyzing the bytecode instructions of a class and inserting probes at the locations of method calls and conditional branches. Furthermore, after inserting multiple probes, a corresponding static boolean array field (such as the array `$jacocoDate`, also called the probe array) can be generated for each instrumented class. This allows the execution status of the corresponding probe to be represented by each data element in the probe array. For example, the execution status of each probe in the class can be represented by the data elements in the probe array `{…0110…}`. If the data element corresponding to the first probe in the array is 0, it means the first probe has not been executed; if the data element corresponding to the second probe in the array is 1, it means the second probe has been executed.

[0003] In addition to instrumentation using classes as the smallest unit, code coverage statistics tools (such as Jacoco) also include... TM When merging code coverage test data (also known as test records) generated from multiple program tests, the merging is also done at the class level as the smallest unit. That is, if the identification (ID) of a class A1 in program A remains unchanged between two program tests, the two execution records related to class A1 in the two test records of program A (i.e., the two execution results of each probe) can be merged. Conversely, if the class ID of a class A1 in program A changes between two program tests, the two execution records of class A1 (i.e., the two execution results of each probe) cannot be merged.

[0004] However, in actual program development, code within classes is frequently modified during daily version iterations. Furthermore, any modification to a class, even just changing a single line of code, will cause the class ID to change. This results in execution records of the same class in different versions of the program being unable to be merged due to the different class IDs. Summary of the Invention

[0005] This application provides a data processing method, electronic device, storage medium, and program product that can merge two execution records of a class when the class ID changes.

[0006] In a first aspect, this application provides a data processing method applied to an electronic device. The method includes: acquiring a first test record of a first version of a first program and a second test record of a second version of the first program. The first test record includes a first execution record of a first type, and the second test record includes a second execution record of a second type. The first type includes M methods, and the first execution record indicates the method identifier of each of the M methods and the first execution status of the probe for each of the M methods. The second type includes N methods, and the second execution record indicates the method identifier of each of the N methods and the second execution status of the probe for each of the N methods. The first or second execution status indicates whether the corresponding probe has been executed or not, and M and N are both positive integers. Based on merging the execution status of probes for methods with the same method identifier among the M and N methods, the first and second execution records are merged into a third execution record.

[0007] Thus, using the above method, even when the class IDs of the first and second types are different, the execution status of each probe in the unchanged method within the class can be merged, thereby merging the two execution records of the class. Furthermore, when iteratively updating different versions of a class, if the method identifier of the first method in both versions is the same (i.e., the first method has not changed), and the execution status of each probe for the first method in the previous version's execution record (e.g., the first execution record of the first type) is all executed, then when testing the new version to obtain its execution record (e.g., the second execution record of the second type), testers do not need to test the first method again. In this case, testers can directly obtain the execution status of each probe for the first method in the new version's class (e.g., all executed) by merging the execution status of each probe in the previous version's execution record (e.g., all executed), thereby reducing the testing process and saving testing costs.

[0008] In one possible implementation of the first aspect described above, the first class and the second class can be different versions of the same class. For example, the first class and the second class can have the same class name, but their class IDs can be different. For example, the second class can be obtained by modifying the code in the first class.

[0009] In one possible implementation of the first aspect described above, merging the first execution record and the second execution record into a third execution record based on the execution status of probes of methods with the same method identifier among M and N methods includes: merging the first execution status of probes of Q methods with the same method identifier and the same number of probes in the first execution record and the second execution status of Q methods in the second execution record, respectively, to obtain the third execution status of probes for each of the Q methods, where Q is a positive integer less than or equal to M and less than or equal to N. Based on the third execution status of probes of the Q methods, a third execution record is obtained. The third execution record includes the third execution status of probes of the Q methods, or the third execution record includes the third execution status of probes of the Q methods and the first execution status of probes of MQ methods other than the Q methods in the first execution record, or the third execution record includes the third execution status of probes of the Q methods and the second execution status of probes of NQ methods other than the Q methods in the second execution record.

[0010] In this way, during the process of merging execution records, the first execution record of the first type or the second execution record of the second type can be used as the basis to obtain the third execution record of the first type or the third execution record of the second type, so that regardless of whether the first type or the second type is deployed, there can be a corresponding third execution record.

[0011] In one possible implementation of the first aspect described above, the first execution status of the probes of Q methods with the same method identifier and the same number of probes in the first execution record and the second execution record are merged with the second execution status of the Q methods in the second execution record to obtain the third execution status of the probe of each of the Q methods. This includes: for any first probe of any first method among the Q methods, if at least one of the first execution status and the second execution status corresponding to the first probe indicates that the first probe has been executed, the third execution status corresponding to the first probe of the first method is configured to indicate that the first probe has been executed. Alternatively, if both the first execution status and the second execution status corresponding to the first probe indicate that the first probe has not been executed, the third execution status corresponding to the first probe is configured to indicate that the first probe has not been executed.

[0012] In one possible implementation of the first aspect described above, the first execution record indicates the method identifier of each of the M methods and the first execution status of the probes of each of the M methods, including: the first execution record includes a first probe array, the method identifier of each of the M methods, and the index information of the probes of each of the M methods in the first probe array, wherein the first probe array includes the execution status of all probes of the M methods. The second execution record indicates the method identifier of each of the N methods and the second execution status of the probes of each of the N methods, including: the second execution record includes a second probe array, the method identifier of each of the N methods, and the index information of the probes of each of the N methods in the second probe array, wherein the second probe array includes the execution status of all probes of the N methods.

[0013] In this way, by storing the method identifiers of each method and the index information of the method probes in the first and second execution records, execution records can be merged at the method level, which will not cause the historical execution records of probes corresponding to other unmodified code blocks in the class to become invalid.

[0014] In one possible implementation of the first aspect described above, the third execution record includes the third execution status of probes for Q methods and the first execution status of probes for MQ methods (excluding the Q methods) in the first execution record. The third execution record includes a third probe array, a method identifier for each of the M methods, and index information of the probe for each of the M methods in the third probe array. The third probe array includes the third execution status of all probes for the Q methods and the first execution status of all probes for the MQ methods in the first probe array. The index information of the probe for each of the M methods in the third probe array is the same as the index information of the probe for each of the M methods in the first probe array.

[0015] Alternatively, the aforementioned third execution record includes the third execution status of probes for Q methods and the second execution status of probes for NQ methods (excluding the Q methods) in the second execution record. This includes: the third execution record comprising a third probe array, a method identifier for each of the N methods, and the index information of the probe for each of the N methods in the third probe array. The third probe array includes the third execution status of all probes for the Q methods and the second execution status of all probes for the NQ methods in the second probe array. The index information of the probe for each of the N methods in the third probe array is the same as the index information of the probe for each of the N methods in the second probe array.

[0016] In this way, during the process of merging execution records, the first execution record of the first type or the second execution record of the second type can be used as the basis to obtain the third execution record of the first type or the third execution record of the second type, so that regardless of whether the first type or the second type is deployed, there can be a corresponding third execution record.

[0017] In one possible implementation of the first aspect described above, the first execution record further includes a first-class identifier ID and a first-class name for the first class, and the second execution record further includes a second-class ID and a second-class name for the second class. The first-class name and the second-class name are the same, while the first-class ID and the second-class ID are different.

[0018] In this way, even if the class IDs of the first and second classes are different, the two executions of each probe in the unchanged method of the class can still be merged.

[0019] In one possible implementation of the first aspect described above, the first execution record, the second execution record, and the third execution record all include a first field, which indicates the time at which the server stores the execution status of all probes for M methods or N methods. Specifically, the first time indicated by the first field in the first execution record is later than the second time indicated by the first field in the second execution record, and the time indicated by the first field in the third execution record is the first time.

[0020] Thus, by setting the first field in the execution record, the execution record can be automatically filtered or deleted, thereby reducing storage pressure.

[0021] In one possible implementation of the first aspect above, the method identifier of each method is generated based on the name and bytecode of the corresponding method, wherein the method identifier is different when the name and / or bytecode of the corresponding method are different.

[0022] In one possible implementation of the first aspect described above, the first program of the first version includes a first class name of the first class, a first class ID of the first class, and a method identifier for each of the M methods. The first program of the second version includes a second class name of the second class, a second class ID of the second class, and a method identifier for each of the N methods.

[0023] In one possible implementation of the first aspect above, obtaining the first test record of the first version of the first program and the second test record of the second version of the first program includes: executing the first version of the first program to generate the first test record, or obtaining the first test record from an electronic device other than an electronic device; and / or executing the second version of the first program to generate the second test record, or obtaining the second test record from an electronic device other than an electronic device.

[0024] For example, in the embodiments of this application, when the electronic device is a client, other electronic devices can be servers; or, when the electronic device is a server, other electronic devices can be clients.

[0025] In a second aspect, this application also provides an electronic device, comprising: at least one memory and at least one processor, wherein the memory is coupled to the processor; the memory is used to store computer program code / instructions; when the computer program code / instructions are executed by the processor, the electronic device performs the data processing method mentioned in the first aspect and any possible implementation thereof.

[0026] Thirdly, this application also provides a readable storage medium storing instructions that, when executed on an electronic device, cause the electronic device to perform the data processing methods mentioned in the first aspect and any possible implementation thereof.

[0027] Fourthly, this application also provides a computer program product, comprising: computer instructions that, when executed on an electronic device, cause the electronic device to perform the data processing method mentioned in the first aspect and any possible implementation thereof.

[0028] The beneficial effects of the second to fourth aspects mentioned above can be referred to the relevant descriptions in the first aspect and any possible implementation of the first aspect, which will not be repeated here. Attached Figure Description

[0029] Figure 1A According to some embodiments of this application, a structural comparison diagram of an existing execution record and the execution record of this application is shown;

[0030] Figure 1B According to some embodiments of this application, a schematic diagram of client-server interaction is shown;

[0031] Figure 2 According to some embodiments of this application, a flowchart of a data processing method is shown;

[0032] Figure 3 According to some embodiments of this application, a schematic diagram of a scenario for merging execution records is shown;

[0033] Figure 4 According to some embodiments of this application, a flowchart of another data processing method is shown;

[0034] Figure 5 According to some embodiments of this application, the processing procedure for various versions of the program is illustrated;

[0035] Figure 6According to some embodiments of this application, a schematic diagram of the structure of an electronic device is shown. Detailed Implementation

[0036] The illustrative embodiments of this application include, but are not limited to, data processing methods, electronic devices, storage media, and program products.

[0037] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions in the embodiments of this application will be described in detail below with reference to the accompanying drawings and specific implementation methods.

[0038] The relevant field terms mentioned in this application will be explained below.

[0039] (1) Class: It is the foundation for information encapsulation in object-oriented programming (Java). Through classes, data and operations can be encapsulated into a whole. Among them, the standard file of a Java program can be a Java archive (jar) package, which is a compressed file with the .jar extension.

[0040] (2) Class ID: This can be used to uniquely identify a class and can be determined based on the class name and the class code. The class ID will also change if either the class name or any of the class code changes. That is, if the class IDs are the same, it means that both the class name and the class code are the same.

[0041] (3) Method: A method is a code block in a class that encapsulates a specific operation. A class may include one or more methods, and different methods can call each other. The background of the method provided in the embodiments of this application is introduced below.

[0042] As described in the background section, any modification to the content of a class, such as modifying only one line of code in the class, will cause the class ID of the class to change. This results in the execution records of the same class in different versions of the program being unable to be merged due to the different class IDs.

[0043] Currently, to merge execution records of a class even when the class ID changes, the electronic device can obtain the JAR files corresponding to the two execution records. Then, by parsing the two JAR files to extract the methods from the two version classes, the unchanged methods can be identified. Furthermore, the two execution records of each probe within the same unchanged method can be merged, achieving execution record merging with the method within the class as the smallest unit.

[0044] However, the aforementioned process of merging execution records incurs significant overhead and time consumption on electronic devices due to the need to download and parse the JAR files of various program versions. Furthermore, because code changes are very frequent under agile iteration models, a single program may undergo dozens or even hundreds of builds and deployments, resulting in numerous historical JAR files. Each JAR file requires 200MB-400MB of storage, and enterprises will not store all historical JAR files for their programs. Therefore, electronic devices may be unable to download the historical JAR files, thus preventing the aforementioned merging of execution records. In conclusion, the above-described solution for merging execution records may be time-consuming, costly, and prone to failure.

[0045] To address the aforementioned problems, this application provides a data processing method. Specifically, in this application, an electronic device can acquire a first test record of a first version of a first program and a second test record of a second version of the first program. The first test record includes a first execution record of a first type, and the second test record includes a second execution record of a second type. The first type includes M (M is a positive integer) methods, and the first execution record indicates the method identifier of each of the M methods and the first execution status of the probe for each of the M methods. The second type includes N (N is a positive integer) methods, and the second execution record indicates the method identifier of each of the N methods and the second execution status of the probe for each of the N methods. The first or second execution status indicates whether the corresponding probe has been executed or not. Then, the electronic device can merge the first and second execution records into a third execution record based on the execution status of probes for methods with the same method identifier among the M and N methods.

[0046] It should be noted that the first and second classes mentioned in this application are two different versions of the same class of code. For example, the second class is obtained by modifying the first class (such as adding / modifying / deleting code), or the first class is obtained by modifying the second class (such as adding / modifying / deleting code).

[0047] It should be noted that the method identifier mentioned in this application can be determined based on the method name and the method bytecode (which can be the code obtained by compiling the visual code in the method by an electronic device), and can be used to uniquely identify a method. Specifically, the method identifier will be different when the method name or method bytecode is different; the method identifier will be the same only when the method name and method bytecode are exactly the same. For example, an electronic device can concatenate the method name and method bytecode into a string, then calculate the MD5 value of the string using the Message Digest Algorithm Version 5 (MD5), and finally concatenate the MD5 value with the remainder when the string length is divided by 10 to obtain the method identifier. The MD5 algorithm is a cryptographic hash function that can be used to map a string of arbitrary length to a fixed-length (e.g., 128-bit) value (which can be called the MD5 value).

[0048] It should be noted that the probe mentioned in this application can be code used to test whether a method or a code segment of a method or a branch code in a method is executed, such as a boolean array inserted in class code. For example, the first probe in the class (such as the boolean array "var1[1]=false") can be inserted after code 1. Furthermore, code 1 and the first probe are executed sequentially so that code 1 can be considered to have been executed when the first probe is executed. In addition, when the first probe is executed, the execution status of the probe can be modified to show that it has been executed (such as changing the boolean array from "var1[1]=false" to "var1[1]=true"), and the execution status of the first probe can be collected to generate an execution record. It should be noted that in some other embodiments, the probe can also take other forms, which are not limited here.

[0049] Thus, using the above method, even when the class IDs of the first and second categories are different, the two execution results of each probe in the unchanged method within the class can still be merged. For example, if two execution results cannot be merged due to different class IDs of the same class in different versions, it means that the execution results of other versions of the class are not valuable when obtaining the execution result of a certain version. Furthermore, for a method in the class under test that has not changed and has been tested in a previous version, the execution results of the method's probes when testing other versions are also not valuable. Therefore, when testers obtain the execution record of the version under test, they need to retest the unchanged method that has already been tested in a previous version. However, in this embodiment, since the probe execution results of unchanged methods in different versions can be merged, it means that for a method in the class under test that has not changed and has been tested in a previous version, testers can directly obtain the execution result of the probe for the unchanged method by merging the previous execution results of the probes when obtaining the execution record of the version under test, without needing to retest the method, thus saving testing processes and costs. Furthermore, in this application, the method identifiers of each method can be directly stored in the execution record, thus allowing direct determination of whether a method has changed through the method identifiers in the two execution records. In other words, in this application, the electronic device only needs to save the first and second execution records during program testing; there is no need to download and parse two versions of JAR files to compare and identify unchanged methods when merging the two execution records. Even in the event of lost historical JAR files, execution record merging can still be performed, saving processing time, reducing the overhead of the electronic device, and improving the merging success rate. In addition, the method provided in this application can also be applied to obtaining the execution records of classes in a first program developed in any language such as Java, Kotlin, and Scala.

[0050] It should be noted that the first program mentioned in this application can be a program that processes any type of data, such as audio data, image data, video data, communication data, user data, or industrial data. Alternatively, the first program can also refer to any code that can run in an electronic device. This application does not limit the scope of the application.

[0051] In some embodiments, when merging the execution status of method probes, the electronic device needs to determine that in addition to the method identifier (also known as the method's unique code) is the same, it also needs to determine that the number of probes (also known as the probe fragment length) is the same. This allows for merging the two execution statuses of each probe in a method where both the method bytecode and probe instrumentation have not changed. Therefore, the execution record mentioned in this application may include the method identifier of each method in the class and information used to determine the number of probes for each method. For example, the code coverage statistics tool jacoco... TM The core components (such as the jacocoagent end) can use a hybrid encoding method to embed the method identifiers of each method and the number of probes into the execution record of the class. Furthermore, they can be transmitted in byte stream mode (such as being sent to a buffer or memory) to ensure transmission compatibility and minimize memory overhead.

[0052] For example, the following is combined with Figure 1A As shown, a comparison is made between the existing execution records and the execution records mentioned in this application.

[0053] like Figure 1A As shown, the test record of the program may include execution records of one or more classes. Among them, the execution records of each class mentioned in this application (also referred to as new execution records, such as the first execution record or the second execution record) include the data block type (such as 0X11, which can occupy 1 byte), class ID (such as occupying 8 bytes), class name, probe length (used to indicate the number of probes), probe array (also referred to as probe interface array) and other structures that existing execution records have.

[0054] The data elements in the probe array represent the execution status of each probe in the class. From right to left, the probe array represents the execution status of the first probe to the last probe in the first class. For example, if the probe array is {…01}, it means that the first probe in the class has not been executed, and the second probe has been executed. Furthermore, if the length of the probe array is less than k bytes (k is an integer), zeros can be padded to the left. For example, if the execution status of the probes is [executed (e.g., represented by true), executed, not executed (e.g., represented by false), executed], the corresponding binary form of the probe array is 0b00001011, representing the execution status of the four probes from right to left, with four zeros padded to the left to ensure the probe array occupies one byte.

[0055] Additionally, the probe length is used to indicate the number of probes. The electronic device can determine the probe execution status from the probe array based on the probe length. For example, if the probe length is 6 and the probe array is 1 byte (i.e., 8 bits of data), the electronic device can use the 6 bits of data from right to left in the probe value as the data corresponding to the execution status of all probes in the class.

[0056] In addition, class names can also be encoded using Unicode Transformation Format (UTF) or other encoding methods, and the byte length occupied by the class name can be specifically set according to the class name length.

[0057] However, in addition to the structural fingerprints present in the existing execution records, continue to refer to Figure 1A As shown, the execution record mentioned in this application may also include newly added record content. For example, this includes method identifiers for each method (e.g., method identifier 4f8bfa98c for method 1, method identifier dbde3c0 for method 2, etc.) and the index information of probes in each method within the probe array. The index information of probes in each method within the probe array can refer to the probe index range for each method (e.g., from the start probe index to the end probe index), which can be used to determine the number of probes in the method. For example, as... Figure 1A As shown, the presence of "4f8bfa98c: 1-16, dbde3c0: 17-18…" in the execution record indicates that the first to 16th data elements in the probe array represent the execution status of each probe in method 1 (method identifier 4f8bfa98c), meaning method 1 has 16 probes. Similarly, the 17th and 18th data elements in the probe array represent the execution status of each probe in method 2 (method identifier dbde3c0), meaning method 2 has 2 probes.

[0058] In other embodiments, the execution status of the probe can be represented by one or more bits. For example, the probe may be executed or not executed by only one bit (such as "1" or "0"); or by two bits (such as "11" or "00").

[0059] In other embodiments, the order of fields in the execution record can be interchanged; for example, the class name field and the class ID field can be swapped. Furthermore, execution records can be stored using different data structures (such as lists, dictionaries, linked lists, arrays, or stacks). This application does not limit this approach.

[0060] Thus, when merging two execution records of a class, the electronic device only needs to save the two execution records mentioned in this application (such as...). Figure 1AThe execution records shown in this application can be used to identify unchanged methods through method identifiers and index information, and then the two execution records of the unchanged methods can be merged. In other words, in this application, when merging two execution records, it is not necessary to download and parse two versions of JAR files to compare and identify unchanged methods. Therefore, compared to merging execution records from a method perspective by parsing JAR files, the method provided in this application can save merging time and power consumption of electronic devices; furthermore, it can achieve execution records for different versions of classes without storing historical versions of JARs, thus saving storage space.

[0061] The following is combined with Figure 1B The testing process of the program is described.

[0062] In some embodiments, such as Figure 1B As shown, during the testing process, client 11 can continuously run code coverage statistics tools (such as Jacoco) in the background. TM The client 11 then reports the results to the server 12 (the server side) of the code coverage statistics tool. Based on this, the server 12 of the code coverage statistics tool can collect the execution status of the probes in real time. Then, the server 12 can store the execution status of each probe as a binary file (that is, the binary file corresponding to the execution record), so that the client 11 can download the binary file from the server 12 and generate the corresponding visual execution record.

[0063] Therefore, continue to refer to Figure 1A As shown, the execution record of the class mentioned in this application may also include new record content such as a time field (as an example of the first field), so as to indicate the time when the server 12 stores the execution status of all probes of each method (such as the dump time when the server stores binary files) through the first field.

[0064] For example, in the execution record of a class, the first field can be encoded before the method identifier and index information of each method, or the first field can be encoded after the method identifier and index information of each method.

[0065] As another example, the time precision represented by the first field can be accurate to the hour level, with the leading year removed. For instance, the content of the first field corresponding to the time "2025-10-18,12:01:05" could be "25101812" to save several characters in the first field. Alternatively, the time precision represented by the first field can also be accurate to other dimensions (such as the minute level). Or, the time precision represented by the first field can also retain the leading year. This application does not limit this.

[0066] It's understandable that the record merging process can occur during the server's storage of binary files. For example, in... Figure 1B In this process, server 12 can merge multiple execution record binary files using the methods described above to generate a new execution record binary file, such as merging two execution record binary files with the same class ID and whose first field indicates the same day. Alternatively, the execution record merging process can also occur during the client's retrieval of execution records from the server. For example, in... Figure 1B In the process of client 11 downloading execution records from server 12, it can directly merge the binary files of multiple execution records from the server to directly save the merged new execution record (e.g., the third execution record). Alternatively, this can also occur after the client generates the execution record. For example, in... Figure 1B In the process, after client 11 downloads the execution record from server 12, it can merge the downloaded execution record with the stored execution record to obtain a new merged execution record (e.g., the third execution record).

[0067] In some embodiments, the client or server can also periodically delete execution records or binary files of execution records based on a first field in the execution record. For example, if the time indicated by the first field exceeds a preset time compared to the current time, the execution record corresponding to the first field can be deleted. For instance, if the time indicated by the first field in an execution record is 60 days ago, the execution record can be deleted. Furthermore, the preset time can also be other longer or shorter events, such as 50 days or 70 days, etc. This application embodiment does not limit the specific value of the preset time.

[0068] In some embodiments, when merging two execution records, the first field indicating the later time in the two execution records can be used as the first field of the merged execution record. For example, the first execution record may include a first field indicating the time when the server stores the execution status of all probes for M methods. The second execution record may also include a first field indicating the time when the server stores the execution status of all probes for N methods. Furthermore, the third execution record may also include a first field. Wherein, if the first time indicated by the first field in the first execution record is later than the second time indicated by the first field in the second execution record, then the time indicated by the first field in the third execution record can be the first time. For example, if the time indicated by the first field of the first execution record is October 1, 2025, and the time indicated by the second field of the second execution record is September 30, 2025, then after merging the first and second execution records into a third execution record, the time indicated by the first field in the third execution record can be October 1, 2025.

[0069] Thus, by setting the first field in the execution record, the execution record can be automatically filtered or deleted, thereby reducing storage pressure.

[0070] In other embodiments, in addition to, Figure 1B As shown, client 11 is running the first version of the first program and a code coverage statistics tool (such as Jacoco). TM During the process, server 12 can collect the execution status of the probe in real time and store it as a binary file corresponding to the execution record. Then, client 11 downloads the binary file from server 12 and generates the corresponding visual execution record. In some embodiments of this application, client 11 can also directly collect the execution status of the probe and generate execution records in real time during the testing program and the running of code coverage statistics tools. This application does not limit this.

[0071] It should be noted that the data processing method described above in this application can be applied to electronic devices such as clients and servers. The client may include, but is not limited to, desktop computers, laptops, and tablets. In this embodiment, if an electronic device is a client, other electronic devices may be servers; or, if an electronic device is a server, other electronic devices may be clients.

[0072] It should be noted that the first program mentioned in this application can be any type of software program, such as audio software program, image processing software program, video software program, shopping software program, communication software program, industrial software program, etc. Alternatively, the first program mentioned in this application can also be a subroutine in software. This application does not limit the first program.

[0073] The following is based on Figure 2 The flowchart shown provides a brief overview of the data processing method mentioned in the embodiments of this application. This method can be applied to electronic devices, such as any electronic device like the computer mentioned above. Figure 2 As shown, specifically, the method is as follows:

[0074] S21: Obtain the first test record of the first program in the first version and the second test record of the first program in the second version. The first test record includes the first execution record of the first type, and the second test record includes the second execution record of the second type.

[0075] In some embodiments, the electronic device can generate a first test record by executing a first version of a first program. For example, the electronic device can simultaneously run the first version of the first program and a code coverage statistics tool (such as Jacoco). TM (This involves) collecting the probe's execution status in real time to generate a first execution record after the first version of the first program has completed. Alternatively, the first test record could also be obtained by the electronic device from other electronic devices. For example, such as... Figure 1B As shown, client 11 (as an example of an electronic device) is running the first version of the first program and a code coverage statistics tool (such as Jacoco). TM During the process, server 12 (as an example of other electronic devices) can collect the probe's execution status in real time and store it as a binary file corresponding to the first execution record. Then, client 11 can download the binary file from server 12 and generate the corresponding visualized first execution record. Alternatively, the first test record can also be a test record generated by the electronic device by merging multiple test records previously, and the electronic device can store it in its memory after generating the first test record. Therefore, the first test record can also be obtained directly from the electronic device's memory.

[0076] And / or, in other embodiments, the electronic device can generate a second test record by executing a second version of the first program. For example, the electronic device can simultaneously run a second version of the first program and a code coverage statistics tool (such as Jacoco). TM(This involves) collecting the probe's execution status in real time to generate a second execution record after the first program of the second version has completed. Alternatively, the second test record could also be obtained by the electronic device from other electronic devices. For example, such as... Figure 1B As shown, client 11 (as an example of an electronic device) is running the second version of the first program and a code coverage statistics tool (such as Jacoco). TM During the process, server 12 (as an example of other electronic devices) can collect the probe's execution status in real time and store it as a binary file corresponding to the second execution record. Then, client 11 can download the binary file from server 12 and generate the corresponding visualized second execution record. Alternatively, the second test record can be a test record generated by the electronic device by merging multiple test records previously, and the electronic device can store it in its memory after generating the second test record. Therefore, the second test record can also be obtained from the memory of the electronic device.

[0077] In some embodiments, the first and second classes mentioned in this application may be two different versions of the same class of code. For example, the second class is obtained by modifying the first class (e.g., adding / modifying / deleting code), or the first class is obtained by modifying the second class (e.g., adding / modifying / deleting code).

[0078] In some embodiments, the first class may include M (M is a positive integer) methods, and the first execution record is used to indicate the method identifier of each of the M methods and the first execution status of the probe for each of the M methods, wherein the first execution status indicates whether the corresponding probe has been executed or not. For example, the first execution record may include a first probe array (as described above). Figure 1A The probe array {…01} shown), and the method identifier of each of the M methods (as described above) Figure 1A The method identifier of method 1 shown), and the index information of the probe of each of the M methods in the first probe array (as described above) Figure 1A The probe index information of method 1 shown is 1-16). Among them, the first probe array includes the execution status of all probes of M methods, that is, each data element in the first probe array is used to indicate whether the corresponding probe has been executed or not; the index information of the probe of each of the M methods in the first probe array (such as the index range of the probe) can be used to indicate the number of probes of each of the M methods.

[0079] In other embodiments, the second class may include N (N is a positive integer) methods, and the second execution record is used to indicate the method identifier of each of the N methods and the second execution status of the probe for each of the N methods, the second execution status indicating whether the corresponding probe has been executed or not. For example, the second execution record may include a second probe array (as described above). Figure 1A The probe array {…01} shown), and the method identifier of each of the N methods (as described above) Figure 1A The method identifier of method 1 shown), and the index information of the probe of each of the N methods in the second probe array (as described above) Figure 1A The probe index information of method 1 shown is 1-16). Among them, the second probe array includes the execution status of all probes of N methods. That is, each data element in the second probe array is used to indicate whether the corresponding probe has been executed or not. The index information of the probe of each of the N methods in the second probe array (such as the index range of the probe) can be used to indicate the number of probes of each of the N methods.

[0080] The following is combined with Figure 3 As shown, the first execution record and the second execution record are described exemplarily.

[0081] like Figure 3 As shown, the first class (e.g., class A1) can sequentially include method 1, method 2, method 3, and method 4. Within this first class, method 1 can include two probes with execution statuses of not executed and executed (corresponding probe index information 1-2); method 2 can include one probe with execution status of executed (corresponding probe index information 3-3); method 3 includes two probes with execution statuses of executed and not executed (corresponding probe index information 4-5); and method 4 can include one probe with execution status of executed (corresponding probe index information 6-6). At this point, with... Figure 1A similar, Figure 3The first execution record can be represented as [{data block type}, {class ID of the first class}, {class name of the first class}, {first field indicating dump time, method identifier of method 1: 1-2, method identifier of method 2: 3-3, method identifier of method 3: 4-5, method identifier of method 4: 6-6}, {probe length 6}, {first probe array 0b00101110}]. The first probe array 0b00101110, from right to left, represents the execution status of the first probe to the last probe in the first class. To ensure the first probe array occupies k (k is an integer) bytes, two zeros are added to the left of the first probe array. Furthermore, in the six elements (i.e., 101110) of the probe array 0b00101110 from right to left, 0 indicates that the corresponding probe has not been executed, and 1 indicates that the corresponding probe has been executed.

[0082] Continue to refer to Figure 3 As shown, the second category (e.g., class A1) is a different version of the same class as the first category (e.g., both are class A1). Furthermore, methods 1 and 3 in the second category have the same method identifier and number of probes as methods 1 and 3 in the first category, respectively. The modified method 2 in the second category has a different method identifier than method 2 in the first category. Method 4 is deleted in the second category, and method 5 is added before method 1. Specifically, in the second category, method 5 can include one probe with an execution status of "not executed" (corresponding probe index information 1-1), method 1 can include two probes with execution statuses of "executed" and "not executed" (corresponding probe index information 2-3), the modified method 2 can include two probes with both execution statuses of "not executed" (corresponding probe index information 4-5), and method 3 includes two probes with execution statuses of "executed" and "not executed" (corresponding probe index information 6-7). At this time, with... Figure 1A similar, Figure 3 The second execution record can be represented as [{data block type}, {class ID of the second type}, {class name of the second type}, {first field used to indicate dump time, method identifier of method 5: 1-1, method identifier of method 1: 2-3, method identifier of modified method 2: 4-5, method identifier of method 3: 6-7}, {probe length 7}, {probe array 0b00100010}]. The probe array 0b00100010, from right to left, represents the execution status of the first probe to the last probe in the second type. To allow the first probe array to occupy k (k is an integer) bytes, a 0 is added to the left of the second probe array. Furthermore, in the 7 elements (i.e., 0100010) of the probe array 0b00100010 from right to left, 0 indicates that the corresponding probe has not been executed, and 1 indicates that the corresponding probe has been executed.

[0083] It should be noted that in some other embodiments, the probe array can also use 0 to indicate execution and 1 to indicate non-execution, and this is not limited here.

[0084] S22: Based on the execution status of probes that have the same method identifier among M and N methods, merge the first execution record and the second execution record into the third execution record.

[0085] In some embodiments, when merging execution records, the electronic device can use the method identifiers and probe index information in the first and second execution records. For example, after the core component of the code coverage statistics tool jacocoTM (such as the jacococli client) reads the execution record data in UTF encoding, it can parse the method identifiers and probe index information in the execution record using a hybrid decoding method to determine Q (Q is a positive integer less than or equal to M and less than or equal to N) methods with the same method identifier and the same number of probes. Then, the electronic device can merge the first execution status of the probes of the aforementioned Q methods in the first execution record with the second execution status of the Q methods in the second execution record, thereby obtaining the third execution status of the probes of each of the Q methods.

[0086] For example, such as Figure 3 As shown, the first class (e.g., class A1) includes method 1, method 2, method 3, and method 4, while the second class (e.g., class A1) includes method 5, method 1, a modified method 2, and method 3. Method 1 and method 3 in the first class have the same method identifier and probe count as methods 1 and method 3 in the second class, respectively. Method 2 in the first class has a different method identifier and a different probe count than the modified method 2 in the second class. Therefore, the electronic device can determine methods 1 and 3 with the same method identifier and probe count based on the method identifier and probe index information in the first and second execution records. Then, the electronic device can merge the first and second execution states of the probes in method 1 to obtain the third execution state of the probes in method 1; and the electronic device can also merge the first and second execution states of the probes in method 3 to obtain the third execution state of the probes in method 3.

[0087] Specifically, when merging the two execution states of the probes of Q methods, if any first probe of any first method in the Q methods indicates that the first probe has been executed in at least one of the first execution states and the second execution state corresponding to the first probe, the third execution state corresponding to the first probe of the first method is configured to indicate that the first probe has been executed. Alternatively, if both the first execution state and the second execution state corresponding to the first probe indicate that the first probe has not been executed, the third execution state corresponding to the first probe is configured to indicate that the first probe has not been executed.

[0088] For example, continue to refer to Figure 3 As shown, when obtaining the third execution status of the probes in Method 1 and Method 3, if the first execution status corresponding to the first probe in Method 1 is not executed and the second execution status is executed, then the third execution status of the first probe in Method 1 is executed. Alternatively, if the first execution status corresponding to the second probe in Method 1 is executed and the second execution status is not executed, then the third execution status of the second probe in Method 1 is executed. Or, if the first execution status corresponding to the first probe in Method 3 is executed and the second execution status is executed, then the third execution status of the first probe in Method 3 is executed. Still, if the first execution status corresponding to the second probe in Method 3 is not executed and the second execution status is not executed, then the third execution status of the second probe in Method 3 is not executed.

[0089] Thus, by using the above method, the third execution status of Q methods with the same method identifier and the same number of probes can be obtained. Furthermore, the electronic device can obtain a third execution record based on the third execution status of these Q method probes.

[0090] For example, the third execution record may include the third execution status of probes for Q methods, and the first execution status of probes for the MQ methods (excluding the Q methods) in the first execution record. For example, in Figure 3 In the third execution record 301, the third execution status of the probes of method 1 and method 3 may be included, as well as the first execution status of the probes of method 2 and method 4 in the first execution record (e.g., the first probe in method 2 is executed, and the first probe in method 4 is executed).

[0091] Specifically, similar to the first or second execution record described in S21 above, the third execution record may also include a third probe array, the method identifier of each of the M methods, and the index information of the probes of each of the M methods in the third probe array. The third probe array includes the third execution status of all probes for the Q methods (e.g., ...). Figure 3The third execution status of the probes for methods 1 and 3 shown) and the first execution status of all probes for the MQ methods in the first probe array (such as...) Figure 3 The first execution of the probes in methods 2 and 4 are shown. For example, in Figure 3 Given that the first probe array in the first execution record is 0b00101110 and the second probe array in the second execution record is 0b00100010, the third probe array corresponding to the third execution record 301 can be 0b00101111. Furthermore, the index information of the probe for each of the M methods in the third probe array is the same as the index information of the probe for each of the M methods in the first probe array. For example, Figure 3 The probe index information for each method in the third execution record 301 shown is the same as the probe index information for each method in the first execution record. Additionally, the third execution record 301 may also include information such as the data block type, class ID of the first class, class name of the first class, and probe length 6 from the first execution record. In this way, the second execution record of the second class can be merged into the first execution record using the first execution record of the first class as a reference, thereby obtaining the third execution record of the first class.

[0092] For example, the third execution record may also include the third execution status of the probes for Q methods, and the second execution status of the probes for NQ methods other than the Q methods in the second execution record. For example, in the above... Figure 3 In the second execution record, the third execution record 302 may include the third execution status of the probes of method 1 and method 3, as well as the second execution status of the probes of method 5 and modified method 2 in the second execution record (e.g., the first probe in method 5 is not executed, the first probe in modified method 2 is not executed, and the second probe in modified method 2 is not executed).

[0093] Specifically, refer to Figure 3 As shown, similar to the first or second execution record described in S21 above, the third execution record may also include a third probe array, the method identifier of each of the N methods, and the index information of the probe of each of the N methods in the third probe array. The third probe array may include the third execution status of all probes of the Q methods (e.g., ...). Figure 3 The third execution status of the probes for methods 1 and 3 shown) and the second execution status of all probes for NQ methods in the second probe array (such as...) Figure 3 The second execution of the probe in Method 5 and the modified Method 2 shown. For example, in Figure 3Given that the first probe array in the first execution record is 0b00101110 and the second probe array in the second execution record is 0b00100010, the third probe array in the third execution record 302 can be 0b00100110. Furthermore, the index information of the probe for each of the N methods in the third probe array is the same as the index information of the probe for each of the N methods in the second probe array. For example, Figure 3 The probe index information for each method in the third execution record 302 shown is the same as the probe index information for each method in the second execution record. Additionally, the third execution record 302 may also include information such as the data block type, class ID of the second type, class name of the second type, and probe length 7 from the second execution record. In this way, the first execution record of the first type can be merged into the second execution record using the second execution record of the second type as a reference, thereby obtaining the third execution record of the second type.

[0094] For example, the third execution record could also include only the third execution status of the probes for Q methods. For instance, in... Figure 3 In this context, the third execution record 303 may only include the third execution status of the probes from methods 1 and 3. For example, in... Figure 3 If the first probe array in the first execution record is 0b00101110 and the second probe array in the second execution record is 0b00100010, then if the third execution record 303 only includes the third execution status of probes for the unchanged method, the probe array in the third execution record 303 can be 0b00000111 and the probe length can be 4. Furthermore, the third execution record 303 may also include a first field indicating the dump time, method identifiers for method 1 and method 3, and index information of the probes in method 1 and method 3 in the third probe array (e.g., the index information of the probes for method 1 is 1-2, and the index information of the probes for method 3 is 3-4).

[0095] It should be noted that the third execution record 303 may also include one or more of the following information: data block type, class name of the first and second classes, class ID of the first and / or second classes, etc. This application does not limit this information.

[0096] It should be noted that in some embodiments, there may be zero identical methods in the first and second categories, or the first or second category may include zero methods. This application does not limit this.

[0097] In summary, the method provided in this application allows for the merging of two execution records of probes within unchanged methods of a class, even when the class IDs of the first and second types are different. This prevents the historical execution records of probes corresponding to other unmodified code blocks within the class from becoming invalid, eliminating the need for testers to test the entire code of the class in the new version of the program, thus reducing testing costs. Furthermore, during the merging of execution records, the first execution record of the first type or the second execution record of the second type can be used as a basis to obtain the third execution record of either type, ensuring that a corresponding third execution record is available regardless of whether the first or second type is deployed.

[0098] The following is based on Figure 4 The flowchart shown illustrates the data processing method mentioned in the embodiments of this application. This method can be applied to electronic devices, such as any electronic device like the computer mentioned above. Figure 4 As shown, specifically, the method is as follows:

[0099] S41: Trigger the merging of execution records of classes with the same class name (e.g., merging the first execution record of the first class and the second execution record of the second class).

[0100] In some embodiments, as described above Figure 1A As shown, the execution record mentioned in this application may include the class name of a class. For example, taking the merging of a first execution record and a second execution record as an example, the first execution record includes the class name of a first class (as an example of a first class name), and the second execution record includes the class name of a second class (as an example of a second class name). The merging process of the first execution record and the second execution record will only be executed if the first class name and the second class name are the same.

[0101] In some embodiments, the class name can be the name of the class itself, for example, in the above... Figure 3 In this context, the class names of the first and second classes can be the class name itself, class A1. Alternatively, in some other embodiments, the class name can be the fully qualified name of the class; for example, the class name structure can be "program name.package name.class name".

[0102] S42: Determine if the class IDs are the same. If yes, proceed to S43; otherwise, proceed to S44.

[0103] In some embodiments, as described above Figure 1AAs shown, the execution record mentioned in this application may also include the class ID of the class. If two classes have the same class ID, it means the two classes are completely identical, and S43 can be executed directly to merge the two execution records. Conversely, if the two classes have different class IDs (such as the first class ID and the second class ID), S44 to S52 can be executed to merge the two execution records at the method level.

[0104] In some embodiments, modifying any one or more lines of code in a class will cause the class ID to change.

[0105] S43: Merge execution records.

[0106] For example, if two classes have the same class ID, it means that the two classes are completely identical, and the two execution records can be merged. For instance, the execution status of the nth probe in one execution record can be directly merged with the execution status of the nth probe in another execution record to obtain the execution status of the merged nth probe. Specifically, if both execution statuses of the nth probe are not executed, the execution status of the merged nth probe is not executed; if at least one of the two execution statuses of the nth probe is executed, the execution status of the merged nth probe is executed.

[0107] S44: Determine if the execution record to be merged is a new version execution record. If yes, proceed to S45; otherwise, end the process.

[0108] In some embodiments, when merging execution records at the method-based granularity, it must be ensured that the two execution records to be merged are as follows: Figure 1A The execution record mentioned in this application (i.e., the new version execution record) is shown. That is, both execution records must contain newly added record content such as the method identifiers of each method and the index information of the probes for each method. Conversely, if at least one execution record is as follows... Figure 1A If the existing execution record shown (that is, one that does not have a method identifier and probe index information) cannot be merged, the process can be terminated directly.

[0109] S45: When merging execution records for a target version class, traverse the execution records of all classes with the same class name but different class IDs.

[0110] In some embodiments, since there may be execution records for multiple version classes, when merging execution records for a target version class, the execution records of all other version classes can be merged with the execution record of the current version class. For example, if there are four version classes, and these four version classes have the same class name but different class IDs, then when merging execution records for a target version class, the execution records of the other three version classes can be traversed separately to merge the execution records of the other three version classes into the execution record of the target version class.

[0111] S46: Trigger method dimension merging.

[0112] In some embodiments, when the classes corresponding to the execution records to be merged have the same class name but different class IDs, and when the execution record to be merged is a new version execution record, the merging of the execution records to be merged can be triggered based on the methods of S47 to S52.

[0113] S47: Get the method identifiers of each method in the target version class.

[0114] For example, taking the first type as the target version class, the electronic device can obtain the method identifier of each method in the first execution record of the first type.

[0115] In some embodiments, the method identifier is generated based on the name and bytecode (such as input parameter types, return value types, etc.) of the corresponding method. Furthermore, the method identifier differs when the name and / or bytecode of the corresponding method are different.

[0116] S48: Based on each method identifier in the target version class, find the method with the same method identifier in the execution record of another version class.

[0117] For example, if the target version class can be a first class and the other version class can be a second class, the electronic device can find the corresponding method in the second execution record of the second class based on the method identifier of each method in the first class. For instance, based on the method identifier of the first method in the first class, the first method can be found in the second execution record.

[0118] S49: Determine whether there exists a method identifier in the execution record of another version class that is identical to at least one method identifier of the target version class. If not, proceed to S52; if yes, proceed to S50.

[0119] For example, consider a target version class as the first type and another version class as the second type. When the first type includes M (M is a positive integer) methods and the second type includes N (N is a positive integer) methods, if the method identifiers of Q (Q is a positive integer less than or equal to M and less than or equal to N) methods in the second execution record are the same as the method identifiers of Q methods in the first execution record, then S50 to S51 can be executed to merge the execution status of the probes of the Q methods respectively.

[0120] Conversely, if no method identifier in the second execution record is the same as any method identifier in the first execution record, it indicates that all methods in the first and second categories have changed, making it impossible to merge execution records at the method level. In other words, the first and second execution records cannot be merged. At this point, the electronic device can execute S52 to determine if it has traversed all execution records of other classes with the same class name but different class IDs. If not, the electronic device can merge the execution records of other version classes (such as the execution record of a third category with the same class name but different class ID as the target version class) with the execution record of the target version class (such as the first execution record of the first category).

[0121] S50: Determine whether the number of probes determined by the index information of two methods with the same method identifier is the same. If yes, proceed to S51; otherwise, proceed to S52.

[0122] The index information of the probes in each method within the probe array can refer to the probe index range of each method (e.g., from the start probe index to the end probe index), which can be used to determine the number of probes in a method. See the reference for details. Figure 2 As described in S21, it will not be repeated here. For example, the index information indicating the number of probes for a certain method can be the end probe index - the start probe index + 1.

[0123] S51: Merge execution records.

[0124] For example, as mentioned above Figure 3As shown, when the target version class is Class 1 and the first and second execution records are merged, the electronic device can use the first execution record as a base to merge the second execution record into the first execution record to generate a third execution record. For example, the first execution record can be modified to obtain the third execution record; or, the first and second execution records can be left unchanged, and a new third execution record can be created directly. Furthermore, the electronic device can also use the second execution record as a base to merge the first execution record into the second execution record to generate a third execution record. For example, the second execution record can be modified to obtain the third execution record; or, the first and second execution records can be left unchanged, and a new third execution record can be created directly. See the above for details. Figure 2 As described in S22, it will not be repeated here.

[0125] For example, merging based on the execution record of the target version class can also be called a positive merge. That is, taking the target version class as the first type and merging the first and second execution records as an example, in the positive merge process, the merged third execution record may include the third execution status of the probes for the Q methods that have not changed, and the first execution status of the probes for the MQ methods (excluding the Q methods) in the first execution record. Merging based on the execution record of a non-target version class can also be called a negative merge. That is, taking the target version class as the first type and merging the first and second execution records as an example, in the negative merge process, the merged third execution record may include the third execution status of the probes for the Q methods that have not changed, and the second execution status of the probes for the NQ methods (excluding the Q methods) in the second execution record.

[0126] S52: Determine if the traversal is complete. If yes, end the process; otherwise, execute S45.

[0127] For example, when the target version class is Class 1, if after the merging process of the first execution record of Class 1 and the second execution record of Class 2 is completed, if there are still execution records of Class 3 with the same class name but different class ID as Class 1 that have not been traversed, the electronic device can continue to execute S45 to S51 to traverse the third execution records and merge them with the first execution record. Alternatively, when the target version class is Class 1, if the execution records of other classes with the same class name but different class ID as Class 1 have been traversed, the merging process is indicated to be complete, and the processing flow can be terminated.

[0128] In summary, the method provided in this application allows for the merging of execution records for any classes with the same class name. Furthermore, by storing the method identifiers and probe indexes of each method in the first and second execution records, execution records can be merged at the method level. This prevents the historical execution records of probes corresponding to other unmodified code blocks within the class from becoming invalid. Testers no longer need to test all the code of classes in the new version of the program, thus reducing testing costs.

[0129] In some embodiments, the method identifier is generated based on the corresponding method's name and bytecode (such as input parameter types, return value types, etc.). Furthermore, the method identifier will differ if the corresponding method name and / or bytecode are different. Specifically, to allow the first execution record to include method identifiers for M methods, the first version of the first program also needs to set a first class name for the first class, a first class ID for the first class, and a method identifier for each of the M methods. Similarly, to allow the second execution record to include method identifiers for N methods, the second version of the first program also needs to set a second class name for the second class, a second class ID for the second class, and a method identifier for each of the N methods.

[0130] In this way, when executing the first program of the first version or the second program of the second version, a first execution record or a second execution record with the method identifiers of each method can be generated. The following is in conjunction with... Figure 5 As shown, the processing procedure for each version of the program is described exemplarily.

[0131] For example, such as Figure 5 As shown, an electronic device may include a bytecode management scheduler. This scheduler is a core component of the software development platform within the electronic device, capable of reading, parsing, and executing bytecode instructions in a program. For example, the bytecode management scheduler can parse bytecode instructions in a class to analyze information such as the class name, class ID, and method identifiers. Furthermore, the bytecode management scheduler can insert probes into the class's bytecode and obtain the index information of the method probes in the probe array.

[0132] In addition, continue to refer to Figure 5 As shown, the electronic device may also include a class probe manager, which can be used to store information such as class ID, class name, and method probe managers for each method in the class. In addition, the method probe manager can be used to store method identifiers and probe index information of the method (such as start probe index and end probe index).

[0133] During program processing, the bytecode management scheduler parses the bytecode instructions in a class, creates class probe managers for each class, and inserts these managers into the class's bytecode instructions. This ensures that the corresponding version of the program includes the class ID, class name, method identifiers for each method, and probe index information for each class. Consequently, when the program is executed to generate test records, the execution records for each class in the test records include the class ID, class name, method identifiers for each method, and probe index information for each class.

[0134] The following is combined with Figure 5 As shown, the process by which the bytecode management scheduler generates class probe managers for each class by parsing bytecode instructions in the class is described.

[0135] like Figure 5 As shown, the bytecode management scheduler can first access the overall information of classes in the program (such as the class's own name, parent class, or child class) to analyze the class name and class ID. When accessing classes, class probe managers (such as ClassPile<ClassProbeManager1>, ClassPile<ClassProbeManager2>, etc.) can be created for each class. Each class probe manager stores the corresponding class ID, class name (such as name<className>), and the thread to which the class is bound (such as currentClassPiles<ThreadBoundClassManagerPullpool>).

[0136] Then, the bytecode management scheduler can access overall information about each method in each class. When accessing a method, a short-lived buffer can be added to store partial string information about the method later (such as storing the method identifier). Additionally, when accessing each method, the thread of the corresponding method (e.g., currentMethodPiles<thread-bound method manager pool>) and the method probe managers for each method (e.g., MethodPile<method probe manager 1>, MethodPile<method probe manager 2>, etc.) can be stored in the class probe manager of the corresponding class.

[0137] Next, the bytecode management scheduler can access the specific bytecode instructions in each method to analyze the method name, input parameter types, and return value types, and temporarily store them in the method's transient buffer. In this way, the method identifier (also known as the method's unique code) can be determined based on the method name and bytecode instructions (such as input parameter types and / or return value types). Furthermore, the method identifiers of each method can be stored in the corresponding method probe manager.

[0138] Furthermore, when accessing the specific bytecode instructions of each method, the bytecode management scheduler can analyze special instructions such as assignment instructions, jump instructions, or method call instructions, and then insert probes after these special bytecode instructions. After inserting probes, the bytecode management scheduler can also determine the probe index information of each method (such as the start probe index and end probe index) and obtain the current processing thread. The probe index information of each method can be stored in the corresponding method probe manager.

[0139] Thus, using the above method, class probe managers for each class and method probe managers for each method within a class can be established. The class probe manager can include the class ID, class name, and method probe managers for each method. The method probe managers can include the method identifiers for each method and the probe index information. Furthermore, after inserting the class probe manager into the corresponding version of the program, the corresponding version of the program will include the class ID, class name, method identifiers for each method, and probe index information for each probe. Therefore, when the program is executed to generate test records, the execution records for each class in the test records will include the class ID, class name, method identifiers for each method, and probe index information for each probe. In addition, the data processing method provided in this application can also be applied to any code coverage statistics tool (such as Jacoco). TM (etc.) and cloud computing / microservice ecosystems (such as the application service mesh (ASM) ecosystem). Furthermore, the solutions provided in this application are lightweight, have low overhead, and are highly efficient, making them suitable for real-world enterprise application scenarios.

[0140] Furthermore, in some embodiments, this application also provides a readable storage medium. The readable storage medium stores instructions that, when executed on an electronic device, cause the electronic device to perform the data processing method mentioned in this application.

[0141] Furthermore, in other embodiments, this application also provides a computer program product, wherein the computer program product includes computer instructions. When the computer instructions are executed on an electronic device, the electronic device can implement the data processing method mentioned in this application.

[0142] Furthermore, in other embodiments, this application also provides an electronic device. The electronic device includes at least one memory and at least one processor, with the memory coupled to the processor. The memory stores computer program code / instructions. When the computer program code / instructions are executed by the processor, the electronic device can implement the data processing methods mentioned in this application.

[0143] like Figure 6 The diagram illustrates the hardware structure of an electronic device 100 according to an embodiment of this application. The electronic device 100 can be a client or a server.

[0144] like Figure 6 As shown, the electronic device 100 may include one or more processors 102, a system control logic unit 101 connected to at least one of the processors 102, a system memory 105 connected to the system control logic unit 101, a memory 103 connected to the system control logic unit 101, and a network interface 107 connected to the system control logic unit 101.

[0145] It is understood that the structures illustrated in the embodiments of this application do not constitute a limitation on the only possible implementation of the electronic device 100. In other embodiments of this application, the electronic device 100 may include more or fewer components than illustrated, or combine some components, or split some components, or have different component arrangements. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.

[0146] Processor 102 may include one or more single-core or multi-core processors. In some embodiments, processor 102 may include any combination of general-purpose processors and special-purpose processors (e.g., application processors, baseband processors, etc.). It is understood that in this embodiment, processor 102 may be configured to execute executable instructions 104 stored in memory 103 to implement the data processing method of this embodiment. When at least one instruction 104 is executed in processor 102, electronic device 100 implements the data processing method of this embodiment.

[0147] System control logic unit 101 may include any suitable interface controller to provide any suitable interface to at least one of the processors 102 and / or any suitable device or component communicating with system control logic unit 101. System control logic unit 101 may include one or more memory controllers to provide an interface to system memory 105. System memory 105 may be used to load and store data and / or instructions. In some embodiments, system memory 105 of electronic device 100 may include any suitable volatile memory, such as suitable dynamic random access memory.

[0148] Memory 103 may include one or more tangible, non-transitory computer-readable media for storing data and / or instructions. In some embodiments, memory 103 may include any suitable volatile memory and / or any suitable non-volatile storage device, such as memory 103 may include random access memory (RAM) and / or cache memory cells, and may further include read-only memory (ROM).

[0149] The memory 103 may include a portion of the storage resources on the device on which the electronic device 100 is installed, or it may be accessible by the device, but is not necessarily part of the device. For example, the memory 103 may be accessed over a network via the network interface 107.

[0150] Specifically, system memory 105 and memory 103 may each include a temporary copy and a permanent copy of instruction 104. Instruction 104 may include, when executed by at least one of processors 102, causing electronic device 100 to implement the data processing method of the embodiments of this application. In some embodiments, instruction 104, hardware, firmware and / or its software components may additionally / alternatively be located in system control logic unit 101, network interface 107 and / or processor 102.

[0151] Network interface 107 may include a transceiver for providing a radio interface to electronic device 100, thereby enabling communication with any other suitable device (such as a front-end module, antenna, etc.) via one or more networks. In some embodiments, network interface 107 may be integrated into other components of electronic device 100. For example, network interface 107 may be integrated into at least one of processor 102, system memory 105, memory 103, and firmware device (not shown) with instructions.

[0152] Network interface 107 may further include any suitable hardware and / or firmware to provide a multiple-input multiple-output radio interface. For example, network interface 107 may be a network adapter, a wireless network adapter, a telephone modem, and / or a wireless modem.

[0153] The electronic device 100 may further include an input / output (I / O) device 106. The input / output device 106 enables a user to interact with the electronic device 100.

[0154] In some embodiments, the electronic device 100 may further include, but is not limited to, a display (e.g., a liquid crystal display, a touch screen display, etc.), a speaker, a microphone, one or more cameras (e.g., a still image camera and / or a video camera), a flashlight (e.g., a light-emitting diode flash) and a keyboard.

[0155] In some embodiments, the electronic device 100 further includes a sensor for determining at least one of environmental conditions or location information associated with the electronic device 100.

[0156] In some embodiments, the sensor may include, but is not limited to, a gyroscope sensor, an accelerometer, a proximity sensor, an ambient light sensor, and a positioning unit. The positioning unit may also be part of or interact with the network interface 107 to communicate with components of the positioning network, such as global positioning system (GPS) satellites.

[0157] The embodiments disclosed in this application can be implemented in hardware, software, firmware, or a combination of these implementation methods. Embodiments of this application can be implemented as computer programs or program code executable on a programmable system, the programmable system including at least one processor, a storage system (including volatile and non-volatile memory and / or storage elements), at least one input device, and at least one output device.

[0158] Program code can be applied to input instructions to execute the functions described in this application and generate output information. The output information can be applied to one or more output devices in a known manner. For the purposes of this application, the processing system includes any system having a processor such as, for example, a digit gate processor, a microcontroller, an application-specific integrated circuit, or a microprocessor.

[0159] The program code can be implemented using a high-level procedural language or an object-oriented programming language to communicate with the processing system. Assembly language or machine language can also be used when needed. In fact, the mechanisms described in this application are not limited to any particular programming language. In either case, the language can be a compiled language or an interpreted language.

[0160] In some cases, the disclosed embodiments may be implemented in hardware, firmware, software, or any combination thereof. The disclosed embodiments may also be implemented as instructions carried or stored thereon on one or more temporary or non-temporary machine-readable (e.g., computer-readable) storage media, which may be read and executed by one or more processors. For example, the instructions may be distributed via a network or through other computer-readable media. Therefore, machine-readable media may include any mechanism for storing or transmitting information in a machine-readable (e.g., computer-readable) form, including but not limited to floppy disks, optical disks, optical discs, magneto-optical disks, ROM, RAM, magnetic cards or optical cards, or tangible machine-readable memories for transmitting information using electrical, optical, acoustic, or other forms of propagation signals via the Internet (e.g., carrier waves, infrared signal digit gating, etc.). Therefore, machine-readable media include any type of machine-readable medium suitable for storing or transmitting electronic instructions or information in a machine-readable (e.g., computer-readable) form.

[0161] In the accompanying drawings, some structural or methodological features may be shown in a specific arrangement and / or order. However, it should be understood that such a specific arrangement and / or order may not be necessary. Rather, in some embodiments, these features may be arranged in a manner and / or order different from that shown in the illustrative drawings. Furthermore, including structural or methodological features in a particular figure does not imply that such features are required in all embodiments, and in some embodiments, these features may be omitted or may be combined with other features.

[0162] It should be noted that all units / modules mentioned in the device embodiments of this application are logical units / modules. Physically, a logical unit / module can be a physical unit / module, a part of a physical unit / module, or a combination of multiple physical units / modules. The physical implementation of these logical units / modules themselves is not the most important factor; the combination of functions implemented by these logical units / modules is the key to solving the technical problems proposed in this application. Furthermore, to highlight the innovative aspects of this application, the above-described device embodiments of this application have not introduced units / modules that are not closely related to solving the technical problems proposed in this application. This does not mean that the above-described device embodiments do not contain other units / modules.

[0163] It should be noted that in the examples and description of this application, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, 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 a process, method, article, or apparatus. Without further limitations, 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 said element.

[0164] Although this application has been illustrated and described with reference to certain preferred embodiments thereof, those skilled in the art will understand that various changes in form and detail may be made thereto without departing from the scope of this application.

Claims

1. A data processing method applied to electronic devices, characterized in that, include: Obtain the first test record of the first program of the first version and the second test record of the first program of the second version. The first test record includes the first execution record of the first type and the second test record includes the second execution record of the second type. The first type includes M methods. The first execution record indicates the method identifier of each of the M methods and the first execution status of the probe of each of the M methods. The second type includes N methods. The second execution record indicates the method identifier of each of the N methods and the second execution status of the probe of each of the N methods. The first execution status or the second execution status indicates whether the corresponding probe has been executed or not executed. Here, M and N are both positive integers. Based on the execution status of probes that have the same method identifier among the M methods and N methods, the first execution record and the second execution record are merged into a third execution record.

2. The method according to claim 1, characterized in that, The method of merging the first execution record and the second execution record into a third execution record based on the execution status of probes that combine the M methods and the N methods with the same method identifier includes: The first execution status of the probes of Q methods with the same method identifier and the same number of probes in the first execution record and the second execution record are merged with the second execution status of the Q methods in the second execution record to obtain the third execution status of the probes of each of the Q methods, where Q is a positive integer less than or equal to M and less than or equal to N. Based on the third execution status of the probes of the Q methods, a third execution record is obtained, wherein the third execution record includes the third execution status of the probes of the Q methods, or the third execution record includes the third execution status of the probes of the Q methods and the first execution status of the probes of MQ methods other than the Q methods in the first execution record, or the third execution record includes the third execution status of the probes of the Q methods and the second execution status of the probes of NQ methods other than the Q methods in the second execution record.

3. The method according to claim 2, characterized in that, The step of merging the first execution status of probes for Q methods with the same method identifier and the same number of probes in the first execution record and the second execution record with the second execution status of the Q methods in the second execution record to obtain the third execution status of probes for each of the Q methods includes: For any first probe of any first method among the Q methods, if at least one of the first execution state and the second execution state corresponding to the first probe indicates that the first probe has been executed, the third execution state corresponding to the first probe of the first method is configured to indicate that the first probe has been executed; or, If both the first execution state corresponding to the first probe and the second execution state corresponding to the first probe indicate that the first probe has not been executed, the third execution state corresponding to the first probe is configured to indicate that the first probe has not been executed.

4. The method according to claim 2, characterized in that, The first execution record indicates the method identifier of each of the M methods and the first execution status of the probe of each of the M methods, including: the first execution record includes a first probe array, the method identifier of each of the M methods, and the index information of the probe of each of the M methods in the first probe array, wherein the first probe array includes the execution status of all probes of the M methods; The second execution record indicates the method identifier of each of the N methods and the second execution status of the probes of each of the N methods, including: the second execution record includes a second probe array, the method identifier of each of the N methods, and the index information of the probes of each of the N methods in the second probe array, wherein the second probe array includes the execution status of all probes of the N methods.

5. The method according to claim 4, characterized in that, The third execution record includes the third execution status of the probes for the Q methods and the first execution status of the probes for the MQ methods (excluding the Q methods) in the first execution record, including: The third execution record includes a third probe array, a method identifier for each of the M methods, and the index information of the probes for each of the M methods in the third probe array. The third probe array includes the third execution status of all probes for the Q methods and the first execution status of all probes for the MQ methods in the first probe array. The index information of the probes for each of the M methods in the third probe array is the same as the index information of the probes for each of the M methods in the first probe array; or... The third execution record includes the third execution status of the probes for the Q methods and the second execution status of the probes for the NQ methods other than the Q methods in the second execution record, including: The third execution record includes a third probe array, a method identifier for each of the N methods, and index information of the probes for each of the N methods in the third probe array. The third probe array includes the third execution status of all probes for the Q methods and the second execution status of all probes for the NQ methods in the second probe array. The index information of the probes for each of the N methods in the third probe array is the same as the index information of the probes for each of the N methods in the second probe array.

6. The method according to claim 1, characterized in that, The first execution record also includes a first class identifier ID and a first class name of the first class, and the second execution record also includes a second class ID and a second class name of the second class, wherein the first class name is the same as the second class name, and the first class ID is different from the second class ID.

7. The method according to claim 1, characterized in that, The first execution record, the second execution record, and the third execution record all include a first field, which indicates the time during which the server stored the execution status of all probes for the M methods or the N methods; wherein, The first time indicated by the first field in the first execution record is later than the second time indicated by the first field in the second execution record, and the time indicated by the first field in the third execution record is the first time.

8. The method according to claim 1, characterized in that, The method identifier for each method is generated based on the name and bytecode of the corresponding method. The method identifier will be different if the name and / or bytecode of the corresponding method is different.

9. The method according to claim 8, characterized in that, The first program of the first version includes the first class name of the first class, the first class ID of the first class, and the method identifier of each of the M methods; The first program of the second version includes the second class name of the second class, the second class ID of the second class, and the method identifier of each of the N methods.

10. The method according to claim 9, characterized in that, The acquisition of the first test record of the first version of the first program and the second test record of the second version of the first program includes: The first test record is generated by executing the first program of the first version, or the first test record is obtained from an electronic device other than the electronic device; and / or, The second test record is generated by executing the first program of the second version, or by obtaining the second test record from another electronic device other than the electronic device.

11. An electronic device, characterized in that, include: At least one memory and at least one processor, the memory being coupled to the processor; the memory being used to store computer program code / instructions; when the computer program code / instructions are executed by the processor, causing the electronic device to implement the data processing method as described in any one of claims 1 to 10.

12. A readable storage medium, characterized in that, The readable storage medium stores instructions that, when executed on an electronic device, cause the electronic device to perform the data processing method as described in any one of claims 1 to 10.

13. A computer program product, characterized in that, include: Computer instructions, when executed on an electronic device, cause the electronic device to perform the data processing method as described in any one of claims 1 to 10.