File processing method and device, coverage rate acquisition method and device, electronic equipment and storage medium
By adding target parameters to the packaging command, the dependency packages are automatically imported and processed to generate a coverage toolkit, which solves the problems of high cost and low efficiency in code coverage testing and achieves efficient and low-cost code coverage collection.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-22
- Publication Date
- 2026-03-17
AI Technical Summary
Existing technologies for code coverage testing are costly and inefficient.
By adding target parameters to the packaging command, dependency packages are automatically imported and business source code is processed to generate a coverage toolkit, which in turn generates the target installation package, thus achieving code coverage collection.
It improves the deployment efficiency of code coverage collection, reduces deployment costs, and achieves automation and high efficiency in coverage collection.
Smart Images

Figure CN121680872A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of electronic information, and more particularly, to a file processing and coverage collection method and device, an electronic device, and a storage medium. BACKGROUND
[0002] Code coverage is an index for measuring the degree of source code being tested in software testing, and belongs to a software testing measurement method, which is mainly used for evaluating test integrity. In related technologies, there is a problem of high code coverage testing cost and low testing efficiency. SUMMARY
[0003] Therefore, embodiments of the present application provide a file processing and coverage collection method and device, an electronic device, and a storage medium.
[0004] In a first aspect, a file processing method is provided, which includes: in response to a packaging instruction for a business source code of a target business, if it is determined that the packaging instruction includes a target parameter, importing a dependency package for the target business; the target parameter is used to indicate that the target business has a coverage collection requirement; the dependency package includes a file for implementing code coverage collection for the target business; in response to successful import of the dependency package, processing the dependency package based on the business source code to obtain a coverage tool package; and based on a business source code packaging result of the business source code and the coverage tool package, determining a target installation package for the target business.
[0005] In a second aspect, a file processing method is provided, which includes: installing the target installation package to obtain a business program for the target business; the business program includes a business function module for implementing the target business and a collection function module for implementing code coverage collection for the target business; the target installation package is obtained according to the file processing method in the first aspect; in a running process of the business function module, the running process of the business function module is collected for code coverage by the collection function module to obtain target coverage data; and based on the target coverage data, a target coverage collection report is generated. In a third aspect, a file processing device is provided, which includes: an import module, configured to, in response to a packaging instruction for a business source code of a target business, if it is determined that the packaging instruction includes a target parameter, import a dependency package for the target business; the target parameter is used to indicate that the target business has a coverage collection requirement; the dependency package includes a file for implementing code coverage collection for the target business; a processing module, configured to, in response to successful import of the dependency package, process the dependency package based on the business source code to obtain a coverage tool package; and a determination module, configured to, based on a business source code packaging result of the business source code and the coverage tool package, determine a target installation package for the target business.
[0006] Optionally, the importing module is further configured to, in response to the packaging instruction for the service source code of the target service, if it is determined that the packaging instruction comprises the target parameter, inserting software development kit initialization code in an entry function of the service source code; and in response to completion of the insertion of the software development kit initialization code, importing the dependent package.
[0007] Optionally, the importing module is further configured to, in response to the packaging instruction for the service source code of the target service, if it is determined that the packaging instruction comprises the target parameter, scanning and processing the service source code by using a preset lexical analyzer to locate an entry file from the service source code; and locating an entry function in the entry file by using a locating program to start a function.
[0008] Optionally, the dependent package comprises target code, a container image file, and a software specification description file; the target code is used to implement code coverage collection for the target service; the processing module is further configured to, in response to successful importing of the dependent package, adding a runtime dependency to the container image file to obtain a target container image file; the coverage tool package comprises the target container image file; adding target reference logic to the software specification description file to obtain a target software specification description file; the target reference logic is logic in which the service source code references the target code; and the coverage tool package further comprises the target software specification description file.
[0009] Optionally, the processing module is further configured to embed the service source code in an image layer file of the coverage tool package.
[0010] In a fourth aspect, an embodiment of the present application provides a coverage collection device, the device comprising: an installation module configured to install a target installation package to obtain a service program for a target service; the service program comprising a service function module for implementing the target service and a collection function module for implementing code coverage collection for the target service; the target installation package being obtained according to the file processing method in the first aspect; a collection module configured to, during running of the service function module, collect code coverage of a running process of the service function module by using the collection function module to obtain target coverage data; and a generation module configured to generate a target coverage collection report based on the target coverage data.
[0011] Optionally, the collection function module comprises a listening thread and a control switch; and the collection module is further configured to, during running of the service function module, run the listening thread; and in response to the control switch entering an on state being detected by using the listening thread, collect code coverage of a running process of the service function module by using the collection function module to obtain target coverage data.
[0012] In a fifth aspect, an embodiment of the present application provides an electronic device comprising a processor and a memory; the memory stores computer readable instructions, and the computer readable instructions are executed by the processor to implement the method described above.
[0013] Sixthly, embodiments of this application provide a computer-readable storage medium storing computer-readable instructions that, when executed by a processor, implement the above-described method.
[0014] In a seventh aspect, embodiments of this application provide a computer program product including computer-readable instructions that, when executed by a processor, implement the method described above.
[0015] This application provides a file processing, coverage acquisition method, apparatus, electronic device, and storage medium. In this application, firstly, in response to a packaging instruction for the business source code of a target business including target parameters, a dependency package for the target business is imported. Then, in response to successful import of the dependency package, the dependency package is processed based on the business source code to obtain a coverage toolkit. Based on the business source code packaging result and the coverage toolkit, a target installation package for the target business is determined. Therefore, by simply adding target parameters to the packaging instruction, the dependency package containing files that implement code coverage acquisition for the target business can be automatically processed to obtain the coverage toolkit. Furthermore, the business source code packaging result and the coverage toolkit are combined into a target installation package for the target business. After installing the target installation package, the function of acquiring code coverage for the target business is obtained, eliminating the need for technicians to manually configure parameters and deploy dependency packages. This improves the deployment efficiency and reduces the deployment cost of the code coverage acquisition function, thereby achieving the goals of improving coverage acquisition efficiency and reducing coverage acquisition costs. Attached Figure Description
[0016] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0017] Figure 1 A schematic diagram is shown illustrating the application scenarios applicable to the embodiments of this application; Figure 2 A flowchart of a document processing method according to an embodiment of this application is shown; Figure 3 It shows Figure 2 A flowchart of step S110 in one embodiment is shown in the corresponding example; Figure 4 It shows Figure 2 A flowchart of step S120 in one embodiment is shown in the corresponding example; Figure 5 A flow chart of a coverage collection method according to an embodiment of the present application is shown in FIG. 1; Figure 6 A schematic diagram of a code coverage collection process according to an embodiment of the present application is shown in FIG. 2; Figure 7 A schematic diagram of another code coverage collection process according to an embodiment of the present application is shown in FIG. 3; Figure 8 A schematic diagram of a reporting process in the coverage collection method according to an embodiment of the present application is shown in FIG. 4; Figure 7 Figure 9 A block diagram of a file processing device according to an embodiment of the present application is shown in FIG. 5; Figure 10 A block diagram of a coverage collection device according to an embodiment of the present application is shown in FIG. 6; Figure 11 A structural block diagram of an electronic device for implementing the file processing method according to an embodiment of the present application is shown in FIG. 7. DETAILED DESCRIPTION
[0018] The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only some of the embodiments of the present application, but not all of the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work fall within the scope of protection of the present application.
[0019] In the following description, the terms "first\second" are merely to distinguish similar objects, and do not represent a specific order of the objects. Understandably, the "first\second" can be interchanged in a specific order or sequence as allowed, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein.
[0020] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which the present application belongs. The terms used herein are only for the purpose of describing the embodiments of the present application, and are not intended to limit the present application. It should be noted that "multiple" as mentioned herein refers to two or more. The association relationship of "and / or" describes the association relationship of the associated objects, which means that there can be three relationships, for example, A and / or B can represent the three cases of A alone, A and B together, and B alone. The character " / " generally represents an "or" relationship between the associated objects before and after it.
[0021] Please refer to Figure 1 Fig. 1 shows a schematic diagram suitable for the application scenarios to which the embodiments of the present application are applicable. The application scenario includes a business terminal 110 and a service terminal 120.
[0022] The business terminal 110 is, for example, a smart phone, a tablet computer, an e-book reader, a music player, a wearable device, a smart home device, a vehicle-mounted business terminal, etc. The business terminal 110 is installed with a request client, which is capable of sending a packaging instruction for a business source code of a target business to the service terminal 120 in response to a request operation of a user, so as to return a target installation package for the target business by the service terminal 120 in response to the packaging instruction.
[0023] The service terminal 120 can be a stand-alone physical server, a server cluster or a distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud service, cloud database, cloud computing, cloud function, cloud storage, network service, cloud communication, middleware service, domain name service, security service, CDN (Content Delivery Network), and big data and artificial intelligence platform.
[0024] In some embodiments, the packaging instruction for the business source code of the target business can also be initiated by a terminal (a device in communication with the business terminal 110 and the service terminal 120), so as to return the target installation package for the target business by the service terminal 120 to the business terminal 110 in response to the packaging instruction.
[0025] After the service terminal 120 returns the target installation package for the target business, the business terminal 110 can perform an installation operation on the target installation package to obtain a business program for the target business, at this time, the business program includes a business function module for implementing the target business and a collection function module for implementing code coverage collection for the target business.
[0026] After that, the business terminal 110 can collect code coverage for the running process of the business function module through the collection function module during the running process of the business function module, obtain target coverage data, and generate a target coverage collection report based on the target coverage data.
[0027] Of course, the business terminal 110 can collect code coverage for the running process of the business function module in response to a collection request of the service terminal 120, thereby returning the target coverage collection report to the service terminal 120 after the business terminal 110 generates the target coverage collection report, and the service terminal 120 displays the target coverage collection report.
[0028] It is worth mentioning that the collection request of the service end 120 can be sent by the terminal of the service end communication connection, that is, the user can trigger the collection request on the terminal, and the terminal sends the collection request to the service end. Based on the collection request, the service end 120 requests the business end 110 to collect the code coverage of the running process of the business function module, and obtains the target coverage collection report. After obtaining the target coverage collection report at the service end 120, the target coverage collection report can also be forwarded to the terminal, so that the user can view the target coverage collection report on the terminal.
[0029] Alternatively, the business end 110 automatically collects the code coverage of the running process of the business function module. Therefore, after the business end 110 generates the target coverage collection report, the business end 110 itself displays the target coverage collection report.
[0030] It is not difficult to understand that the business end 110 can also directly respond to the packaging instruction to obtain the business source code for the target business and the dependent package, and obtain the target installation package for the target business based on the business source code for the target business and the dependent package.
[0031] Similarly, after obtaining the target installation package, the service end 120 can also install the target installation package itself to deploy the business function module of the target business and the collection function module for collecting the code coverage of the target business on itself. That is, the service end 120 can implement the code coverage collection of the target business on itself to obtain the target coverage collection report.
[0032] For ease of explanation, in the following embodiments of the present application, the execution subject of the file processing method and the coverage collection method is taken as an electronic device for example.
[0033] Please refer to Figure 2 , Figure 2 A flowchart of a file processing method according to an embodiment of the present application is shown. The method is applied to an electronic device, which can be the service end 120 or the business end 110 in Figure 1 The method can include: S110, in response to the packaging instruction of the business source code for the target business, if it is determined that the packaging instruction includes the target parameter, importing the dependent package for the target business.
[0034] The target parameter is used to indicate that the target service has a coverage collection requirement. The dependency package includes files for implementing code coverage collection for the target service. For example, the dependency package can include target code, a container image file, and a software specification file. The target code is code for implementing code coverage collection for the target service. The container image file is a container image (Dockerfile) for the code coverage collection function. The software specification file is a specification file for the code coverage collection function.
[0035] The target service (also referred to as a target service) refers to a service that can be implemented by a program or a script. The target service can be, for example, a shopping service, a short video service, a music service, and a news service. The business source code of the target service refers to code required to implement the target service. Generally, to implement the target service, the business source code of the target service needs to be packaged into an installation package. After installing the installation package, an application program (or a script) is obtained, which can implement the target service.
[0036] The target parameter refers to a text, a symbol, or a combination of a text and a symbol, or the like, used to indicate that the target service has a coverage collection requirement. For example, the target parameter can be “--enable-coverage”. When the packaging instruction includes “--enable-coverage”, it is determined that the target service has a coverage collection requirement, and a dependency package including files for implementing code coverage collection for the target service is obtained.
[0037] Of course, to implement the function of collecting code coverage for the target service, the electronic device can create the dependency package. The dependency package can be a software development kit (Software Development Kit, SDK) for go cover (Go language) and coverage.py (Python language).
[0038] For example, for the Go language, the go-coverage-sdk is built as a dependency package. Based on the official Go cover instrumentation mode, an http communication module is added on the basis of the code coverage counting logic to support bidirectional data transmission with the collection platform. An in-process cache component is encapsulated to temporarily store coverage data that has not been uploaded, thereby avoiding data loss caused by single-point failure.
[0039] For example, for the Python language, the py-coverage-sdk is built as a dependent package: the statement tracking mechanism of coverage.py is reused (common features), the signal listening module is extended, and the "real-time collection" and "data clearing" instructions sent by the collection platform can be responded to; a thread pool management component is added to ensure that the coverage data uploading operation does not block the business main thread.
[0040] Of course, in order to support the Python language and the Go language, the dependent package can include both py-coverage-sdk and go-coverage-sdk, so that when a packaged instruction including a target parameter is received, the language environment to which the business source code of the target business belongs is determined, one of the language environments to which the business source code of the target business belongs is selected as a dependent package to be processed, and then the dependent package to be processed is imported.
[0041] For example, as described above, when the packaging operation is performed on the server side and the target business is implemented on the business side, in order to realize the communication between the server side and the business side, a plurality of API interfaces can also be built, for example, the API interfaces built can include the following three (of course, more API interfaces can be set based on requirements, and the present application is not limited) : Register(serviceId, version string): initialize the SDK (i.e., the aforementioned py-coverage-sdk and go-coverage-sdk), receive the name, version number, and other metadata of the target business, and automatically trigger the registration process with the server side; Collect(moduleName string) (Report, error): specify the module name to collect coverage data (for code coverage collection on the specified module of the target business), and generate a compressed package containing coverage data and code execution reports; Heartbeat(): the electronic device periodically (e.g., every 30 seconds) sends a heartbeat packet to the server side, which contains the current process ID, memory occupation, and other running state information of the business side.
[0042] The electronic device can determine whether the packaging instruction includes a target parameter in response to the target packaging instruction (which can be triggered by the electronic device or sent by the user to the electronic device through the terminal), and if the target parameter is included, obtain a corresponding dependency package based on a language environment to which the business source code of the target business belongs, for example, if the language environment to which the business source code of the target business belongs is a go language environment, import go-coverage-sdk as a dependency package, and if the language environment to which the business source code of the target business belongs is a Python language environment, import py-coverage-sdk as a dependency package.
[0043] S120, in response to successful import of the dependency package, processing the dependency package based on the business source code to obtain a coverage tool package.
[0044] After successful import of the dependency package, the dependency package is processed based on the business source code to modify the information included in the files in the dependency package, and a coverage tool package is obtained. By processing the dependency package, the target code in the dependency package can be referenced during the running of the business source code of the target business, so as to deploy the coverage tool package by referencing the target source code, and obtain a function module for collecting code coverage of the target business, i.e., a collection function module.
[0045] S130, determining a target installation package for the target business based on the business source code packaging result of the business source code and the coverage tool package.
[0046] The business source code packaging result of the business source code is a business installation package for implementing the target business, and the coverage tool package is a collection installation package for implementing code coverage collection of the target business. The business installation package and the collection installation package constitute the target installation package for the target business.
[0047] In this embodiment, first, in response to the packaging instruction for the service source code of the target service including the target parameter, the dependent package for the target service is imported, and then, in response to the successful import of the dependent package, the dependent package is processed based on the service source code to obtain the coverage tool package; based on the service source code packaging result of the service source code and the coverage tool package, the target installation package for the target service is determined, thereby, only by adding the target parameter in the packaging instruction, the dependent package including the file for implementing the code coverage collection for the target service can be automatically processed to obtain the coverage tool package, and the service source code packaging result of the service source code and the coverage tool package are summarized as the target installation package for the target service, so that after the target installation package is installed, the function of collecting the code coverage for the target service can be obtained, and manual configuration of parameters and manual deployment of the dependent package are not required to implement the function of collecting the code coverage for the target service, the deployment efficiency of the code coverage collection function is improved, the deployment cost of the code coverage collection function is reduced, and the target of improving the coverage collection efficiency and reducing the coverage collection cost is achieved.
[0048] In some embodiments, as shown in FIG. 11, Figure 3 S110 can include: S111, in response to the packaging instruction for the service source code of the target service, if it is determined that the packaging instruction includes the target parameter, inserting the software development kit initialization code in the entry function of the service source code.
[0049] That is, first, the entry function is located in the service source code, and then the software development kit initialization code is inserted in the entry function of the service source code, so that when the service source code starts to run, the coverage tool package obtained is initialized through the software development kit initialization code, the deployment of the coverage tool package is implemented, and the function module for collecting the code coverage for the target service, i.e., the collection function module, is obtained.
[0050] Optionally, S111 can include: in response to the packaging instruction for the service source code of the target service, if it is determined that the packaging instruction includes the target parameter, scanning and processing the service source code through a preset lexical analyzer to locate the entry file from the service source code; locating the entry function in the entry file through the locating program startup function.
[0051] The packaging tool of the server (a tool for packaging and processing the service source code of the target service) can customize a lexical analyzer, which can be based on an ast lexical analyzer, and the service source code is scanned and processed through the lexical analyzer to locate the entry file: in a Go language environment, the entry file can be main.go, in a Python language environment, the entry file is __main__.py or a specified entry script, etc.
[0052] After obtaining the entry file, the entry function can be located by locating the program startup function (func main() in Go and if __name__ == "__main__": code block in Python).
[0053] After locating the entry function, software development kit (SDK) initialization code can be inserted into the entry function of the business source code. The SSD initialization code can be "cover_sdk.init". The location for inserting the SSD initialization code can be any line in the entry function. For example, the SSD initialization code "cover_sdk.init" can be automatically inserted into the first line of the entry function.
[0054] S112. In response to the completion of the software development kit initialization code insertion, import the dependency packages.
[0055] After inserting the software development kit initialization code, you can import the dependency packages. The process of importing dependency packages is as described above and will not be repeated here.
[0056] In this embodiment, software development kit (SDK) initialization code is inserted into the business source code of the target business so that the coverage toolkit obtained by the SSD initialization code can be initialized when the business source code of the target business is running, thereby deploying the coverage toolkit and obtaining the functional module for code coverage collection of the target business—the collection functional module, thus realizing the automatic deployment of the collection functional module.
[0057] Meanwhile, the entry function is quickly located by using a lexical analyzer and a program startup function, which improves the efficiency of entry function location and facilitates the rapid insertion of software development kit (SDK) initialization code, thus improving the insertion efficiency of SSD initialization code.
[0058] Furthermore, automatic packaging is triggered by configuring target parameters in the packaging command to achieve lexical analysis and automatic code injection without modifying the business source code or configuration files. This solves the problem of strong dependence on compilation parameters and source code paths in traditional tools, and seamlessly adapts to modern deployment environments such as containerization and Kubernetes, achieving zero-intrusion deployment of code coverage collection functions.
[0059] In some embodiments, such as Figure 4 As shown, S120 also includes: S121. In response to the successful import of the dependency package, add runtime dependencies to the container image file to obtain the target container image file.
[0060] The coverage toolkit includes the target container image file.
[0061] S122. Add target reference logic to the software specification document to obtain the target software specification document.
[0062] The target reference logic is the logic by which the business source code references the target code; the coverage toolkit also includes the target software specification document.
[0063] In other words, the Dockerfile of the container image is dynamically updated to add runtime dependencies, and the spec file (software specification file) is dynamically modified to add target reference logic in the spec file. This ensures that the business source code is included in the rpm / image of the dependency package to obtain the initialization coverage toolkit. Thus, when the coverage toolkit is initialized, the goal of the business source code referencing the target code can be achieved.
[0064] In some embodiments, after S122, the method further includes: embedding the business source code into the image layer file of the coverage toolkit. This ensures that the coverage toolkit includes the business source code. After deploying a collection function module that performs code coverage collection on the target business using the coverage toolkit, the target coverage collection report generated by the collection function module can include not only an index of the business source code but also the specific business source code, facilitating users to quickly locate code faults based on the target coverage collection report.
[0065] In this embodiment, a coverage toolkit is obtained by modifying the dependency package. This facilitates the deployment and installation of the coverage toolkit when installing the target installation package of the target business, thereby obtaining a collection function module for code coverage collection of the target business. This eliminates the need to manually install the coverage toolkit to obtain the collection function module for code coverage collection of the target business, improving the deployment efficiency of the collection function module and reducing its deployment cost.
[0066] Meanwhile, by embedding the business source code into the image layer file of the coverage toolkit, the target coverage collection report generated by the collection function module can include not only the index of the business source code, but also the specific business source code, making it easier for users to quickly locate code faults based on the target coverage collection report.
[0067] Please see Figure 5 , Figure 5 This application illustrates a flowchart of a coverage acquisition method according to an embodiment of the present application. The method is applied to an electronic device, which may be... Figure 1 The methods for server-side 120 or business-side 110 can include: S210. Install the target installation package to obtain the business program for the target business.
[0068] The business program includes business function modules that implement the target business and a data collection function module that performs code coverage collection on the target business. The target installation package is obtained according to the method described in the previous embodiment. That is, after the business source code is packaged and installed, the business function modules that implement the target business are obtained, and after the coverage toolkit is installed, the data collection function module that performs code coverage collection on the target business is obtained.
[0069] It is worth mentioning that when the packaging operation is performed on the server side and the target business is implemented on the business side, the target installation package is installed on the business side to enable the deployment of the data collection function module and the business function module on the business side.
[0070] S220. During the operation of the business function module, code coverage data is collected by the data collection function module to obtain the target coverage data.
[0071] In other words, during the operation of the business function module, code coverage is collected by the data collection function module to obtain the collection results, which are used as target coverage data.
[0072] Optionally, the data acquisition module includes a listening thread and a control switch; correspondingly, S220 may include: running the listening thread during the operation of the business function module; in response to the listening thread detecting that the control switch has entered the on state, the data acquisition module performs code coverage acquisition on the operation process of the business function module to obtain target coverage data.
[0073] Typically, the default configuration can be to start only the listening thread, which listens to determine whether the data acquisition module needs to be enabled. In this case, the data acquisition module is disabled by default, i.e., coverage.enable=false is the default parameter in the configuration file. Moreover, only the listening program runs, with CPU usage <0.1% and memory usage <10MB. No code instrumentation or coverage recording logic is executed, resulting in virtually no performance loss and significantly saving energy for electronic devices.
[0074] The dependency package can also include the ` / api / coverage / enable` or ` / api / coverage / disable` interfaces. Both of these interfaces can implement the control switch functionality. Therefore, after obtaining and installing the target installation package that includes the coverage toolkit, the control switch can be obtained. Subsequently, the state of the control switch (enable=true / false, or disable=true / false) can be modified (either locally or remotely). When the control switch is in the enabled state, code coverage can be collected periodically, obtaining one target coverage data point each time, thus achieving automatic periodic detection. Furthermore, after the control switch state changes, the update of the control switch state can be detected by periodic heartbeat detection of the listening thread, eliminating the need to manually restart the control switch's control function each time.
[0075] In some implementations, when the control switch is set to true, code coverage is automatically collected. Once the collection is complete, the control switch is set to false, and the code coverage collection function is immediately stopped, thus enabling on-demand collection.
[0076] Understandably, the timing of the control switch's state switching can also be set based on requirements. For example, the control switch can be switched to the on state within a specified period of time to achieve code coverage collection within that period. Or, the control switch can be switched to the on state when a target event occurs on the business side to achieve code coverage collection through the target event. The target event can be the start, interruption, or background operation of the target business.
[0077] S230. Generate a target coverage data collection report based on the target coverage data.
[0078] Once the target coverage data is obtained after code coverage collection for the target business, a report can be generated based on the target coverage data as the target coverage collection report.
[0079] In this embodiment, the code coverage is collected by the collection function module to obtain the target coverage collection report, thereby realizing the automation of code coverage collection. Moreover, the generated target coverage collection report includes the source code path of the business source code, making the target coverage collection report more accurate and detailed.
[0080] For example, when the server is a coverage collection platform and the business side is a business node, the code coverage collection process is as follows: Figure 6 As shown.
[0081] The business nodes include business node 1 and business node 2. Business node 1 implements business 1 and business 2, and business node 2 implements business 3 and business 4. The collection function module in the node used to collect the code coverage of the business implementation is the coverage SDK.
[0082] 1. Registration First, each business node registers a coverage collection service with the coverage collection platform based on its own business, obtaining a corresponding collection service component. Each business node corresponds to one collection service component, and the coverage collection functions of each business within a business node are managed through that business node's collection service component. For example, the coverage collection functions of business 1 and business 2 of business node 1 are managed through collection service component 1. Collection service component 1 is used to manage the running status of the coverage SDKs of business 1 and business 2 through commands or requests. Similarly, the coverage collection functions of business 3 and business 4 of business node 2 are managed through collection service component 2. Collection service component 2 is used to manage the running status of the coverage SDKs of business 3 and business 4 through commands or requests.
[0083] 2. Data collection service instances are stored in the database. After each business node registers its code coverage collection service on the coverage collection platform, the platform stores the service instance information of the collection service that performs code coverage collection on the business into the database, thus achieving the storage of service instances of the collection service in the database. The database can be based on Redis or MySQL.
[0084] For each business node, the service instance information of the collection service of that node may include the business service information of each business in that node, the node information of the business node, and the module information of the modules in each business in the business node that can be used for code coverage collection.
[0085] 3. Code coverage collection Users can trigger code coverage collection by initiating a code coverage collection request through the terminal or at the business node. The business targeted by the code coverage collection request is called the specified business. Of course, the code coverage collection request can also be targeted at a specific module within a specified business. The specified business can be a single business or multiple businesses, and the specified module can also be a single module or multiple modules.
[0086] 4. Obtain service instance information for the data collection service. After receiving a coverage collection request, the coverage collection platform retrieves the service instance information of the collection service targeted by the coverage collection request from the database, so as to create a collection task based on the retrieved service instance information.
[0087] 5. Return Task ID After the coverage data collection platform creates a data collection task, it returns the task ID to the user and provides the user with relevant information about the data collection task.
[0088] 6. Data Collection The coverage acquisition platform can also respond to coverage acquisition requests by performing coverage acquisition on the business nodes through the acquisition service component (this can be done asynchronously for fast acquisition). For example, acquisition service component 1 can initiate acquisition requests to business 1 and business 2 of business node 1. The coverage SDKs of business 1 and business 2 of business node 1 respond to the acquisition requests, perform code coverage acquisition on business 1 and business 2, obtain the acquired coverage data, and generate a coverage acquisition report based on the coverage data.
[0089] 7. Obtain the report Users can obtain coverage collection reports from the coverage collection platform to view the code coverage status of their business based on the coverage collection reports.
[0090] Specifically, the code coverage collection process can also be like... Figure 7 As shown.
[0091] Users initiate coverage collection requests through terminals, triggering coverage collection. The coverage collection platform receives the coverage collection request through the interface layer. Then, the coverage collection platform (from the database) obtains the service instance information of the collection service specified in the coverage collection request, and encapsulates the coverage collection task (referred to as the collection task) based on the obtained service instance information of the collection service.
[0092] Then, the coverage acquisition platform adds the acquisition tasks to the task scheduler, which then schedules the acquisition tasks.
[0093] After the task scheduler retrieves the collection task, it sends the collection task to the registration center. The registration center maintains the collection service components of each business node. The collection service components call the interface to access the coverage SDK of each business in the business node, so as to control the coverage SDK to perform coverage collection on the business and obtain coverage data.
[0094] After the coverage SDK on the business node completes coverage collection and generates a coverage collection report, it can push the coverage collection report to the coverage collection platform. The coverage collection platform receives the coverage collection report through the interface layer and continues to execute the reporting process.
[0095] If the coverage SDK fails at a business node, failure data can be pushed to the coverage collection platform. The coverage collection platform receives the failure data through the interface layer and continues the reporting process. The failure data indicates specific information about the failure or the reason for the failure.
[0096] The reporting process of the coverage data collection platform is as follows: Figure 8 As shown, firstly, the task manager obtains the push data of the collection tasks and updates the collection task success / failure list based on the obtained data. Then, it is confirmed that all collection tasks have been pushed successfully (whether all collection tasks have completed the push of data). If not, the task manager continues to obtain the push data of the collection tasks. If so, the collection task success / failure list is updated as the final collection task success / failure list, so that the success or failure status of the collection tasks can be viewed through the collection task success / failure list.
[0097] Of course, the service instance information of the collection service is stored in a database, which can be based on Redis or MySQL. The database stores the service instance information of all registered (referring to collection services that have registered the coverage collection function) and supports querying the instance list by the dimension of "service name of collection service + environment (language environment of business node)".
[0098] The coverage collection platform can be configured with a task scheduler. The task scheduler receives coverage collection requests initiated by users through the web interface or client, allocates collection tasks according to the load status of business nodes, and supports two modes: "single instance precise collection" and "service cluster batch collection".
[0099] Users can use API calls to select the business module for which code coverage data collection is needed and the collection mode (real-time collection or scheduled collection). When the collection time is reached, the task scheduler sends a collection request to the corresponding business, and the coverage SDK (i.e., the collection function module) of the business receiving the collection request then performs the code coverage data collection function for that business.
[0100] After the business service starts, the SDK automatically calls CoverageInit to complete registration and reports metadata to the coverage collection platform. The coverage collection platform sends collection commands through the command scheduler. After receiving the commands, the collection function modules call the Collect interface to obtain data for the specified modules. The collection function modules report the collection results to the coverage collection platform via the HTTP protocol. The coverage collection platform stores the data and updates the task status.
[0101] When a user triggers the "clear data" operation, the coverage acquisition platform sends a reset command to the acquisition function module, which then clears the coverage count in its local cache.
[0102] To address the security and stability requirements of the production environment, and considering the specific characteristics of coverage data collection scenarios, a deployment architecture and dynamic activation scheme adapted to the production environment are designed, as follows: Core adaptation goals for the production environment: Two key obstacles need to be addressed: first, avoiding the security risks of "open firewall ports"; and second, eliminating the usual performance overhead of coverage collection on business service CPU and memory, ensuring that collection capabilities do not affect the core operation of production services.
[0103] Deployment architecture design: The Cover-server deployment adopts a "single-node lightweight collector" mode. The operating mode of Cover-server is controlled by the packaging parameter --cover-server-mode=single-node. The core design is as follows: No external dependencies: In single-node (single business node) mode, the data collection service component created by each node does not depend on external database components such as MySQL and Redis. All data collection metadata and temporary coverage data are stored in the program's local memory, eliminating the need for cross-node communication and avoiding the need to open additional firewall ports.
[0104] Automatic data cleanup: After coverage data collection is completed and a report is generated, the system automatically clears temporary data in memory (leaving the report file to a specified path) to prevent resource leaks caused by long-term memory occupation.
[0105] Deployment location: Deploying the single-node data collection service component and business services within the same host / container network and communicating via the local loopback address (127.0.0.1) can completely avoid the risk of cross-node port exposure.
[0106] Performance loss control scheme: A "dynamic on / off control + on-demand startup" mechanism can be adopted, which is implemented through configuration files and platform interfaces. The specific logic is as follows: Coverage collection is disabled by default: When the coverage collection function is initialized (when the coverage toolkit is installed), the default parameter coverage.enable=false in the configuration file is read, and only the "on / off listening thread" is started (CPU usage < 0.1%, memory usage < 10MB). Code instrumentation and coverage recording logic are not executed, resulting in virtually no performance loss. Remote switch control: Provides / api / coverage / enable and / api / coverage / disable interfaces to control the switch. Technical support personnel can modify the switch status (enable=true / false) through the remote API interface. After the switch is changed, the coverage SDK detects the adjustment of the control switch status by the remote API interface through a 30-second periodic heartbeat detection, without the need to manually restart the data collection service. On-demand registration and collection: When the switch is turned to true, the coverage SDK automatically initiates local registration with the collection service component of the same business node (via the address 127.0.0.1). After successful registration, the code starts executing the recording logic; after collection is completed, the control switch is turned to false, and the coverage SDK immediately stops recording and releases related resources. After identifying business issues based on code coverage reports, the troubleshooting process is as follows: When a business anomaly occurs in the production environment and it is necessary to locate the "code execution path" using coverage data, technical support personnel can follow these steps without needing to operate any business services: Enable switch: Call the / api / coverage / switch interface of the data collection service component to set the control switch for coverage data collection of the target node to true.
[0107] Instance registration verification: Check the successfully registered service instances via the / api / v1 / service / 127.0.0.1 interface.
[0108] Triggering data collection: After reproducing the anomaly, the specified module of the specified business is initiated through the / api / coverage / collect interface to send a data collection command. The coverage SDK reports the coverage data to the data collection service component in real time.
[0109] Report generation and analysis: After aggregating data from the service components, an execution report with source code path is generated. Technical service personnel can view the code execution trajectory in abnormal scenarios through the report and locate the code segments that are not covered or executed abnormally.
[0110] Resource recycling: After the investigation is completed, call the switch interface to set coverage.enable to false. The coverage SDK will automatically stop collecting data and clear the local cache, restoring the system to a state with no performance loss.
[0111] The solution has the following advantages: Zero-intrusive integration: Lexical analysis and automatic code injection are triggered by packaging parameters, without requiring business users to modify source code or configuration files. This solves the problem of strong dependence on compilation parameters and source code paths in traditional tools and is seamlessly adapted to modern deployment environments such as containerization and Kubernetes.
[0112] Real-time data collection capability: Breaking through the limitations of open-source tools that "generate static reports after process exit", it supports dynamic collection of single / multi-module data at runtime, and works with a unified platform to achieve 24 / 7 uninterrupted monitoring, meeting the continuous analysis needs of long lifecycle services.
[0113] Flexible module collection: Compared to the module selection limitations of the goc tool, the platform can precisely specify the collection scope, supporting multiple modes such as single instance and cluster batch, adapting to complex scenarios of distributed systems.
[0114] The report is intuitive and easy to use: It generates a visual report with source code path by aggregating data from multiple instances, including details such as execution path and coverage trend, providing direct basis for testing and verification and troubleshooting, and reducing the difficulty of problem location.
[0115] High reliability: The data collection success rate is over 99.9%. The distributed deployment of cover-server avoids data collection failures caused by single points of failure, and achieves uninterrupted operation in a test cluster with 10,000+ service instances.
[0116] Low resource overhead: The coverage SDK adopts an asynchronous thread pool and lightweight communication protocol design, which has a negligible impact on the CPU and memory usage of business services and does not affect the normal operation of online services.
[0117] Please see Figure 9 , Figure 9 This illustration shows a block diagram of a document processing apparatus according to an embodiment of the present application. The document processing apparatus 800 includes: Import module 810 is used to respond to the packaging instructions for the business source code of the target business. If it is determined that the packaging instructions include target parameters, the dependency packages for the target business are imported. The target parameters are used to indicate that the target business has a coverage collection requirement. The dependency packages include files that implement code coverage collection for the target business. Processing module 820 is used to process the dependency package based on the business source code in response to the successful import of the dependency package, and obtain the coverage toolkit. Module 830 is used to determine the target installation package for the target business based on the business source code packaging results and coverage toolkit.
[0118] Optionally, the import module 810 is also used to respond to the packaging instruction for the business source code of the target business. If it is determined that the packaging instruction includes target parameters, the software development kit initialization code is inserted into the entry function of the business source code; in response to the completion of the insertion of the software development kit initialization code, the dependency package is imported.
[0119] Optionally, the import module 810 is also used to respond to the packaging instruction of the business source code for the target business. If it is determined that the packaging instruction includes target parameters, the business source code is scanned by a preset lexical parser to locate the entry file from the business source code; the entry function is located in the entry file by locating the program startup function.
[0120] Optionally, the dependency package includes target code, a container image file, and a software specification file; the target code is the code used to collect code coverage for the target business; the processing module 820 is also used to add runtime dependencies to the container image file in response to the successful import of the dependency package, thereby obtaining the target container image file; the coverage toolkit includes the target container image file; target reference logic is added to the software specification file to obtain the target software specification file; the target reference logic is the logic of the business source code referencing the target code; the coverage toolkit also includes the target software specification file.
[0121] Optionally, the processing module 820 is also used to embed the business source code into the image layer file of the coverage toolkit.
[0122] Please see Figure 10 , Figure 10 This illustration shows a block diagram of a coverage acquisition device according to an embodiment of this application. The coverage acquisition device 1000 includes: Installation module 910 is used to install the target installation package to obtain a business program for the target business; the business program includes a business function module that implements the target business and a collection function module that implements code coverage collection for the target business; the target installation package is obtained according to the file processing method in the aforementioned embodiment; The acquisition module 920 is used to collect code coverage data during the operation of the business function module and obtain the target coverage data. The generation module 930 is used to generate a target coverage acquisition report based on the target coverage data.
[0123] Optionally, the acquisition function module includes a listening thread and a control switch; the acquisition module 910 is also used to run the listening thread during the operation of the business function module; in response to the listening thread detecting that the control switch has entered the on state, the acquisition function module performs code coverage acquisition on the operation process of the business function module to obtain target coverage data.
[0124] It should be noted that the device embodiments in this application correspond to the aforementioned method embodiments. The specific principles in the device embodiments can be found in the content of the aforementioned method embodiments, and will not be repeated here.
[0125] Figure 11A structural block diagram of an electronic device for performing a document processing method according to an embodiment of this application is shown. The electronic device may be... Figure 1 For example, the business side can use 110 or the server side can use 120, etc. It should be noted that... Figure 11 The computer system 1200 of the electronic device shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of this application.
[0126] like Figure 11 As shown, the computer system 1200 includes a Central Processing Unit (CPU) 1201, which can perform various appropriate actions and processes, such as executing the methods described in the above embodiments, based on programs stored in Read-Only Memory (ROM) 1202 or programs loaded from storage portion 1208 into Random Access Memory (RAM) 1203. The RAM 1203 also stores various programs and data required for system operation. The CPU 1201, ROM 1202, and RAM 1203 are interconnected via a bus 1204. An Input / Output (I / O) interface 1205 is also connected to the bus 1204.
[0127] The following components are connected to I / O interface 1205: an input section 1206 including a keyboard, mouse, etc.; an output section 1207 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and speakers, etc.; a storage section 1208 including a hard disk, etc.; and a communication section 1209 including a network interface card such as a LAN (Local Area Network) card, modem, etc. The communication section 1209 performs communication processing via a network such as the Internet. A drive 1210 is also connected to I / O interface 1205 as needed. Removable media 1211, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., are installed on drive 1210 as needed so that computer programs read from them can be installed into storage section 1208 as needed.
[0128] Specifically, according to embodiments of this application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this application include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication section 1209, and / or installed from removable medium 1211. When the computer program is executed by central processing unit (CPU) 1201, it performs various functions defined in the system of this application.
[0129] It should be noted that the computer-readable medium shown in the embodiments of this application can be a computer-readable signal medium, a computer-readable storage medium, or any combination of the two. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM), flash memory, optical fiber, portable compact disc read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this application, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In this application, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such transmitted data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. The computer-readable signal medium can also be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to wireless, wired, etc., or any suitable combination thereof.
[0130] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. Each block in a flowchart or block diagram may represent a module, segment, or portion of code, which contains one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer-readable instructions.
[0131] The units described in the embodiments of this application can be implemented in software or hardware, and the described units can also be located in a processor. The names of these units do not necessarily limit the specific unit itself.
[0132] In another aspect, this application also provides a computer-readable storage medium, which may be included in the electronic device described in the above embodiments; or it may exist independently and not assembled into the electronic device. The aforementioned computer-readable storage medium carries computer-readable instructions that, when executed by a processor, implement the methods in any of the above embodiments.
[0133] According to one aspect of the embodiments of this application, a computer program product is provided, the computer program product including computer-readable instructions stored in a computer-readable storage medium. A processor of an electronic device reads the computer-readable instructions from the computer-readable storage medium, and the processor executes the computer-readable instructions, causing the electronic device to perform the methods of any of the above embodiments.
[0134] In the embodiments of this application, the terms "module" or "unit" refer to a part of a computer program with a predetermined function, which works together with other related parts to achieve a predetermined goal, and can be implemented wholly or partially using software, hardware (e.g., processing circuitry or memory), or a combination thereof. Similarly, a processor (or multiple processors or memory) can be used to implement one or more modules or units. Furthermore, each module or unit can be part of an overall module or unit that functions as a whole.
[0135] It should be noted that although several modules or units for the device used to perform actions have been mentioned in the detailed description above, this division is not mandatory. In fact, according to the embodiments of this application, the features and functions of two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided and embodied by multiple modules or units.
[0136] Through the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein can be implemented by software or by combining software with necessary hardware. Therefore, the technical solutions according to the embodiments of this application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (such as a CD-ROM, USB flash drive, external hard drive, etc.) or on a network, including several instructions to cause an electronic device (such as a personal computer, server, touch terminal, or network device, etc.) to execute the methods according to the embodiments of this application.
[0137] Other embodiments of this application will readily conceive of by those skilled in the art upon consideration of the specification and practice of the embodiments disclosed herein. This application is intended to cover any variations, uses, or adaptations of this application that follow the general principles of this application and include common knowledge or customary techniques in the art not disclosed herein. It should be understood that this application is not limited to the precise structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this application is limited only by the appended claims.
[0138] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application.
Claims
1. A file processing method characterized by, The method comprises: in response to a packaging instruction of a service source code of a target service, if it is determined that the packaging instruction comprises a target parameter, importing a dependent package for the target service; the target parameter is used to indicate that the target service has a coverage collection requirement; the dependent package comprises a file for realizing code coverage collection of the target service; in response to successful importing of the dependent package, processing the dependent package based on the service source code to obtain a coverage tool package; based on a service source code packaging result of the service source code and the coverage tool package, determining a target installation package for the target service.
2. The method of claim 1, wherein, The method comprises: in response to a packaging instruction of a service source code of a target service, if it is determined that the packaging instruction comprises a target parameter, inserting software development kit initialization code in an entry function of the service source code; in response to completion of insertion of the software development kit initialization code, importing the dependent package.
3. The method of claim 2, wherein, The method comprises: in response to a packaging instruction of a service source code of a target service, if it is determined that the packaging instruction comprises a target parameter, scanning and processing the service source code by using a preset lexical analyzer to locate an entry file from the service source code; locating the entry function in the entry file by locating a program startup function.
4. The method of claim 1, wherein, The dependent package comprises target code, a container image file and a software specification description file; the target code is code for realizing code coverage collection of the target service; The method comprises: in response to successful importing of the dependent package, processing the dependent package based on the service source code to obtain a coverage tool package; in response to successful importing of the dependent package, adding runtime dependencies to the container image file to obtain a target container image file; the coverage tool package comprises the target container image file; 5. The method of claim 4, wherein, adding target reference logic to the software specification description file to obtain a target software specification description file; the target reference logic is logic for the service source code to reference the target code; the coverage tool package further comprises the target software specification description file. The method further comprises:
6. A coverage collection method characterized by, embedding the service source code into an image layer file of the coverage tool package. The method comprises: installing a target installation package to obtain a service program for the target service; the service program comprises a service function module for realizing the target service and a collection function module for realizing code coverage collection of the target service; the target installation package is obtained according to the method in any one of claims 1-5; in a running process of the service function module, collecting code coverage of the running process of the service function module by using the collection function module to obtain target coverage data; generating a target coverage collection report based on the target coverage data.
7. The method of claim 6, wherein, The collection function module comprises a monitoring thread and a control switch; The code coverage collection of the running process of the business function module is performed by the collection function module to obtain target coverage data during the running process of the business function module, comprising: The monitoring thread is run during the running process of the business function module; In response to the control switch entering the on state through the monitoring thread, the code coverage collection of the running process of the business function module is performed by the collection function module to obtain target coverage data.
8. A file processing apparatus characterized by comprising: The device comprises: The import module is configured to, in response to a packaging instruction for a business source code of a target business, if it is determined that the packaging instruction comprises a target parameter, import a dependent package for the target business; the target parameter is used to indicate that the target business has a coverage collection requirement; and the dependent package comprises a file for implementing code coverage collection of the target business. The processing module is configured to, in response to successful import of the dependent package, process the dependent package based on the business source code to obtain a coverage tool package. The determination module is configured to determine a target installation package for the target business based on a business source code packaging result of the business source code and the coverage tool package.
9. A coverage collection apparatus characterized by comprising: The device comprises: The installation module is configured to install the target installation package to obtain a business program for the target business; the business program comprises a business function module for implementing the target business and a collection function module for implementing code coverage collection of the target business; and the target installation package is obtained according to the file processing method in any one of claims 1-5. The collection module is configured to, in the running process of the business function module, perform code coverage collection of the running process of the business function module by the collection function module to obtain target coverage data. The generation module is configured to generate a target coverage collection report based on the target coverage data.
10. An electronic device, comprising: Comprise: A processor; A memory, the memory has computer readable instructions stored thereon, the computer readable instructions are executed by the processor to implement the method in any one of claims 1-5, or implement the method in any one of claims 6-7.
11. A computer readable storage medium, characterized in that, The computer readable instructions are stored thereon, when the computer readable instructions are executed by the processor, implement the method in any one of claims 1-5, or implement the method in any one of claims 6-7.
12. A computer program product, characterised in that, The computer readable instructions are stored thereon, when the computer readable instructions are executed by the processor, implement the method in any one of claims 1-5, or implement the method in any one of claims 6-7.