Code processing method and device, computer device, storage medium and program product

CN122547641APending Publication Date: 2026-08-11TENCENT CLOUD TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-02-11
Publication Date
2026-08-11

AI Technical Summary

Technical Problem

[0003]传统的页面性能测试,通常需要开发人员人工触发,手动进行测试操作,例如通过定期测试的方式对前端页面进行性能测试,这种方式依赖于开发人员的主观意识,因此,采用传统技术进行页面性能测试,可能会导致测试时间不匹配实际情况或测试不全面的问题

Benefits of technology

[0018]The aforementioned code processing method, apparatus, computer equipment, storage medium, and computer program product, upon the occurrence of a code addition event in the target application, can obtain the code compilation information of the newly added code. Subsequently, for multiple runtime environments adapted to the target application, in each runtime environment, an application interface for the target application is created based on the interface attributes of that runtime environment. The page instance corresponding to the code compilation information is loaded into the application interface, and the page performance test results for each runtime environment are obtained. The newly added code is only released after all page performance tests in each runtime environment have passed. In this process, on the one hand, by automatically triggering page performance testing of the newly added code in response to the code addition event, the automation of page performance testing can be effectively improved, avoiding inaccurate testing due to mismatched test times. On the other hand, by performing page performance testing on the target application in multiple runtime environments adapted to the target application, the page performance of the target application in each runtime environment can be accurately understood. The target application will only release new code if all runtime environments pass the page performance test, effectively improving the comprehensiveness of page performance testing and ensuring the operational compatibility of the released target application in various runtime environments.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122547641A_ABST
    Figure CN122547641A_ABST
Patent Text Reader

Abstract

This application relates to a code processing method, apparatus, computer device, storage medium, and computer program product. The method includes: in response to a code addition event for a target application, obtaining code compilation information for the newly added code; adapting the target application to multiple runtime environments; for each runtime environment, creating an application interface for the target application based on the interface attributes within that environment; loading a page instance corresponding to the code compilation information into the application interface, and obtaining page performance test results for each runtime environment; and releasing the newly added code if the page performance test results for each runtime environment are all passed. This method can automatically perform page performance testing on the application, improving the comprehensiveness of the testing.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of software development technology, and in particular to a code processing method, apparatus, computer equipment, storage medium, and computer program product. Background Technology

[0002] With the widespread adoption and rapid development of mobile internet, applications need to continuously add new features or adjust existing ones to meet evolving user needs, improve product performance, and enhance business continuity. Before releasing an updated application, page performance testing is often required. This testing assesses the application's page performance under various conditions to identify potential performance issues promptly and ensure a smooth and efficient browsing experience for users.

[0003] Traditional page performance testing usually requires developers to manually trigger and perform test operations, such as conducting performance tests on the front-end page through periodic testing. This method relies on the developer's subjective awareness. Therefore, using traditional techniques for page performance testing may lead to problems such as test time not matching the actual situation or incomplete testing. Summary of the Invention

[0004] Therefore, it is necessary to provide a code processing method, apparatus, computer device, computer-readable storage medium, and computer program product that can automatically perform page performance testing on applications and improve the comprehensiveness of testing, in order to address the above-mentioned technical problems.

[0005] Firstly, this application provides a code processing method. The method includes:

[0006] In response to a code addition event for a target application, the code compilation information of the newly added code is obtained; the target application is compatible with multiple runtime environments.

[0007] For each of the aforementioned operating environments, an application interface for the target application is created based on the interface attributes within that operating environment.

[0008] Load the page instance corresponding to the code compilation information in the application interface to obtain the page performance test results in the runtime environment;

[0009] The new code is released only after all page performance tests in the respective runtime environments have passed.

[0010] Secondly, this application also provides a code processing apparatus. The apparatus includes:

[0011] The event response module is used to respond to code addition events for the target application and obtain the code compilation information of the added code; the target application is compatible with multiple runtime environments;

[0012] The interface creation module is used to create the application interface of the target application in each of the aforementioned operating environments, based on the interface attributes in the operating environment.

[0013] The performance testing module is used to load the page instance corresponding to the code compilation information in the application interface and obtain the page performance test results in the running environment.

[0014] The release module is used to release the newly added code if the page performance test results of each of the aforementioned runtime environments are all passed.

[0015] Thirdly, this application also provides a computer device. The computer device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to implement the steps of the above-described method.

[0016] Fourthly, this application also provides a computer-readable storage medium. The computer-readable storage medium stores a computer program thereon, which, when executed by a processor, implements the steps of the above-described method.

[0017] Fifthly, this application also provides a computer program product. The computer program product includes a computer program that, when executed by a processor, implements the steps of the above-described method.

[0018] The aforementioned code processing method, apparatus, computer equipment, storage medium, and computer program product, upon the occurrence of a code addition event in the target application, can obtain the code compilation information of the newly added code. Subsequently, for multiple runtime environments adapted to the target application, in each runtime environment, an application interface for the target application is created based on the interface attributes of that runtime environment. The page instance corresponding to the code compilation information is loaded into the application interface, and the page performance test results for each runtime environment are obtained. The newly added code is only released after all page performance tests in each runtime environment have passed. In this process, on the one hand, by automatically triggering page performance testing of the newly added code in response to the code addition event, the automation of page performance testing can be effectively improved, avoiding inaccurate testing due to mismatched test times. On the other hand, by performing page performance testing on the target application in multiple runtime environments adapted to the target application, the page performance of the target application in each runtime environment can be accurately understood. The target application will only release new code if all runtime environments pass the page performance test, effectively improving the comprehensiveness of page performance testing and ensuring the operational compatibility of the released target application in various runtime environments. Attached Figure Description

[0019] Figure 1 This is a diagram illustrating the application environment of a code processing method in one embodiment.

[0020] Figure 2 This is a flowchart illustrating a code processing method in one embodiment;

[0021] Figure 3 This is a schematic diagram illustrating the process of loading a page instance using LightHouse in one embodiment;

[0022] Figure 4 This is a flowchart illustrating the code processing method in another embodiment;

[0023] Figure 5 This is an example diagram illustrating the overall code processing flow in one embodiment;

[0024] Figure 6 This is a flowchart illustrating the code processing method in a scenario where code is added to a web game in one embodiment.

[0025] Figure 7 A flowchart illustrating the code processing method in a scenario where code is added to a service subroutine in one embodiment;

[0026] Figure 8 This is a structural block diagram of a code processing device in one embodiment;

[0027] Figure 9This is an internal structural diagram of a computer device in one embodiment;

[0028] Figure 10 This is a diagram of the internal structure of a computer device in another embodiment. Detailed Implementation

[0029] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0030] The code processing method provided in this application embodiment can be applied to, for example, Figure 1 In the application environment shown, terminal 102 communicates with server 104 via a network. This communication network can be a wired network or a wireless network. Therefore, terminal 102 and server 104 can be directly or indirectly connected via wired or wireless communication. For example, terminal 102 can be indirectly connected to server 104 via a wireless access point, or terminal 102 can be directly connected to server 104 via the Internet; this application does not impose any limitations on this.

[0031] The terminal 102 can be, but is not limited to, various desktop computers, laptops, smartphones, tablets, and portable wearable devices. Portable wearable devices can include smartwatches, smart bracelets, and head-mounted devices. This embodiment can be applied to application code processing scenarios. The terminal 102 can integrate a code processing system, which can process the application code of various applications, executing a series of processing steps from code creation to deployment. The server 104 is the backend server corresponding to the code processing system. The server 104 can be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms. The data storage system can store the data that the server 104 needs to process. The data storage system can be set up separately, integrated on the server 104, or placed in the cloud or on other servers.

[0032] In one embodiment, the code processing system may integrate Continuous Integration (CI) and Continuous Delivery / Deployment (CD) pipelines, as well as automated performance testing tools, such as Lighthouse, for page performance testing. By combining automated performance testing tools with the CI / CD pipeline, it is possible to automatically perform page performance tests before code commits, merge requests, or deployments. Automated page performance testing refers to automatically testing front-end page performance metrics with each code update. These metrics may include, but are not limited to, loading speed, interaction response time, resource utilization, monitoring of large image files, and custom metrics.

[0033] It should be noted that the rendering processing method in this embodiment can be executed by terminal 102 or server 104 alone, or by both terminal 102 and server 104. Taking the case where server 104 executes alone as an example, server 104 can respond to code addition events for the target application and obtain the code compilation information of the added code. The target application is adapted to multiple runtime environments. For each runtime environment, based on the interface attributes of the runtime environment, an application interface for the target application in that environment is created. A page instance corresponding to the code compilation information is loaded into the application interface, and the page performance test results for the runtime environment are obtained. If the page performance test results in each runtime environment are all passed, the added code is released.

[0034] In one embodiment, such as Figure 2 As shown, a code processing method is provided, which can be executed by a computer device, the computer device being... Figure 1 The terminal or server shown, in this embodiment, is applied to the method. Figure 1 Taking the server in the example, the following steps are included:

[0035] Step S202: In response to the code addition event for the target application, obtain the code compilation information of the newly added code.

[0036] An application, or application program, is a software component or program used to perform a specific task or provide a specific service. When running in user mode, an application interacts with the user through a visual user interface. It can be an application running on various operating systems, such as an application running on a mobile terminal operating system or a personal computer operating system. It can also be an application running within a main application, such as a mini-game application running within an instant messaging application, a mini-program application running within an instant messaging application, a mini-game application running within a video application, or a web application running in a browser.

[0037] The target application refers to the application that requires code updates and contains new code. The runtime environment of the target application refers to the environment that can run the target application and generate the corresponding application interface for user interaction. Understandably, a target application can adapt to multiple runtime environments, and each runtime environment can generate different application interfaces for the target application. For example, the runtime environment of the target application could be different types of browsers or different types of main applications.

[0038] Application code refers to the source code that implements the application. For example, application code can be WebAssembly (Wasm) code, a portable, high-performance binary instruction format that can run in different environments. When new features need to be released for the application, or when bugs need to be fixed, developers will write and upload new code. This new code can be the development source code for new features, the updated source code for a complete application update, or the patch source code used to fix application bugs.

[0039] The "Add Code to Target Application" event is triggered when a developer adds new source code to the target application. For example, when a developer submits new code to the target application, this event is triggered. When the "Add Code to Target Application" event is triggered, the server will respond by automatically running subsequent code processing tasks, such as automatically running page performance tests for the target application.

[0040] In one embodiment, taking a code processing system integrated into the server with GitLab CI / CD as an example, GitLab CI / CD is a tool for continuous integration and continuous deployment. The code processing system can use GitLab CI / CD to trigger CI / CD functionality through code submissions. Specifically, the designer of the code processing system can create a task definition file in the project root directory of the code processing system. This task definition file defines a CI / CD pipeline, including the tasks to be run and when they should run. Within the task definition file, the designer also needs to define a series of jobs, each consisting of a series of scripts that are executed on a specific runner. After the definition is complete, the designer can submit the task definition file to the GitLab repository. Subsequently, the code processing system will automatically create a new CI / CD pipeline and run the tasks according to the definitions in the task definition file. Through these steps, the server integrated with the code processing system can use GitLab CI / CD to respond to code addition events. That is, whenever a developer triggers a code addition event for the target application, the server can trigger the CI / CD function and automatically run the tasks defined in the task definition file, i.e., the subsequent series of processing tasks for the newly added code.

[0041] The code compilation information refers to the data used in the runtime environment to load the page instance of the target application. By adding code compilation information, the server can load the corresponding page instance of the target application in the created application interface, thereby performing page performance testing on the target application. It can be understood that the code compilation information can be the code compilation files directly used by the runtime environment, or it can be intermediate code compilation information needed to load the page instance in the application interface of the runtime environment, such as the storage information of the code compilation files.

[0042] Specifically, after developers upload new code for the target application, they can trigger a code addition event for the target application. The server responds to the code addition event for the target application and obtains the code compilation information of the new code.

[0043] Step S204: For each runtime environment, create the application interface of the target application in the runtime environment based on the interface attributes in the runtime environment.

[0044] Among them, the interface attributes in the runtime environment are information used to define the attributes of the application interface generated in the runtime environment. The interface attributes may include the window attributes of the application interface in the runtime environment, such as the default window size of the application interface, and may also include the runtime attributes of the application interface, such as the startup and running parameters of the application interface and the installation path.

[0045] The application interface can be considered the test environment for page performance testing, that is, the simulated environment when the target application page loads. During page performance testing, the server can simulate information interaction and other operations with the page instance through the application interface, thereby performing page performance testing on the target application. It can be understood that the application interface can be the browser or main application used for automated page performance testing. The application interface is a displayless interface, meaning it has no graphical user interface and can run without a graphical interface, interacting with the outside world through a programming interface. For example, the application interface can be a headless browser. A headless browser has no graphical user interface, therefore it does not occupy screen resources and does not display any visual windows or elements.

[0046] Specifically, for each operating environment, the server can obtain the interface attributes of the operating environment and create the application interface of the target application in the operating environment based on the interface attributes.

[0047] In one embodiment, designers can customize the runtime environment in the server's code processing system based on actual page performance testing needs. Specifically, designers can upload the application interface creation file for the custom runtime environment to the code processing system, and specify the interface attributes of the application interface in the custom runtime environment within the code processing system, thus adding a custom runtime environment to the code processing system.

[0048] Taking a headless browser as an example, designers can create an object named `launchOptions` in the code processing system. This object contains configuration options for launching Puppeteer. For example, it can include browser mode options, such as setting `headless` to `true`, which indicates that the browser starts in headless mode, meaning it runs in the background without displaying a user interface. Configuration options can also include a default viewport option, such as setting the default viewport size to 1440×960 pixels. Configuration options can also include command-line arguments (`arguments`, `args`) options, used to set the command-line parameters when launching the browser, such as `--no-sandbox` and `--disable-dev-shm-usage`, to ensure the headless browser can run correctly in certain environments, such as Docker containers. Finally, configuration options can include an executable path option, used to set the browser's installation path.

[0049] Step S206: Load the page instance corresponding to the code compilation information in the application interface to obtain the page performance test results in the runtime environment.

[0050] In this context, a page instance refers to the specific test object in page performance testing, i.e., the page being tested. Different code compilation information can load different page instances. By loading and running the page instance corresponding to the code compilation information in the application interface, the performance of that page instance can be evaluated, and the page performance test results in the runtime environment can be obtained. It's understandable that the number of page instances used for page performance testing in the application interface can be single or multiple. For example, the server can perform page performance testing on all page instances that the target application can load, obtaining the individual page performance test results for each page instance, and then combining these results to obtain the overall page performance test result of the target application in the runtime environment. Alternatively, the server can select a key page instance from among the page instances, such as the homepage instance of the target application, for page performance testing, and use the page performance test result of the homepage instance as the overall page performance test result of the target application in the runtime environment.

[0051] The page performance test results in the runtime environment are used to characterize whether the target application can run normally in the runtime environment. Page performance test results can include "test passed" and "test failed." A "test passed" result indicates that the target application's page performance in the current runtime environment meets the predetermined performance standards and requirements, and can provide users with a stable and smooth user experience in actual use. A "test failed" result indicates that the target application's page performance in the current runtime environment fails to meet the predetermined performance standards and requirements, and may experience loading stutters, malfunctions, etc., requiring further optimization and improvement.

[0052] Specifically, after the server creates the application interface of the target application in the runtime environment, it can load the page instance corresponding to the code compilation information in the application interface based on the code compilation information of the newly added code, and obtain the page performance test results in the runtime environment.

[0053] In one embodiment, the server can use an automated performance testing component integrated into the code processing system, such as Lighthouse, to load a page instance corresponding to the code compilation information in the application interface. During the loading and running of the page instance, the automated performance testing component can complete the page performance test of the target application and obtain the page performance test results of the target application in the runtime environment.

[0054] Step S208: If the page performance test results for each runtime environment are all passed, release the new code.

[0055] Specifically, the server can determine the page performance test results of the target application in each operating environment. If the page performance test results in each operating environment are all passed, it means that the target application meets the predetermined performance standards and requirements in each operating environment it is adapted to. The server can then perform the release operation of the new code for the target application and release the new code.

[0056] In the above code processing method, when a code addition event occurs in the target application, the code compilation information of the newly added code can be obtained. Then, for multiple runtime environments adapted to the target application, in each runtime environment, an application interface for the target application is created based on the interface attributes of that environment. The page instance corresponding to the code compilation information is loaded into the application interface, and the page performance test results for each runtime environment are obtained. The newly added code is only released after all page performance tests in each runtime environment have passed. In this process, on the one hand, by automatically triggering page performance testing of the newly added code in response to the code addition event, the automation of page performance testing can be effectively improved, avoiding inaccurate testing due to mismatched test times. On the other hand, by performing page performance testing on the target application in multiple runtime environments adapted to the target application, the page performance of the target application in each runtime environment can be accurately understood. The target application will only release new code if all page performance tests in each runtime environment pass, effectively improving the comprehensiveness of page performance testing and ensuring the compatibility of the released target application across various runtime environments.

[0057] In one embodiment, in response to a code addition event for a target application, obtaining code compilation information for the newly added code includes: in response to a code addition event for the target application, obtaining type information of the target application; and obtaining code compilation information for the newly added code according to an information acquisition strategy that matches the application type represented by the type information.

[0058] The application type of the target application is a type parameter obtained by classifying the application according to its program architecture, and may include microservice applications, system applications, etc. The type information of the target application is information data used to characterize the application type to which the target application belongs. This application does not limit the specific format of the type information; for example, the type information of the target application can be characters or combinations of characters with descriptive meaning. For instance, 1 can represent a microservice application, and 0 can represent a system application; then 1 and 0 constitute the type information of the target application. Understandably, the server can obtain the type information of the target application through its application configuration information or newly uploaded code.

[0059] Among them, the information acquisition strategy is the method used to obtain the code compilation information of the newly added code of the target application. It can be understood that the information acquisition strategy used to obtain the code compilation information of the newly added code will be different depending on the application type of the target application. Designers can store multiple candidate information acquisition strategies that match each application type in the configuration file of the code processing system in advance. When the code addition event is triggered, the information acquisition strategy that matches the application type is found from the candidate information acquisition strategies according to the application type of the target application.

[0060] Specifically, in response to a code addition event for the target application, the server obtains the type information of the target application, determines the application type to which the target application belongs based on the type information, selects an information acquisition strategy that matches the application type from multiple candidate information acquisition strategies, and then obtains the code compilation information of the added code according to the information acquisition strategy.

[0061] In the above embodiments, by classifying the target application into application types and setting corresponding information acquisition strategies for each application type, the matching information acquisition strategy can be quickly determined based on the application type of the target application during automated page performance testing. The code compilation information of newly added code can be obtained according to the information acquisition strategy, which effectively improves the accuracy and efficiency of obtaining code compilation information.

[0062] Since different application types require different information acquisition strategies, the following two examples will be used to explain in detail the process of acquiring code compilation information.

[0063] In one embodiment, the code compilation information of the newly added code is obtained according to the information acquisition strategy matching the application type, including: when the application type is a system application, determining the compilation file storage area of ​​the target application, obtaining the code compilation file of the newly added code of the target application from the compilation file storage area, and determining the code compilation information including the code compilation file.

[0064] Applications categorized as system applications are deployed on a single server or server cluster, employing a monolithic architecture. All components and functional modules within this application are integrated into a single process, working collaboratively under a unified user interface. In other words, a system application can be considered a single, monolithic application.

[0065] The target application's compiled file storage area is a storage area on the server used to store the compiled files of the target application. It can be understood that the code compiled files of the target application can be directly compiled by the developers based on the newly added code and uploaded to the corresponding compiled file storage area, or the code processing system on the server can call the corresponding compilation component to compile the newly added code uploaded by the developers and store it in the corresponding compiled file storage area.

[0066] In one embodiment, the server can set up an independent compilation file storage area for each application whose application type is system application, that is, the compilation file storage area is only used to store the compilation files of the target application.

[0067] In one embodiment, the server can set up a shared compiled file storage area for each application of the application type "system application". That is, the compiled file storage area can be used by all applications of the "system application" type to store their corresponding compiled files. The server can retrieve the compiled code files of newly added code for the target application from the compiled file storage area based on the application identifier of the target application.

[0068] Among them, the code compilation file is a compilation file that can be loaded into the application interface to obtain the page instance of the target application, and the code compilation information is the information data including the code compilation file. In addition to the code compilation file, the code compilation information may also include, for example, the application identifier of the target application, compilation configuration information, etc.

[0069] Understandably, when the application type is a system application, the compiled code file can be only a newly added compiled file for the newly added code. For example, in the case of a complete update of the target application, the newly added code is the entire updated source code of the target application, and the compiled code file can be only a newly added compiled file for the newly added code. Alternatively, the compiled code file can include both the newly added compiled file and the target application's historical compiled files. For example, in the case of a partial update of the target application, the newly added code is only a partial update of the target application's source code. If the compiled code file only contains the compiled file obtained after compiling the partially updated source code, it may lead to the page failing to load, making it impossible to perform accurate page performance testing. Therefore, in order to improve the success rate of page loading, when the target application is partially updated, the compiled code file includes both newly added compiled files and historical compiled files.

[0070] Specifically, when the target application is a system application, the server can determine the storage area of ​​the target application's compiled files, retrieve the code compiled files of the newly added code of the target application from the storage area of ​​the compiled files, and then determine the code compilation information including the code compiled files.

[0071] In one embodiment, after the server creates the application interface of the target application in the runtime environment, it can store the code compilation information in the environment information storage area of ​​the runtime environment so that the code compilation file can be directly retrieved from the environment information storage area of ​​the runtime environment to load the page instance.

[0072] In the above embodiments, when the target application is a system application, the server can directly obtain the code compilation file of the newly added code of the target application from the compilation file storage area, determine the code compilation information including the code compilation file, and provide an accurate data foundation for loading page instances based on the code compilation information.

[0073] In another embodiment, code compilation information for newly added code is obtained according to an information retrieval strategy matching the application type. This includes: if the application type is a microservice application, obtaining multiple information storage addresses configured for the microservice application, whereby the information storage addresses are used to store code compilation files. From these information storage addresses, a target storage address matching the target application is determined, and this target storage address is identified as the source of the code compilation information.

[0074] Among them, applications classified as microservices are independent sub-applications within a large and complex main application. These sub-applications can be independently deployed units within the entire microservice architecture, and their execution processes are independent of those of other sub-applications within the main application. Examples include mini-games within an instant messaging main application, mini-programs running within an instant messaging application, and mini-games running within a video application. It's understandable that sub-applications within the main application can originate from different product providers and are embedded within the main application.

[0075] Specifically, the multiple information storage addresses configured for a microservice application can each correspond to a sub-application contained within the microservice application. Each information storage address can be used to store the compiled code files of newly added code for the corresponding sub-application. The information storage address can also be the address of a supply server corresponding to another product supplier that has a communication connection with the server.

[0076] In one embodiment, multiple information storage addresses can be stored in the environment variables of the CI / CD pipeline in the code processing system, that is, the server can maintain multiple information storage addresses in the environment variables of the CI / CD pipeline.

[0077] Specifically, when the target application is a microservice application, the server can obtain multiple information storage addresses configured for the microservice application. These information storage addresses are used to store compiled code files. The server can determine the target storage address that matches the target application from these multiple information storage addresses, and then determine the code compilation information containing the target storage address based on the target storage address.

[0078] In one embodiment, the server can determine the target storage address that matches the target application from multiple information storage addresses based on the mapping relationship between the target application and the information storage address.

[0079] In one embodiment, the server can determine the target storage address that matches the target application from multiple information storage addresses using a hash index.

[0080] In the above embodiments, when the target application is a microservice application, the server can determine the target storage address that matches the target application and determine the code compilation information containing the target storage address. This allows the server to simulate the actual page loading process of the microservice application during subsequent page instance loading, accurately obtain the code compilation file of the newly added code from the target storage address, and improve the loading efficiency of page instance loading and the accuracy of page performance testing.

[0081] In one embodiment, when the target application is a microservice application, loading a page instance corresponding to the code compilation information in the application interface includes: obtaining the page access address of the application interface, obtaining the page rendering resources of the target application according to the target storage address, and loading the page rendering resources into the application interface according to the page access address to obtain the page instance.

[0082] The page access address is the address information used to locate page instances in the application interface. In the application interface, each page has a unique page access address, which can be used to access the corresponding page in the application interface.

[0083] In one embodiment, the page access address can be the Uniform Resource Locator (URL) of the page in the application interface.

[0084] Among them, the page rendering resources are resource data obtained from the code compilation files of the newly added code. They can be used to simulate page rendering in the application interface of the target application that is a microservice application. Similarly, the code compilation files of the newly added code can be only the newly added compilation files of the newly added code, or they can include both newly added compilation files and historical compilation files.

[0085] Understandably, since the application interface may be without a graphical interface, the server's use of page rendering resources to load page instances does not mean actually displaying the page instances in the application interface, but rather loading the page instances within the application interface through simulated page rendering. This process is not displayed on the user's end and therefore does not consume real display resources. Understandably, page rendering resources can be the rendering scripts of the target application.

[0086] Specifically, when the target application is a microservice application, the code processing system in the server can call an integrated automated performance testing component, such as Lighthouse, to obtain the page access address of the application interface, and obtain the page rendering resources of the target application according to the target storage address. Based on the page access address, the page rendering resources are loaded into the application interface to obtain the page instance.

[0087] For example, such as Figure 3 As shown, LightHouse in the code processing system can obtain the URL of the target page used for page performance testing in the application interface. Based on the target storage address, it sends a resource retrieval request to the provider's server corresponding to the target storage address to request the page rendering resources of the target application. The provider server will return the page rendering resources of the target application to LightHouse based on the resource retrieval request. LightHouse will then load the page rendering resources into the application interface according to the page access address, obtaining a page instance used for page performance testing.

[0088] In the above embodiments, when the target application is a microservice application, the server can simulate the page rendering operation of the actual microservice application according to the target storage address, obtain the page rendering resources of the target application from the target storage address, and then load the page rendering resources into the application interface according to the page access address of the application interface to obtain the page instance. This effectively improves the matching between the page instance loading during the test and the page instance loading during actual use, thereby improving the accuracy of page performance testing.

[0089] In another embodiment, if the target application is a system application, the server can obtain the page access address of the application interface, and load the code compilation file of the target application into the application interface based on the page access address to obtain a page instance.

[0090] Furthermore, in one embodiment, obtaining the page rendering resources of the target application according to the target storage address includes: obtaining interface resource cache information of the application interface. If the interface resource cache information contains page cache resources of the target application, the updated resource information of the target application is determined based on the page cache resources and the rendering resource information of the target application. The updated resource corresponding to the updated resource information is obtained according to the target storage address, and the updated resource and the page cache resources are determined as the page rendering resources of the target application.

[0091] The UI resource cache information refers to the resource information cached by the server in the application interface during historical page performance testing for each application. UI resource cache information can include cached page resources for each application. Cached page resources are rendering resources that the target application can reuse when loading page instances.

[0092] Understandably, within the same microservice application, since sub-applications can be embedded within a main application, the page instances of each sub-application may share some identical page content in their application interfaces, such as website icons, backgrounds, and common stylesheets. To reduce redundant loading and improve loading efficiency, the server can configure resource caching strategies through the application interface to cache duplicate resources.

[0093] Among these, rendering resource information refers to the resource information corresponding to all page rendering resources required by the target application when the page is loaded. By using page cache resources and rendering resource information, the server can quickly determine the updated resource information that the target application still needs to use during page loading. In essence, updated resource information can be used to characterize the updated resources that the target application needs to use during page loading.

[0094] Specifically, when the target application is a microservice application, the server can obtain the application's UI resource cache information. It searches the UI resource cache information for page cache resources that match the target application. If the UI resource cache information contains page cache resources for the target application, it determines the target application's update resource information based on the page cache resources and the target application's rendering resource information. Then, it retrieves the update resource corresponding to the update resource information according to the target storage address, and combines the update resource with the page cache resources to determine the target application's page rendering resources.

[0095] In one embodiment, if the server determines that the interface resource cache information does not contain the page cache resources of the target application, it can directly obtain the page rendering resources corresponding to the page rendering resources according to the target storage address, so as to improve the page loading success rate.

[0096] In the above embodiments, by determining the page cache resources and newly acquired updated resources as the page rendering resources of the target application when the interface resource cache information includes the page cache resources of the target application, the probability of repeated loading of the same resources can be effectively reduced, page loading efficiency can be improved, and the accuracy of page performance testing can be enhanced.

[0097] In one embodiment, loading a page instance corresponding to the code compilation information in the application interface and obtaining page performance test results in the runtime environment includes: loading a page instance corresponding to the code compilation information in the application interface, obtaining multiple page performance evaluation metrics and performance test parameters during the loading process. For each page performance evaluation metric, the actual metric value of the page performance evaluation metric is determined based on the performance test parameters. The actual metric value is compared with the benchmark metric value of the page performance evaluation metric to obtain the metric evaluation result of the page performance evaluation metric. Based on the respective metric evaluation results of each page performance evaluation metric, the page performance test results in the runtime environment are determined.

[0098] Page performance evaluation metrics are parameters used to measure the page performance of a target application. In page performance testing, page performance evaluation metrics can include performance metrics, accessibility metrics, and practice metrics. Performance metrics can include, but are not limited to, first contentful paint time, time to interact time, and speed index.

[0099] When evaluating performance metrics for each page, the test data required for performance testing parameters can be collected by the server during the page instance loading and execution process. Understandably, performance testing parameters can be related to the performance metrics of each page, and collecting these parameters provides evaluation data for subsequent page performance metrics assessments. For example, performance testing parameters may include, but are not limited to, the output format, log level, device simulation type, network and CPU limits during the page instance loading process.

[0100] The actual values ​​of page performance evaluation metrics are the actual values ​​obtained after evaluating performance test parameters collected during the page instance loading and running process; these are the test values. The baseline values, on the other hand, are the theoretical values ​​that the corresponding page performance evaluation metrics should achieve under normal loading and running conditions of the target application's page instance. Understandably, the baseline values ​​of page performance evaluation metrics can be determined in advance by designers based on the actual testing requirements of the page performance evaluation metrics. For example, designers can set corresponding baseline values ​​for each page performance evaluation metric to ensure that after the target application is updated, the performance of the target application's front-end pages does not degrade, or the degradation does not exceed a preset range. In this context, "normal loading and running" means that after updating the target application with new code, the page's running performance does not degrade, or the degradation is within a preset acceptable range.

[0101] The indicator evaluation results can be used to characterize the difference between the actual indicator value and the benchmark indicator value. Understandably, the indicator evaluation results can include whether the indicator evaluation is qualified or unqualified, and can also include the difference between the actual indicator value and the benchmark indicator value.

[0102] Specifically, the server loads page instances corresponding to the code compilation information in the application interface, obtains multiple page performance evaluation quality assurances, and performance test parameters during the page instance loading process. For each page performance evaluation quality assurance, the server determines the actual value of the page performance evaluation metric based on the performance test parameters. Then, the actual metric value is compared with the baseline metric value of the page performance evaluation metric to obtain the metric evaluation result. Based on the metric evaluation results of each page performance evaluation metric, the page performance test results of the target application in the runtime environment are determined.

[0103] In one embodiment, the code processing system in the server can invoke an automated performance testing component, such as Lighthouse, to record page instances corresponding to code compilation information in the application interface, obtain multiple page performance evaluation metrics and performance test parameters during the loading process, and then determine the actual metric value for each page performance evaluation metric based on the performance test parameters. The actual metric value is then compared with the corresponding benchmark metric value to obtain the evaluation result for each page performance evaluation metric. Based on the evaluation results of each metric, the page performance test results of the target application in the runtime environment are generated. For example, if the evaluation results of all page performance evaluation metrics are qualified, the page performance test result of the target application in the runtime environment can be determined as passed. If the evaluation result of any page performance evaluation metric is unqualified, the page performance test result of the target application in the runtime environment can be determined as failed.

[0104] In one embodiment, the server can obtain the page rendering resources of the target application according to the target storage address, load the page rendering resources into the application interface according to the page access address, and in this process, obtain multiple page performance evaluation indicators and performance test parameters during the loading process. For each page performance evaluation indicator, the actual indicator value of the page performance evaluation indicator is determined based on the performance test parameters. The actual indicator value is compared with the benchmark indicator value of the page performance evaluation indicator to obtain the indicator evaluation result of the page performance evaluation indicator. Based on the indicator evaluation results of each page performance evaluation indicator, the page performance test result in the runtime environment is determined.

[0105] In one embodiment, when loading a page instance, the server can obtain the interface resource cache information of the application interface. If the interface resource cache information includes the page cache resources of the target application, the server determines the updated resource information of the target application based on the page cache resources and the rendering resource information of the target application. The server then obtains the updated resource corresponding to the updated resource information according to the target storage address, and determines the updated resource and the page cache resources as the page rendering resources of the target application. Subsequently, the server loads the page rendering resources in the application interface to obtain a page instance. During this process, multiple page performance evaluation metrics and performance test parameters during the loading process are obtained. For each page performance evaluation metric, the server determines the actual metric value of the page performance evaluation metric based on the performance test parameters. The server compares the actual metric value with the benchmark metric value of the page performance evaluation metric to obtain the metric evaluation result of the page performance evaluation metric. Based on the metric evaluation results of each page performance evaluation metric, the server determines the page performance test result in the runtime environment.

[0106] In the above embodiments, the actual index value of each page performance evaluation index is determined by the performance test parameters during the loading process. Then, the actual index value is compared with the benchmark index value of the page performance evaluation index to obtain the index evaluation result of the page performance evaluation quality assurance. This can effectively improve the evaluation efficiency and accuracy of the index evaluation result, thereby improving the accuracy of the subsequent page performance test result determined based on the evaluation results of each index.

[0107] In one embodiment, the page performance evaluation metrics include custom evaluation metrics, and the code processing method further includes: responding to a custom metric event, obtaining the metric evaluation method and metric audit metadata of the custom evaluation metrics, creating a custom audit class based on the metric evaluation method and metric audit metadata, and adding the custom audit class to the performance test configuration file.

[0108] Among them, the metric customization event is an event triggered by the user, such as the designer, when customizing the metric. It can be understood that the metric customization event can be triggered by the user based on the code processing system on the server based on the user terminal.

[0109] Custom evaluation metrics are page performance evaluation metrics that users need to add to the automated performance testing process. The evaluation method for custom evaluation metrics is the specific way to obtain the actual metric value corresponding to the custom evaluation metric. This can include metric evaluation logic, metric evaluation functions, etc.

[0110] The audit metadata for custom evaluation metrics refers to the descriptive information of the data required to perform performance evaluation on custom evaluation metrics. Understandably, audit metadata may include audit identifiers, such as audit IDs, audit titles, failure titles, descriptions, and the required raw data.

[0111] Specifically, the server can respond to a custom metric event to obtain the metric evaluation method and metric audit metadata based on user input from the user terminal. Then, based on the metric evaluation method and metric audit metadata, a custom audit class is created in the server's code processing system. This custom audit class is then added to the performance test configuration file of the automated performance testing component, allowing custom evaluation metrics to be added during the automated performance testing process.

[0112] Taking the addition of an image monitoring metric during automated performance testing as an example, the server can respond to user actions by defining a custom LightHouse audit class named `ImageAudit` in the code processing system to check whether the page contains GIF images larger than 5MB. First, the server can import and inherit the LightHouse `Audit` class. Specifically, it uses the `require` function to import the LightHouse `Audit` class, and then defines a new class `ImageAudit` that inherits from the `Audit` class. Next, the server can define audit metadata. Specifically, in the `ImageAudit` class, it defines a static getter method `meta` that returns an object containing the audit ID, title, failure title, description, and the required artifacts. The server then defines the audit method. Specifically, in the `ImageAudit` class, it defines a static method `audit` that accepts a parameter containing the artifacts. This method first initializes `hasCinememe` to `false`, then filters for images that meet the criteria. If any image matching the Cinememe criteria is found (i.e., MIME type 'image / gif' and resource size exceeding 5,000,000), `hasCinememe` is set to `true`. Simultaneously, images that do not meet the Cinememe criteria are added to the `results` array. The audit results returned by the image monitoring metric can be represented as an object returned by the `audit` method, containing an audit score (1 if Cinememe exists, 0 otherwise) and detailed information (a table containing table details of images that do not meet the Cinememe criteria).

[0113] In the above embodiments, by opening a window for creating custom evaluation metrics, users can create corresponding custom evaluation metrics in the server according to their actual evaluation needs, so that the code processing solution can better meet the actual usage needs of users and improve the versatility of the code processing method.

[0114] In one embodiment, the code processing method further includes: in response to a test information display instruction for a target application, obtaining display legend configuration information and display label information, extracting display data from the performance test information of the target application based on the display label information, generating an initial display chart according to the display legend configuration information, filling the display data into the initial display chart, and obtaining and displaying the test information display chart of the target application.

[0115] The test information display instruction is a signal that instructs the server to display performance test information of the target application, and can be triggered by the user's terminal. The performance test information of the target application refers to the test information data generated during the page performance test, which may include test result information and / or raw test information. The test result information may include whether the test passed, performance score, performance test results for each page, evaluation results of each page's performance evaluation indicators, indicator evaluation scores, and performance test scores for each page. The raw test information may include the test output information collected during the performance test.

[0116] The legend configuration information is required when generating a display chart instance. This information may include the canvas size for legend generation, the default font, font size, chart type, background color, and border color. The label information, on the other hand, represents the label information used to represent the display data required for chart generation. This includes the individual data labels and the dataset to which the data belongs. For example, if the chart type is a bar chart, the data labels could be the text corresponding to each bar on the X-axis, such as the data name of each displayed data point.

[0117] The initial display chart is generated according to the display legend configuration information. As you can understand, the initial display chart can only show general chart information, such as the default font, font size, chart type, background color, border color, etc.

[0118] Specifically, in response to a test information display command for a target application, the server can obtain display legend configuration information and display label information. Then, based on the display label information, it can extract display data from the target application's performance test information, generate an initial display chart according to the display legend configuration information, and then populate the initial display chart with the display data to obtain the target application's test information display chart. The server can then display the target application's test information display chart on the user's terminal.

[0119] In one embodiment, the generation of test information display charts for the target application can be accomplished by the code processing system in the server calling an automated performance testing component.

[0120] For example, when generating test information charts, the LightHouse automated performance testing component first creates a pair named `performanceData` containing performance data extracted from the performance test information, i.e., the LightHouse results, such as performance score, First Content Render Time (FCP), Speed ​​Index (SI), and Time to Interact (TTI). Then, it creates and configures the chart. Specifically, LightHouse can use a canvas to create a drawing and set its width and height. Next, it initializes `Chart.js`, setting the default font and font size. Then, it creates a bar chart instance and configures the data labels, dataset, background color, border color, etc. Finally, it sets the y-axis scale to start from zero, generating the test information chart for the target application. LightHouse can save the test information chart as a PNG image. Specifically, it converts the drawn chart to PNG format and uses the `fs.writeFileSync` function to save the image to a file named "performanceChart.png".

[0121] In the above embodiments, by generating test information display charts for the target application and displaying them to the user, the user can quickly and intuitively understand the performance test status of the target application, providing a data foundation for the subsequent improvement and optimization of the target application.

[0122] In one embodiment, the code processing method further includes: in the case of an abnormal operating environment where any page performance test result is a test failure, obtaining the page performance test information of the abnormal operating environment, performing anomaly analysis on the target application based on the page performance test information, determining the improvement strategy of the target application, generating an alarm notification based on the improvement strategy, and sending the alarm notification to the development terminal of the target application.

[0123] An abnormal operating environment refers to an environment where the page performance test result is a failure. The page performance test information for an abnormal operating environment is the performance test information of the target application in its current operating environment. Similarly, the page performance test information can include the test result information and / or raw test information of the target application in its current operating environment. The test result information can include whether the page performance test passed or failed, the performance score, the evaluation results of each page performance evaluation metric, the metric evaluation score, and the performance test score for each page. The raw test information can include the test output information collected during the performance test.

[0124] Anomaly analysis of the target application refers to the process of analyzing why the target application is abnormal in the current operating environment by using page performance test information. By performing anomaly analysis of the target application, corresponding improvement strategies can be quickly determined for the target application.

[0125] Improvement strategies refer to policy information used to suggest improvements to the target application to reduce the likelihood of anomalies in the current operating environment and increase the success rate of the target application. Understandably, users can pre-configure multiple application improvement strategies in the server's code processing system for various anomaly analysis results. Each anomaly analysis result has a corresponding improvement strategy. It's also understood that the improvement strategies corresponding to each anomaly analysis result can be the same or different, depending on the specific circumstances of the anomaly analysis. For example, when the anomaly analysis result indicates that the page contains images that do not meet the criteria, the corresponding improvement strategy can be determined based on the differences between the images that do not meet the criteria and the images that can be loaded on the page, such as modifying the image type and / or modifying the image size.

[0126] Specifically, if the server determines that any page performance test result indicates an abnormal operating environment, it can obtain the page performance test information of the target application in that abnormal operating environment. Based on this information, the server performs anomaly analysis on the target application, determines the anomaly analysis results for that abnormal operating environment, and then matches corresponding improvement strategies to the target application based on these results. The server can generate alarm notifications based on these improvement strategies and send them to the target application's development terminal to remind developers to make improvements that enable the application to function correctly in the abnormal operating environment.

[0127] In one embodiment, the server's code processing system can be configured with an anomaly analysis model. After obtaining the page performance test information of the target application under an abnormal operating environment, the server can input the page performance test information into the anomaly analysis model for anomaly analysis to obtain the anomaly analysis results of the target application under an abnormal operating environment.

[0128] In one embodiment, the anomaly analysis model can also directly output improvement strategies that match the target application.

[0129] In the above embodiments, when there is an abnormal operating environment, by obtaining the page performance test information of the target application under the abnormal operating environment and performing anomaly analysis on the target application based on the page performance test information, it is possible to accurately match the target application with the corresponding improvement strategy, generate alarm notifications based on the improvement strategy to alert the developers, and also help the developers to discover the performance problems of the target application in a timely manner and provide improvement strategies for solving the performance problems, which helps to improve the development efficiency of the target application.

[0130] In one embodiment, such as Figure 4 As shown, a code processing method is provided, which is executed by a computer device, which can be... Figure 1 The terminal or server shown, taking a computer device as a server as an example, specifically, the code processing method can be implemented by a code processing system in the server, and the overall code processing flow can be as follows: Figure 5 As shown, when a developer submits new code, the Git hook in the code processing system will automatically respond to the new code event for the target application, generate a corresponding automated performance testing CI / CD pipeline, call the automated performance testing component LightHouse to perform page performance testing, and synchronize the page performance test results to the developer. The CI / CD pipeline can perform operations such as determining the target application type, obtaining code compilation information, page performance testing, message notification, and saving.

[0131] In this embodiment, the method includes the following steps:

[0132] Step S401: In response to the code addition event for the target application, for each runtime environment, create the application interface of the target application in the runtime environment according to the interface attributes in the runtime environment.

[0133] Each runtime environment can refer to a different type of browser environment or a different type of main application. The application interface can be a headless browser or a main application interface without graphics.

[0134] Step S402: Obtain the type information of the target application. If the application type represented by the type information is a system application, proceed to steps S403-S405. If the application type represented by the type information is a microservice application, proceed to steps S406-S411.

[0135] Step S403: Determine the storage area for the compiled files of the target application.

[0136] Step S404: Obtain the code compilation file of the newly added code of the target application from the compilation file storage area, and determine the code compilation information including the code compilation file.

[0137] Step S405: Obtain the page access address of the application interface, and load the code compilation file into the application interface based on the page access address to obtain the page instance.

[0138] The page access address is the page URL. LightHouse can obtain the URL of the target test page in the application interface from the context object.

[0139] Step S406: Obtain multiple information storage addresses for the microservice application configuration.

[0140] The information storage address can be the address of the provider server of each application corresponding to the microservice application type.

[0141] Step S407: From the various information storage addresses, determine the target storage address that matches the target application, and determine it as the code compilation information containing the target storage address.

[0142] Step S408: Obtain the page access address of the application interface and the interface resource cache information.

[0143] Step S409: If the interface resource cache information includes the page cache resources of the target application, determine the updated resource information of the target application based on the page cache resources and the rendering resource information of the target application.

[0144] Step S410: Obtain the updated resource corresponding to the updated resource information according to the target storage address, and determine the updated resource and page cache resource as the page rendering resource of the target application.

[0145] LightHouse can send update resource request information to the supplier of the target application according to the supplier server address, and receive the updated resources fed back by the supplier server based on the update resource request information.

[0146] Step S411: Load the page rendering resources into the application interface according to the page access address to obtain the page instance.

[0147] Steps S405 and S408-S411 are executed by the code processing system in LightHouse integrated into the CI / CD pipeline.

[0148] During the process of obtaining and loading a page instance, LightHouse can perform relevant steps for page performance testing, as follows:

[0149] Step S412: Obtain multiple page performance evaluation metrics and performance test parameters during the loading process.

[0150] Performance test parameters may include output format, log level, device emulation type, network and CPU limits, etc.

[0151] Step S413: For each page performance evaluation metric, determine the actual metric value of the page performance evaluation metric based on the performance test parameters.

[0152] Step S414: Compare the actual indicator value with the benchmark indicator value of the page performance evaluation indicator to obtain the indicator evaluation result of the page performance evaluation indicator.

[0153] Step S415: Determine the page performance test results in the operating environment based on the evaluation results of each page performance evaluation index.

[0154] In addition to determining the evaluation results of metrics and the test results of page information, LightHouse also stores test information during the page performance test process, such as test result information and test raw information. Specifically, LightHouse can save the test result information and test raw information into the context object.

[0155] Step S416: If the page performance test results for each runtime environment are all passed, release the new code.

[0156] Step S417: In the case of an abnormal operating environment where any page performance test result is a failure, obtain the page performance test information of the abnormal operating environment.

[0157] Step S418: Perform anomaly analysis on the target application based on page performance test information to determine the improvement strategy for the target application.

[0158] Step S419: Generate an alarm notification based on the improved strategy and send the alarm notification to the development terminal of the target application.

[0159] LightHouse can generate detailed performance reports based on improvement strategies and anomaly analysis results. These reports can include performance test results, reasons for performance degradation or anomalies, and improvement suggestions. Adding performance reports to alarm notifications and sending them to the development terminal can help developers identify and resolve issues in a timely manner.

[0160] After the page performance test is complete, LightHouse can continue with the chart generation step, as follows:

[0161] Step S420: In response to the test information display instruction for the target application, obtain the display legend configuration information and display label information.

[0162] Step S421: Extract display data from the performance test information of the target application based on the display label information.

[0163] Step S422: Generate an initial display chart according to the display legend configuration information, fill the display data into the initial display chart, and obtain and display the test information display chart of the target application.

[0164] The code processing methods described above, based on CI / CD pipelines and LightHouse's front-end performance monitoring and guarding, can achieve the following effects:

[0165] First, it effectively improves the testing efficiency of page performance testing: through automated performance testing, it greatly saves the time and effort of manual testing and improves testing efficiency.

[0166] Secondly, it effectively improves performance stability: through continuous performance testing and benchmark comparison, it can be ensured that the performance of the front-end page will not decrease after each code update, thereby improving performance stability.

[0167] Third, it enables timely detection and resolution of issues: Detailed performance reports and alerts help developers identify and resolve performance problems promptly, preventing performance issues from impacting user experience.

[0168] Fourth, it improves the user experience: By ensuring the stability of the front-end page performance, the user experience can be improved, thereby enhancing the product's competitiveness.

[0169] Fifth, it improves application development efficiency: Automated performance testing and report generation can help developers quickly locate and resolve problems, thus improving development efficiency.

[0170] In one embodiment, such as Figure 6 As shown, this application also provides an application scenario in which the above-described code processing method is applied. This application scenario could be, for example, a code addition scenario for a web game. In this scenario, the target application is a web game, the added code is the new source code that updates the game's functionality, multiple runtime environments are multiple browser environments in which the web game can run, and the application interface within each runtime environment is a headless browser generated for that browser environment to simulate the page execution process. During code processing, the code processing system: responds to a code addition event for the web game, obtains the code compilation information for the added code, where the web game can adapt to multiple browser environments. For each browser environment, based on the interface attributes within that browser environment, a headless browser for the web game is created. The page instance corresponding to the code compilation information is loaded into the headless browser, and the page performance test results for that browser environment are obtained. If the page performance test results for each browser environment are all passed, the added code is released.

[0171] In one embodiment, such as Figure 7This application also provides an application scenario in which the above-described code processing method is applied. This application scenario could be, for example, a scenario where service subroutine code can be added and embedded within different main programs. In this scenario, the target application is a service subroutine, the added code is the new source code that updates the service functions of the service subroutine, multiple runtime environments are multiple main program environments into which the service subroutine can be embedded, and the application interface within the runtime environment is a non-graphical main program interface generated for the corresponding main program environment, used to simulate the page execution process. During code processing, the code processing system: responds to the code addition event for the service subroutine, obtains the code compilation information of the added code, where the service subroutine can adapt to multiple main program environments. For each main program environment, based on the interface attributes within the main program environment, a non-graphical main program interface for the service subroutine is created within that environment. The page instance corresponding to the code compilation information is loaded into the non-graphical main program interface, and the page performance test results for that main program environment are obtained. If the page performance test results for each main program environment are all passed, the added code is released.

[0172] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.

[0173] Based on the same inventive concept, this application also provides a code processing apparatus for implementing the code processing method described above. The solution provided by this apparatus is similar to the implementation scheme described in the above method; therefore, the specific limitations in one or more code processing apparatus embodiments provided below can be found in the limitations of the code processing method described above, and will not be repeated here.

[0174] In one embodiment, such as Figure 8 As shown, a code processing device is provided, including: an event response module 801, an interface creation module 802, a performance testing module 803, and a release module 804, wherein:

[0175] The event response module 801 is used to respond to code addition events for the target application and obtain the code compilation information of the newly added code; the target application is compatible with multiple runtime environments.

[0176] The interface creation module 802 is used to create the application interface of the target application in each runtime environment based on the interface attributes in the runtime environment.

[0177] The performance testing module 803 is used to load page instances corresponding to code compilation information in the application interface and obtain page performance test results in the runtime environment.

[0178] The release module 804 is used to release new code if the page performance test results in each runtime environment are all passed.

[0179] In one embodiment, the event response module 801 is configured to: in response to a code addition event for the target application, obtain type information of the target application; and obtain code compilation information of the newly added code according to an information acquisition strategy that matches the application type represented by the type information.

[0180] In one embodiment, the event response module 801 is used to: determine the compilation file storage area of ​​the target application when the application type is a system application; obtain the code compilation file of the newly added code of the target application from the compilation file storage area; and determine the code compilation information including the code compilation file.

[0181] In one embodiment, the event response module 801 is configured to: obtain multiple information storage addresses configured for the microservice application when the application type is a microservice application; the information storage addresses are used to store code compilation files; determine the target storage address that matches the target application from each information storage address; and determine the code compilation information that contains the target storage address.

[0182] In one embodiment, the performance testing module 803 is used to: obtain the page access address of the application interface; obtain the page rendering resources of the target application according to the target storage address; obtain the page rendering resources based on the code compilation file of the newly added code; and load the page rendering resources into the application interface according to the page access address to obtain a page instance.

[0183] In one embodiment, the performance testing module 803 is used to: obtain interface resource cache information of the application interface; if the interface resource cache information contains page cache resources of the target application, determine the updated resource information of the target application based on the page cache resources and the rendering resource information of the target application; obtain the updated resource corresponding to the updated resource information according to the target storage address; and determine the updated resource and the page cache resources as the page rendering resources of the target application.

[0184] In one embodiment, the performance testing module 803 is used to: load a page instance corresponding to the code compilation information in the application interface; obtain multiple page performance evaluation metrics and performance test parameters during the loading process; for each page performance evaluation metric, determine the actual metric value of the page performance evaluation metric based on the performance test parameters; compare the actual metric value with the benchmark metric value of the page performance evaluation metric to obtain the metric evaluation result of the page performance evaluation metric; and determine the page performance test result in the runtime environment based on the respective metric evaluation results of each page performance evaluation metric.

[0185] In one embodiment, the page performance evaluation metrics include custom evaluation metrics. The code processing apparatus further includes:

[0186] The evaluation indicator information acquisition module is used to respond to indicator-custom events and obtain the indicator evaluation method and indicator audit metadata of the custom evaluation indicators.

[0187] The custom audit module is used to create custom audit classes based on indicator evaluation methods and indicator audit metadata.

[0188] The audit class addition module is used to add custom audit classes to the performance test configuration file.

[0189] In one embodiment, the code processing apparatus further includes:

[0190] The instruction response module is used to respond to test information display instructions for the target application, and to obtain display legend configuration information and display label information.

[0191] The data extraction module is used to extract display data from the performance test information of the target application based on the display label information.

[0192] The initial display chart generation module is used to generate an initial display chart according to the display legend configuration information.

[0193] The test information display chart generation module is used to fill the display data into the initial display chart, obtain the test information display chart of the target application, and display it.

[0194] In one embodiment, the code processing apparatus further includes:

[0195] The abnormal operating environment information acquisition module is used to acquire page performance test information of the abnormal operating environment when any page performance test result is an abnormal operating environment.

[0196] The anomaly analysis module is used to perform anomaly analysis on the target application based on page performance test information and determine the improvement strategy for the target application.

[0197] The alarm module is used to generate alarm notifications based on the improved strategy and send the alarm notifications to the development terminal of the target application.

[0198] Each module in the aforementioned code processing device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device, or stored in the memory of a computer device as software, so that the processor can call and execute the operations corresponding to each module.

[0199] In one embodiment, a computer device is provided, which may be a server or a terminal, and its internal structure diagram may be as follows: Figure 9 As shown, the computer device includes a processor, memory, input / output interfaces (I / O), and a communication interface. The processor, memory, and I / O interfaces are connected via a system bus, and the communication interface is also connected to the system bus via the I / O interfaces. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The database stores the data involved in the above method embodiments. The I / O interfaces are used for exchanging information between the processor and external devices. The communication interface is used for communicating with external terminals via a network connection. When the computer program is executed by the processor, it implements a code processing method.

[0200] In one embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be as follows: Figure 10As shown, the computer device includes a processor, memory, input / output interfaces, a communication interface, a display unit, and an input device. The processor, memory, and input / output interfaces are connected via a system bus, and the communication interface, display unit, and input device are also connected to the system bus via the input / output interfaces. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The input / output interfaces are used for exchanging information between the processor and external devices. The communication interface is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, mobile cellular networks, NFC (Near Field Communication), or other technologies. When the computer program is executed by the processor, it implements a code processing method. The display unit of the computer device is used to form a visually visible image. It can be a display screen, a projection device, or a virtual reality imaging device. The display screen can be an LCD screen or an e-ink screen. The input device of the computer device can be a touch layer covering the display screen, or buttons, trackballs, or touchpads set on the casing of the computer device, or external keyboards, touchpads, or mice, etc.

[0201] Those skilled in the art will understand that Figure 9 The structure shown in Figure 10 is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. A specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0202] In one embodiment, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps of any of the above method embodiments.

[0203] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements the steps of any of the above method embodiments.

[0204] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, represents the steps of any of the above method embodiments.

[0205] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of related data must comply with the relevant laws, regulations and standards of the relevant regions and areas. Furthermore, the recipient may choose not to authorize the use of their information and related data, or may refuse or conveniently refuse to receive push notifications.

[0206] In this application, during the actual application of relevant data collection and processing, the informed consent or separate consent of the personal information subject should be obtained in strict accordance with the requirements of relevant local laws and regulations, and subsequent data use and processing should be carried out within the scope of laws and regulations and the authorization of the personal information subject.

[0207] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments described above. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.

[0208] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0209] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.

Claims

1. A method of code processing, characterized by, The method includes: In response to a code addition event for a target application, the code compilation information of the newly added code is obtained; the target application is compatible with multiple runtime environments. For each of the aforementioned operating environments, an application interface for the target application is created based on the interface attributes within that operating environment. Load the page instance corresponding to the code compilation information in the application interface to obtain the page performance test results in the runtime environment; The new code is released only after all page performance tests in the respective runtime environments have passed.

2. The method of claim 1, wherein, The step of obtaining code compilation information for the newly added code in response to a code addition event for the target application includes: In response to a code addition event for the target application, obtain the type information of the target application; The code compilation information of the newly added code is obtained according to the information acquisition strategy that matches the application type represented by the type information.

3. The method of claim 2, wherein, The step of obtaining the code compilation information of the newly added code according to the information acquisition strategy matching the application type includes: If the application type is a system application, determine the storage area for the compiled files of the target application; Obtain the code compilation file of the newly added code of the target application from the compilation file storage area; Determine the code compilation information, including the code compilation file.

4. The method of claim 2, wherein, The step of obtaining the code compilation information of the newly added code according to the information acquisition strategy matching the application type includes: When the application type is a microservice application, obtain multiple information storage addresses configured for the microservice application; the information storage addresses are used to store code compilation files; From the information storage addresses, determine the target storage address that matches the target application; The code compilation information is identified as containing the target storage address.

5. The method of claim 4, wherein, Loading the page instance corresponding to the code compilation information in the application interface includes: Obtain the page access address of the application interface; The page rendering resources of the target application are obtained according to the target storage address; the page rendering resources are obtained based on the code compilation file of the newly added code; Based on the page access address, the page rendering resources are loaded into the application interface to obtain a page instance.

6. The method of claim 5, wherein, The step of obtaining the page rendering resources of the target application according to the target storage address includes: Obtain the interface resource cache information of the application interface; If the interface resource cache information includes the page cache resources of the target application, the updated resource information of the target application is determined based on the page cache resources and the rendering resource information of the target application. Obtain the updated resource corresponding to the updated resource information according to the target storage address; The updated resources and the page cache resources are determined as the page rendering resources of the target application.

7. The method according to any one of claims 1 to 6, characterized in that, The step of loading the page instance corresponding to the code compilation information in the application interface and obtaining the page performance test results in the runtime environment includes: Load the page instance corresponding to the code compilation information in the application interface; Obtain multiple page performance evaluation metrics, as well as performance test parameters during the loading process; For each page performance evaluation metric, the actual metric value of the page performance evaluation metric is determined based on the performance test parameters. The actual indicator value is compared with the benchmark indicator value of the page performance evaluation indicator to obtain the indicator evaluation result of the page performance evaluation indicator. Based on the evaluation results of each of the aforementioned page performance evaluation metrics, the page performance test results in the operating environment are determined.

8. The method according to claim 7, characterized in that, The page performance evaluation metrics include custom evaluation metrics; the method further includes: In response to custom indicator events, obtain the indicator evaluation method and indicator audit metadata for the custom evaluation indicator; Based on the aforementioned indicator evaluation method and the aforementioned indicator audit metadata, create a custom audit class; Add the custom audit class described above to the performance test configuration file.

9. The method according to claim 7, characterized in that, The method further includes: In response to a test information display command for the target application, obtain display legend configuration information and display label information; Display data is extracted from the performance test information of the target application based on the display label information; Generate an initial display chart according to the aforementioned display legend configuration information; The display data is filled into the initial display chart to obtain and display the test information display chart of the target application.

10. The method according to any one of claims 1 to 6, characterized in that, The method further includes: In the event of an abnormal operating environment where any page performance test result is a failure, obtain the page performance test information of the abnormal operating environment; Anomaly analysis is performed on the target application based on the page performance test information to determine the improvement strategy for the target application; An alarm notification is generated based on the improved strategy, and the alarm notification is sent to the development terminal of the target application.

11. A code processing device, characterized in that, The device includes: The event response module is used to respond to code addition events for the target application and obtain the code compilation information of the added code; the target application is compatible with multiple runtime environments; The interface creation module is used to create the application interface of the target application in each of the aforementioned operating environments, based on the interface attributes in the operating environment. The performance testing module is used to load the page instance corresponding to the code compilation information in the application interface and obtain the page performance test results in the running environment. The release module is used to release the newly added code if the page performance test results of each of the aforementioned runtime environments are all passed.

12. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 10.

13. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 10.

14. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 10.