A device front-end application testing method and an electronic device
By identifying project identifiers, generating resource loading priority topology maps, and acquiring backup data during automated testing, the problems of resource management and data real-time performance in automated testing are solved, achieving efficient test data acquisition and improved stability.
Patent Information
- Application Number
- CN202511308742.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-15
- Publication Date
- 2025-11-28
- Estimated Expiration
- 2045-09-15
AI Technical Summary
Existing automated testing technologies suffer from several problems when dealing with complex web applications and diverse resource management, including redundant maintenance of public resources, reliance on a single data source, and delayed test data updates that lead to a disconnect between the test and production environments, affecting test coverage and execution efficiency.
By identifying the project identifier of the target device, obtaining the target project information using a preset dictionary table, generating a resource loading priority topology map, dynamically loading business resources, and obtaining backup data from the data pool when the interface is abnormal, the real-time performance and accuracy of business data during the testing process are ensured.
It improves the efficiency and accuracy of resource loading, simplifies the process of cross-project resource sharing and reuse, enhances the stability and efficiency of testing, and ensures the continuous delivery of high-quality front-end applications.
Smart Images

Figure CN120803963B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of computer, in particular to a device front-end application testing method and an electronic device. BACKGROUND
[0002] With the continuous improvement of the complexity of front-end applications, automated testing has become increasingly important. Current automated testing techniques still face many challenges when facing complex web applications and diversified resource management. For example, repeated maintenance of public resources among multiple projects, dependence on a single data source, and test data update lag leading to disconnection between test environment and production environment, these resource acquisition problems seriously affect the coverage and execution efficiency of the test.
[0003] Therefore, there is an urgent need for a flexible device front-end application testing method to improve the stability of the test, enhance the coverage ability of the test scene, and ensure the real-time and accuracy of the test data. SUMMARY
[0004] The present application provides a device front-end application testing method and an electronic device, which can ensure that business data is available at any time during the test process, thereby ensuring the real-time and accuracy of the test data, and thus better supporting the continuous delivery of high-quality front-end applications.
[0005] The present application provides a device front-end application testing method, comprising:
[0006] determining the project identifier of the target test project of the front-end application to be tested in the target device;
[0007] based on the project identifier, determining the target project information corresponding to the target test project from a preset dictionary table; wherein the preset dictionary table is preconfigured with first resource information of public business resources of test projects, second resource information of special business resources of different test projects, and interface information of business data interfaces corresponding to different test projects;
[0008] generating a resource loading priority topology graph based on the first resource information and the second resource information in the target project information, and loading the target business resources corresponding to the target test project from the preconfigured business resource library based on the resource loading priority topology graph; the resource loading priority topology graph is a topology graph representing the priority relationship between the first resource information and the second resource information;
[0009] using the target business data interface to obtain the target business data of the target test project, and performing state rollback when the target business data interface is abnormal, and then obtaining the standby business data corresponding to the target test project from the pre-device data pool as the target business data; the target business data interface is a business data interface corresponding to the interface information in the target project information;
[0010] The target service data and the loaded target service resource are used to perform a test operation corresponding to the target test item on the to-be-tested front-end application.
[0011] The application further provides a device front-end application test device, which comprises:
[0012] An item identifier determination module is configured to determine an item identifier of a target test item of a to-be-tested front-end application in a target device.
[0013] An item information determination module is configured to determine target item information corresponding to the target test item based on the item identifier from a preset dictionary table, wherein the preset dictionary table is preconfigured with first resource information of common service resources of test items, second resource information of special service resources of different test items, and interface information of service data interfaces corresponding to different test items.
[0014] A resource loading module is configured to generate a resource loading priority topology graph based on the first resource information and the second resource information in the target item information, and load target service resources corresponding to the target test item from a preconfigured service resource library based on the resource loading priority topology graph; the resource loading priority topology graph is a topology graph representing a priority relationship between the first resource information and the second resource information.
[0015] A data acquisition module is configured to acquire target service data of the target test item by using a target service data interface, and perform state rollback when the target service data interface is abnormal, and then acquire backup service data corresponding to the target test item from a pre-device data pool as the target service data; the target service data interface is a service data interface corresponding to the interface information in the target item information.
[0016] An application test module is configured to perform a test operation corresponding to the target test item on the to-be-tested front-end application by using the target service data and the loaded target service resource.
[0017] The application further provides an electronic device, which comprises a memory configured to store a computer program, and a processor configured to execute the computer program to implement the steps of any of the device front-end application test methods.
[0018] The application further provides a computer readable storage medium, which stores a computer program, wherein the computer program is executed by a processor to implement the steps of any of the device front-end application test methods.
[0019] The application further provides a computer program product, which comprises a computer program, wherein the computer program is executed by a processor to implement the steps of any of the device front-end application test methods.
[0020] In the present application, the project identifier of the target test item of the to-be-tested front-end application in the target device can be determined; based on the project identifier, the target project information corresponding to the target test item is determined from a preset dictionary table; wherein the preset dictionary table is preconfigured with first resource information of common service resources of test items, second resource information of special service resources of different test items, and interface information of service data interfaces corresponding to different test items; a resource loading priority topology graph is generated based on the first resource information and the second resource information in the target project information, and the target service resource corresponding to the target test item is loaded from the preconfigured service resource library based on the resource loading priority topology graph; the resource loading priority topology graph is a topology graph representing the priority relationship between the first resource information and the second resource information; the target service data of the target test item is obtained by using the target service data interface, and state rollback is performed when the target service data interface is abnormal, and then the standby service data corresponding to the target test item is obtained from the pre-device data pool as the target service data; the target service data interface is a service data interface corresponding to the interface information in the target project information; the target service data and the loaded target service resource are used to perform a test operation corresponding to the target test item on the to-be-tested front-end application.
[0021] As can be seen, by the method of the present application, the corresponding project information can be determined from the preset dictionary table based on the project identifier of the target test item of the to-be-tested front-end application, and then the target service resource required by the test item is loaded through the project information and the resource loading priority topology graph corresponding to the project information, and the interface required for calling data is determined through the interface information in the project information, and the target service data required by the test item is obtained through the interface, further, when the interface is abnormal, the standby service data can be obtained from the pre-device data pool as the target service data, and finally the target service data and the loaded target service resource can be used to perform a test operation corresponding to the target test item on the to-be-tested front-end application. Thus, it can be ensured that there is always business data available during the test process, thereby ensuring the real-time and accuracy of the test data, so as to better support the continuous delivery of high-quality front-end applications. BRIEF DESCRIPTION OF DRAWINGS
[0022] In order to more clearly illustrate the embodiments of the present application, the drawings required in the embodiments will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creating any creative labor.
[0023] Figure 1 A device front-end application test method flowchart is provided for the embodiments of the present application;
[0024] Figure 2 A project resource loading schematic diagram provided for an embodiment of the present application;
[0025] Figure 3 A public resource and public data acquisition schematic diagram provided for an embodiment of the present application;
[0026] Figure 4 A special resource and special data acquisition schematic diagram provided for an embodiment of the present application;
[0027] Figure 5 A device front-end application testing device structure schematic diagram provided for an embodiment of the present application. DETAILED DESCRIPTION
[0028] The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work fall within the protection scope of the present application.
[0029] It should be noted that, in the description of the present application, the terms "comprise", "contain" or any other variants thereof are intended to cover non-exclusive inclusion, so that the process, method, article or device comprising a series of elements not only includes those elements, but also includes other elements not explicitly listed or inherent to such process, method, article or device. The terms "first", "second" and the like in the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence.
[0030] In order to enable those skilled in the art to better understand the present application, the present application will be further described in detail below with reference to the drawings and specific embodiments.
[0031] The current automatic testing technology still faces many challenges when facing complex Web applications and diversified resource management. For example, the repeated maintenance of public resources among multiple projects, the dependence on a single data source, and the lagging of test data update leading to the disconnection between test environment and production environment, etc. These resource acquisition problems seriously affect the coverage and execution efficiency of the test.
[0032] In order to overcome the above technical problems, the present application discloses a device front-end application testing method and electronic device, which can ensure that there is always business data available during the testing process, thereby ensuring the real-time and accuracy of the test data, and thus better supporting the continuous delivery of high-quality front-end applications.
[0033] ReferenceFigure 1 As shown, the embodiments of the present application provide a device front-end application testing method, which is described in detail in combination with the execution flow of the device front-end application testing method. The method comprises the following steps:
[0034] In step S11, the project identifier of the target test item of the front-end application to be tested in the target device is determined.
[0035] In this embodiment, the project identifier of the target test item of the front-end application to be tested in the target device is first determined. Since the front-end application to be tested corresponds to multiple projects, such as the projects “PROJ_001”, “PROJ_002”, etc., the target test item of the front-end application to be tested needs to be determined, and the project identifier corresponding to the target test item needs to be determined. For example, if the target test item is “PROJ_001”, the project identifier corresponding to the target test item is “PROJ_001”. In this way, the accuracy of subsequent resource acquisition can be ensured through the correspondence of the identifier, and the accuracy of device front-end application testing can be ensured.
[0036] In step S12, the target project information corresponding to the target test item is determined from a preset dictionary table based on the project identifier. The preset dictionary table is preconfigured with the first resource information of the common business resource of the test item, the second resource information of the special business resource of different test items, and the interface information of the business data interface corresponding to different test items.
[0037] In this embodiment, the target project information corresponding to the target test item needs to be determined from the preset dictionary table based on the project identifier. It needs to be noted that the preset dictionary table is preconfigured with the first resource information of the common business resource of the test item, the second resource information of the special business resource of different test items, and the interface information of the business data interface corresponding to different test items. Specifically, as shown in Table 1, the first resource information of the common business resource of the test item, the second resource information of the special business resource of different test items, and the interface information of the business data interface corresponding to different test items are preconfigured in the preset dictionary table. Figure 2As shown, the project dictionary table needs to be parsed, and the preset dictionary table located in the target device and the project identifier of the target test project are loaded, and then the common service resource identifier and the common data calling interface information of the common service resource corresponding to the project identifier determined from the preset dictionary table are needed. It needs to be noted that, since the common service resource is the basic information commonly relied on by each project, these resources usually have certain stability and persistence and will not change before a certain condition (such as server restart). Mainly includes user information, version information, server information and other fixed information. Therefore, it can be directly obtained by parsing the dictionary table, the common service resource identifier of the common service resource is "res_common_ids": ["COMMON_001", "COMMON_002"], and the common data calling interface information is "api_common_urls": [" / api / user / list", " / api / order / detail"].
[0038] Further, the private service resource identifier and the private data calling interface information corresponding to the project identifier also need to be determined from the preset dictionary table. If the project identifier is "PROJ_001", the private service resource identifier "res_private_ids": ["PRIVATE_001"] corresponding to "PROJ_001" and the private data calling interface information "api_private_urls": [" / api / system / cpu"] corresponding to "PROJ_001" need to be obtained. In this way, by parsing the resource dictionary table in the project configuration, the system can accurately identify and load the common resources and unique resources required by the current project, ensuring that each project only loads the necessary resources, improving the efficiency and accuracy of resource loading.
[0039] In step S13, a resource loading priority topology graph is generated based on the first resource information and the second resource information in the target project information, and the target business resource corresponding to the target test project is loaded from the pre-configured business resource library based on the resource loading priority topology graph. The resource loading priority topology graph is a topology graph representing the priority relationship between the first resource information and the second resource information.
[0040] In this embodiment, the target business resource corresponding to the target test project needs to be loaded from the pre-configured business resource library based on the corresponding resource information in the target project information. Specifically, as shown in the following table, the target business resource corresponding to the target test project needs to be loaded from the pre-configured business resource library based on the corresponding resource information in the target project information. Figure 2As shown, the resource dependency relationship between the first resource information and the second resource information needs to be determined, and the resource loading priority topology graph between the first resource information and the second resource information is generated based on the resource dependency relationship. The dependency relationship between resources can be determined according to the field "dependencies" in the code. For example, the "dependencies" field of the special business resource "PRIVATE_001" is "dependencies": ["COMMON_001"], which means that "PRIVATE_001" depends on "COMMON_001". Therefore, the resource loading priority topology graph needs to be generated according to this resource dependency relationship.
[0041] Further, based on the common business resource identifier and the resource loading priority topology graph, a resource request is initiated to the preset common business resource configuration library to load the common business resource corresponding to the target test project, that is, based on the common business resource identifier "res_common_ids" and the generated resource loading priority topology graph, a resource request is initiated to the preset common business resource configuration library, and then the common business resource required by the current project is dynamically loaded, and the common business resource is a reusable business resource.
[0042] Further, based on the special business resource identifier and the resource loading priority topology graph, a resource request is initiated to the preset special business resource configuration library to load the special business resource corresponding to the target test project. Specifically, as shown in Figure 2 As shown, the resource dependency relationship between the first resource information and the second resource information needs to be determined, and the resource loading priority topology graph between the first resource information and the second resource information is generated based on the resource dependency relationship. The dependency relationship between resources can be determined according to the field "dependencies" in the code. For example, the "dependencies" field of the special business resource "PRIVATE_001" is "dependencies": ["COMMON_001"], which means that "PRIVATE_001" depends on "COMMON_001". Therefore, the resource loading priority topology graph needs to be generated according to this resource dependency relationship.
[0043] In step S14, the target business data interface is used to obtain the target business data of the target test project, and the state is rolled back when the target business data interface is abnormal, and then the standby business data corresponding to the target test project is obtained from the pre-device data pool as the target business data; the target business data interface is a business data interface corresponding to the interface information in the target project information.
[0044] In this embodiment, the business data needs to be acquired through the interface corresponding to the target project information, and since there are interface abnormal situations, the standby data can be used as the target business data when the interface is abnormal. Specifically, in the scenario of acquiring public business data, the public data calling interface information needs to be determined to determine the public data calling interface, and the public data calling interface is used to acquire the public business data corresponding to the target test project. The public data calling interface information is "api_common_urls", which can be used to determine the public data calling interface. Then the public data calling interface is used to acquire the public business data corresponding to the target test project. Further, the data acquired through the interface may not necessarily be the corresponding business data, and there may also be interface abnormal situations, so it is necessary to determine whether the public data calling interface returns interface error information such as timeout, no response, etc. If the public business data is successfully acquired, the public business data is used as the target public business data in the target business data. However, when the public data calling interface has an abnormal situation, the public system recovery model needs to be triggered to perform snapshot rollback and resource acquisition retry, as shown in Figure 3 Specifically, in the snapshot rollback stage, the target public snapshot of the preset public business resource configuration library needs to be determined, and the state rollback is performed based on the target public snapshot to restore the preset public business resource configuration library to the state node corresponding to the target public snapshot, and the target public snapshot is the latest valid snapshot of the preset public business resource configuration library. Then after the rollback is completed, in the acquisition retry stage, the step of determining the public data calling interface through the public data calling interface information needs to be jumped to until the public business data is successfully acquired. Finally, the latest public snapshot of the preset public business resource configuration library needs to be generated to obtain a new target public snapshot. It needs to be noted that the snapshot contains resource identifier, version number, dependency relationship, timestamp and checksum.
[0045] Further, the first data index is generated based on the interface locator of the public data calling interface through the preset fault recovery model, then the first standby business data corresponding to the first data index is found in the preset public data pool, and the first standby business data is used as the target public business data. In this way, the interface abnormality can be determined and the standby data can be acquired when the interface has a problem, so as to ensure that the business data is available at any time during the test, and the test can be stably performed.
[0046] In the scenario of obtaining special service data, the special data calling interface needs to be determined through the special data calling interface information, and the first special service data corresponding to the target test item needs to be obtained through the special data calling interface. According to the special data calling interface information "api_private_urls", the special data calling interface is determined, and then the special service data corresponding to the target test item is obtained through the special data calling interface. The same as the public data calling interface, the special data calling interface may also have interface exception conditions. Therefore, the target special snapshot of the preset special service resource configuration library needs to be determined, and state rollback is performed based on the target special snapshot to restore the preset special service resource configuration library to the state node corresponding to the target special snapshot. Then jump to the step of determining the special data calling interface through the special data calling interface information until the first special service data is successfully obtained. Finally, the latest special snapshot of the preset special service resource configuration library is generated to obtain a new target special snapshot, and the snapshot update is completed. Further, it is necessary to determine whether the special data calling interface returns interface error information. If no error information is returned, the first special service data is successfully obtained, and the first special service data is taken as the target special service data in the target service data. In another case, when the special data calling interface returns interface error information, it is determined that the special data calling interface has an exception, as shown in Figure 4 , a second data index needs to be generated based on the interface locator of the special data calling interface through the preset hot replacement model, and then the second backup service data corresponding to the second data index is searched in the preset special data pool, and the second backup service data is taken as the target special service data.
[0047] It needs to be noted that the difference between the scenario of obtaining special service data and the scenario of obtaining public service data is that in the scenario of obtaining special service data, the preset hot replacement model needs to be enabled to monitor the special data calling interface in real time, and after the special data calling interface is restored to normal, the special service data is obtained through the special data calling interface. Specifically, as shown in Figure 4 , the special data calling interface needs to be polled regularly through the preset hot replacement model to determine whether the special data calling interface is restored to normal. If it is detected that the special data calling interface is restored to normal, the second special service data corresponding to the target test item is obtained through the special data calling interface, then the second special service data is replaced with the second backup service data, and the second special service data is taken as the target special service data in the target service data. In this way, when the business interface has an exception, the system can obtain the backup data from the data pool to ensure that the system can still run continuously in the case that the interface is unavailable, improve the robustness of the system, and allow resource updating or repairing without interrupting the service, enhance the adaptability and response speed of the system.
[0048] In step S15, the target service data and the loaded target service resource are used to perform a test operation corresponding to the target test item on the to-be-tested front-end application.
[0049] In this embodiment, the front-end can be tested by using the target service data and the loaded target service resource.
[0050] In this embodiment, the project identifier of the target test item of the to-be-tested front-end application in the target device can be determined; based on the project identifier, the target project information corresponding to the target test item is determined from a preset dictionary table; wherein the preset dictionary table is preconfigured with first resource information of common service resources of test items, second resource information of special service resources of different test items, and interface information of service data interfaces corresponding to different test items; a resource loading priority topology graph is generated based on the first resource information and the second resource information in the target project information, and target service resources corresponding to the target test item are loaded from a preconfigured service resource library based on the resource loading priority topology graph; the resource loading priority topology graph is a topology graph representing the priority relationship between the first resource information and the second resource information; the target business data of the target test item is obtained by using the target business data interface, and state rollback is performed when the target business data interface is abnormal, and then the standby business data corresponding to the target test item is obtained from the pre-device data pool as the target business data; the target business data interface is a business data interface corresponding to the interface information in the target project information; the target business data and the loaded target business resources are used to execute a test operation corresponding to the target test item on the to-be-tested front-end application. As can be seen, by the method of the present application, the corresponding project information can be determined from the preset dictionary table based on the project identifier of the target test item of the to-be-tested front-end application, and then the target business resources required by the test item are loaded through the project information, and the interface required for calling data can be determined through the interface information in the project information, and the target business data required by the test item is obtained through the interface, further, when the interface is abnormal, the standby business data can be obtained from the pre-device data pool as the target business data, and finally the target business data and the loaded target business resources can be used to execute a test operation corresponding to the target test item on the to-be-tested front-end application. Thus, on the one hand, by analyzing the resource dictionary table in the project configuration, the system can accurately identify and load the common resources and specific resources required by the current project, ensuring that each project only loads the necessary resources, improving the efficiency and accuracy of resource loading; on the other hand, by centrally managing and dynamically loading resources, the cross-project resource sharing and reuse process is simplified, reducing redundancy and conflicts, improving the stability and efficiency of testing; on the other hand, when the business interface is abnormal, the system can obtain the bottom-up standby data from the data pool to ensure that the system can still run continuously in the case of unavailable interface, improving the robustness of the system, and allowing resource updates or repairs without interrupting service, enhancing the adaptability and response speed of the system.
[0051] As a preferred embodiment, before the target service data and the loaded target service resource are used to execute the test operation corresponding to the target test item on the to-be-tested front-end application, the standby service data also needs to be written into the corresponding data cache module, for example, the first standby service data found through the preset common data pool is cached in the general data buffer module, and the second standby service data found in the preset special data pool is cached in the corresponding service type data service module. By caching the standby data in the corresponding data cache module, and before writing, the standby data needs to be verified, specifically, the format verification and signature verification of the standby service data are needed, if the standby service data passes the format verification and signature verification, the standby service data is written into the corresponding data cache module. Then, when the target service data interface initiates the request for obtaining service data again, the standby service data can be found from the data cache module. For example, when the common data calling interface obtains data again, the corresponding first standby service data can be directly obtained from the general data buffer module, and when the special data calling interface obtains data again, the second standby service data can be directly obtained from the service type data service module. In this way, the efficiency of data acquisition is effectively improved.
[0052] Further, in order to avoid the interference of residual data in the data cache module on the next operation, the residual data in the data cache module needs to be cleared, specifically, if the device reset instruction is received, the target device is reset, and the data in the data cache module is cleared. For example, when the server receives the SIGINT (Signal Intelligence) or SIGTERM signal (i.e. shutdown or restart event), the cleaning task is automatically triggered, and the cleaning operation of the general data buffer module is performed, when the server performs the reset operation (such as factory reset, re-boarding), the system will automatically clean the data in the service type data service module. Specifically, the data in the data cache module needs to be classified based on the preset data classification level to obtain the classified cache data, and after receiving the device reset instruction, the target device is reset, and the classified cache data is cleared based on the preset data classification level; and the cleaning needs to obtain the cleaning strategy from the business cleaning strategy table, and the cleaning is performed according to the cleaning strategy, then the data in the service type data service module is asynchronously emptied, if there is reserved data that has not been cleaned, the reserved data is encrypted and backed up, and the corresponding cache cleaning log is generated, and the cleaning log contains the time, type, range and operation source of the cleaning, to ensure that it can be audited. Thus, the next start environment can be ensured to be clean and consistent.
[0053] After the data cache is cleared, if the target business data interface initiates a request for obtaining target business data again, it is necessary to jump to the step of obtaining target business data of the target test item by using the target business data interface, so as to re-perform the acquisition of business data. It needs to be explained that since the cache data has been cleared, there may be a new project test at this time, therefore, after the target business data interface initiates a request for obtaining target business data again, the data in the cache is no longer available, and it is necessary to re-perform the acquisition of business data, thereby avoiding data pollution of historical data on new project testing. In this way, the system automatically clears the data in the general business data cache module and the business data service module, ensures that the latest configuration is used every time it is started, avoids interference of residual old data on the system, and maintains the consistency and cleanliness of the environment.
[0054] Through the description of the above embodiments, those skilled in the art can clearly understand that the method according to the above embodiments can be realized by means of software and necessary general hardware platform, of course, it can also be realized by hardware, but in many cases, the former is a better embodiment.
[0055] Referring to Figure 5 The embodiments of the present application also provide a device front-end application testing device, which comprises:
[0056] A project identifier determination module 11 is configured to determine a project identifier of a target test item of a front-end application to be tested in a target device.
[0057] A project information determination module 12 is configured to determine target project information corresponding to the target test item based on the project identifier from a preset dictionary table; wherein the preset dictionary table is pre-configured with first resource information of common business resources of test items, second resource information of special business resources of different test items, and interface information of business data interfaces corresponding to different test items.
[0058] A resource loading module 13 is configured to generate a resource loading priority topology graph based on the first resource information and the second resource information in the target project information, and load target business resources corresponding to the target test item from a pre-configured business resource library based on the resource loading priority topology graph; the resource loading priority topology graph is a topology graph representing the priority relationship between the first resource information and the second resource information.
[0059] A data acquisition module 14 is configured to acquire target business data of the target test item by using a target business data interface, and perform state rollback when the target business data interface is abnormal, and then acquire backup business data corresponding to the target test item from a pre-device data pool as the target business data; the target business data interface is a business data interface corresponding to the interface information in the target project information.
[0060] The application test module 15 is configured to perform a test operation corresponding to the target test item on the front-end application to be tested by using the target business data and the loaded target business resource.
[0061] In some embodiments, the item identifier determination module 11 and the item information determination module 12 can specifically include:
[0062] The data loading unit is configured to load a preset dictionary table and an item identifier of the target test item in the target device.
[0063] The first information determination unit is configured to determine, from the preset dictionary table, a public business resource identifier and public data calling interface information of a public business resource corresponding to the item identifier.
[0064] The second information determination unit is configured to determine, from the preset dictionary table, a special business resource identifier and special data calling interface information corresponding to the item identifier.
[0065] In some embodiments, the resource loading module 13 can specifically include:
[0066] The first resource loading unit is configured to initiate a resource request to a preset public business resource configuration library based on the public business resource identifier and the resource loading priority topology graph, so as to load the public business resource corresponding to the target test item.
[0067] The second resource loading unit is configured to initiate a resource request to a preset special business resource configuration library based on the special business resource identifier and the resource loading priority topology graph, so as to load the special business resource corresponding to the target test item.
[0068] In some embodiments, the data acquisition module 14 can specifically include:
[0069] The public data acquisition unit is configured to determine a public data calling interface through the public data calling interface information, and acquire the public business data corresponding to the target test item through the public data calling interface.
[0070] The first return information judgment unit is configured to judge whether the public data calling interface returns interface error information.
[0071] The public data determination unit is configured to, if the public business data is successfully acquired, take the public business data as target public business data in the target business data.
[0072] The first exception determination unit is configured to, if the public data calling interface returns the interface error information, determine that the public data calling interface is abnormal.
[0073] The first state rollback unit is configured to determine a target common snapshot of the preset common service resource configuration library, and perform state rollback based on the target common snapshot to restore the preset common service resource configuration library to a state node corresponding to the target common snapshot; the target common snapshot is the latest valid snapshot of the preset common service resource configuration library.
[0074] The first step jump unit is configured to jump to a step of determining a common data calling interface through common data calling interface information until the common service data is successfully acquired.
[0075] The first snapshot updating unit is configured to generate a latest common snapshot of the preset common service resource configuration library to obtain a new target common snapshot.
[0076] The first index generating unit is configured to generate a first data index based on an interface locator of the common data calling interface through a preset fault recovery model.
[0077] The first backup data searching unit is configured to search for first backup service data corresponding to the first data index in a preset common data pool, and take the first backup service data as the target common service data.
[0078] In some embodiments, the data acquisition module 14 can specifically include:
[0079] The first special data acquiring unit is configured to determine a special data calling interface through special data calling interface information, and acquire first special service data corresponding to the target test item through the special data calling interface.
[0080] The second return information judging unit is configured to judge whether the special data calling interface returns interface error information.
[0081] The special data determining unit is configured to, if the first special service data is successfully acquired, take the first special service data as target special service data in the target service data.
[0082] The second exception determining unit is configured to, if the special data calling interface returns the interface error information, determine that the special data calling interface is abnormal.
[0083] The second state rollback unit is configured to determine a target special snapshot of the preset special service resource configuration library, and perform state rollback based on the target special snapshot to restore the preset special service resource configuration library to a state node corresponding to the target special snapshot; the target special snapshot is the latest valid snapshot of the preset special service resource configuration library.
[0084] The second step jump unit is configured to jump to a step of determining a special data calling interface through special data calling interface information until the first special service data is successfully acquired.
[0085] a second snapshot updating unit, configured to generate a latest special snapshot of a preset special service resource configuration library to obtain a new target special snapshot;
[0086] a second index generating unit, configured to generate a second data index based on an interface locator of the special data calling interface through a preset hot replacement model;
[0087] a second backup data searching unit, configured to search for second backup service data corresponding to the second data index in a preset special data pool, and use the second backup service data as the target special service data.
[0088] In some embodiments, the device front-end application testing apparatus can further include:
[0089] an interface recovery determining unit, configured to poll the special data calling interface at a preset time interval through the preset hot replacement model to determine whether the special data calling interface is recovered to normal;
[0090] a second special data obtaining unit, configured to, if the special data calling interface is recovered to normal, obtain second special service data corresponding to the target test item through the special data calling interface;
[0091] a data replacing unit, configured to replace the second backup service data with the second special service data, and use the second special service data as the target special service data in the target service data.
[0092] In some embodiments, the device front-end application testing apparatus can further include:
[0093] a data checking unit, configured to perform format verification and signature checking on the backup service data;
[0094] a data writing unit, configured to, if the backup service data passes the format verification and the signature checking, write the backup service data into the corresponding data cache module;
[0095] a data searching unit, configured to, if the target service data interface initiates the request of obtaining the service data again, search for the backup service data from the data cache module.
[0096] In some embodiments, the device front-end application testing apparatus can further include:
[0097] a level dividing unit, configured to divide the data in the data cache module into different levels based on a preset data division level to obtain cached data after division;
[0098] a cache clearing unit, configured to, if a device resetting instruction is received, reset the target device, and clear the cached data after division based on the preset data division level;
[0099] The log generation unit is configured to, if there is reserved data that has not been cleared, encrypt the reserved data and generate a corresponding cache clearing log.
[0100] In some embodiments, the device front-end application testing apparatus can further include:
[0101] The data reacquisition unit is configured to, if the target service data interface initiates a request for acquiring the target service data again, jump to the step of acquiring the target service data of the target test item by using the target service data interface, to reacquire the service data.
[0102] The features of the embodiments of the device front-end application testing apparatus can be referred to the related descriptions of the embodiments of the device front-end application testing method, which will not be repeated here.
[0103] Embodiments of the present application also provide an electronic device, including a memory and a processor, the memory stores a computer program, and the processor is configured to run the computer program to perform the steps in any of the above device front-end application testing method embodiments.
[0104] Embodiments of the present application also provide a computer readable storage medium, which stores a computer program, wherein the computer program is configured to perform the steps in any of the above device front-end application testing method embodiments when running.
[0105] In an example embodiment, the above computer readable storage medium can include, but is not limited to, a U disk, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk, and various media that can store computer programs.
[0106] Embodiments of the present application also provide a computer program product, which includes a computer program, and the computer program is executed by a processor to implement the steps in any of the above device front-end application testing method embodiments.
[0107] Embodiments of the present application also provide another computer program product, which includes a non-volatile computer readable storage medium, and the non-volatile computer readable storage medium stores a computer program, and the computer program is executed by a processor to implement the steps in any of the above device front-end application testing method embodiments.
[0108] Those skilled in the art will further realize that the mere concepts, teachings, and embodiments described herein are merely meant to provide an enabling description of the applications and are not intended to limit the scope of the applications. Therefore, embodiments or examples described herein are not meant to be limiting, but merely to aid in the understanding of the overall more complete disclosure of the applications. Accordingly, those skilled in the art will recognize that modifications and variations of the described implementations can be made without departing from the spirit or scope of the applications. Therefore, it is intended that such modifications and variations be included within the scope of the applications.
[0109] The method for testing a device front-end application and the electronic device are described in detail above. The principles and implementation manners of the present application are described by using specific examples in the present application. The above description of the embodiments is only applicable to help understand the method and the core idea of the present application. It should be pointed out that, for those skilled in the art, some improvements and modifications can be made to the present application without departing from the principles of the present application. These improvements and modifications also fall within the protection scope of the claims of the present application.
Claims
1. A method for testing front-end applications of a device, characterized in that, include: Determine the project identifier of the target test item for the front-end application to be tested on the target device; Based on the project identifier, the target project information corresponding to the target test project is determined from a preset dictionary table; wherein, the preset dictionary table is pre-configured with first resource information of the public business resources of the test project, second resource information of the dedicated business resources of different test projects, and interface information of the business data interfaces corresponding to different test projects; A resource loading priority topology diagram is generated based on the first resource information and the second resource information in the target project information, and the target business resources corresponding to the target test project are loaded from the pre-configured business resource library based on the resource loading priority topology diagram; the resource loading priority topology diagram is a topology diagram representing the priority relationship between the first resource information and the second resource information; Using the target business data interface, the target business data of the target test project is obtained, and when the target business data interface is abnormal, the state is rolled back. Then, the backup business data corresponding to the target test project is obtained from the preset backup data pool as the target business data. The target business data interface is the business data interface corresponding to the interface information in the target project information. Using the target business data and the loaded target business resources, perform test operations on the front-end application to be tested that correspond to the target test project; The step of generating a resource loading priority topology map based on the first resource information and the second resource information in the target project information, and loading the target business resources corresponding to the target test project from a pre-configured business resource library based on the resource loading priority topology map, includes: Determine the resource dependency relationship between the first resource information and the second resource information, and generate a resource loading priority topology graph between the first resource information and the second resource information based on the resource dependency relationship; Based on the public business resource identifier and the resource loading priority topology map, a resource request is initiated to the preset public business resource configuration library to load the public business resources corresponding to the target test project; Based on the dedicated business resource identifier and the resource loading priority topology map, a resource request is initiated to the preset dedicated business resource configuration library to load the dedicated business resources corresponding to the target test project; the public business resource identifier and the dedicated business resource identifier are identifiers determined through the preset dictionary table and the project identifier.
2. The device front-end application testing method according to claim 1, characterized in that, The project identifier of the target test item for the front-end application to be tested in the target device is determined; Based on the project identifier, the target project information corresponding to the target test project is determined from a preset dictionary table, including: Load the preset dictionary table located in the target device and the project identifier of the target test project; Determine the public business resource identifier and public data call interface information of the public business resource corresponding to the project identifier from the preset dictionary table; The dedicated business resource identifier and dedicated data call interface information corresponding to the project identifier are determined from the preset dictionary table.
3. The device front-end application testing method according to claim 1, characterized in that, The process of acquiring target business data for the target test project using the target business data interface, performing a state rollback when the target business data interface encounters an anomaly, and then acquiring backup business data corresponding to the target test project from a preset backup data pool as the target business data includes: The public data call interface is determined by the public data call interface information, and the public business data corresponding to the target test project is obtained through the public data call interface. Determine whether the public data call interface returns an interface error message; If the public business data is successfully obtained, then the public business data will be used as the target public business data in the target business data. If the public data call interface returns an interface error message, it is determined that the public data call interface is abnormal; A target public snapshot of the preset public service resource configuration library is determined, and a state rollback is performed based on the target public snapshot to restore the preset public service resource configuration library to the state node corresponding to the target public snapshot; the target public snapshot is the latest valid snapshot of the preset public service resource configuration library; Jump to the step of determining the public data call interface through the public data call interface information, until the public business data is successfully obtained; Generate the latest public snapshot of the preset public business resource configuration library to obtain the new target public snapshot; A first data index is generated based on the interface locator of the public data call interface using a preset fault recovery model; The first backup business data corresponding to the first data index is searched in the preset public data pool, and the first backup business data is used as the target public business data.
4. The device front-end application testing method according to claim 1, characterized in that, The process of acquiring target business data for the target test project using the target business data interface, performing a state rollback when the target business data interface encounters an anomaly, and then acquiring backup business data corresponding to the target test project from a preset backup data pool as the target business data includes: The dedicated data call interface is determined by the dedicated data call interface information, and the first dedicated business data corresponding to the target test project is obtained through the dedicated data call interface. Determine whether the dedicated data call interface returns an interface error message; If the first dedicated service data is successfully obtained, then the first dedicated service data shall be used as the target dedicated service data in the target service data. If the dedicated data call interface returns an interface error message, it is determined that the dedicated data call interface is abnormal; A target dedicated snapshot of the preset dedicated service resource configuration library is determined, and a state rollback is performed based on the target dedicated snapshot to restore the preset dedicated service resource configuration library to the state node corresponding to the target dedicated snapshot; the target dedicated snapshot is the latest valid snapshot of the preset dedicated service resource configuration library; Jump to the step of determining the dedicated data call interface through the dedicated data call interface information, until the first dedicated business data is successfully obtained; Generate the latest dedicated snapshot of the preset dedicated business resource configuration library to obtain the new target dedicated snapshot; A second data index is generated based on the interface locator of the dedicated data call interface using a preset hot-swap model; The second backup service data corresponding to the second data index is located in the preset dedicated data pool, and the second backup service data is used as the target dedicated service data.
5. The device front-end application testing method according to claim 4, characterized in that, Before performing the test operation corresponding to the target test project on the front-end application under test using the target business data and the loaded target business resources, the method further includes: The dedicated data call interface is periodically polled using the preset hot-swap model to determine whether the dedicated data call interface has returned to normal. If the dedicated data call interface returns to normal, the second dedicated business data corresponding to the target test project will be obtained through the dedicated data call interface. The second dedicated service data is used to replace the second backup service data, and the second dedicated service data is used as the target dedicated service data in the target service data.
6. The device front-end application testing method according to any one of claims 1 to 5, characterized in that, Before performing the test operation corresponding to the target test project on the front-end application under test using the target business data and the loaded target business resources, the method further includes: The backup business data is subjected to format verification and signature verification; If the backup business data passes the format verification and the signature verification, then the backup business data is written into the corresponding data cache module; Accordingly, the method further includes: If the target business data interface initiates another request to obtain business data, the backup business data is retrieved from the data cache module.
7. The device front-end application testing method according to claim 6, characterized in that, After performing test operations corresponding to the target test project on the front-end application under test using the target business data and the loaded target business resources, the method further includes: The data in the data caching module is classified into levels based on a preset data classification level to obtain graded cached data; If a device reset command is received, the target device is reset, and the cached data after classification is cleared based on the preset data classification level. If there is any retained data that has not been cleared, the retained data is encrypted and backed up, and a corresponding cache clearing log is generated.
8. The device front-end application testing method according to claim 7, characterized in that, After clearing the cached data based on the preset data classification level, the process further includes: If the target business data interface initiates another request to obtain target business data, the process jumps to the step of using the target business data interface to obtain the target business data of the target test project, so as to re-obtain the business data.
9. An electronic device, characterized in that, include: Memory, used to store computer programs; A processor, configured to implement the steps of the device front-end application testing method as described in any one of claims 1 to 8 when executing the computer program.
Citation Information
Patent Citations
Shunting processing method and system, program product and readable storage medium
CN118945115A
Multi-channel parallel test system and method based on memory
CN119917357A