Application detection methods, devices, and computer-readable storage media
By determining the location of the embedded points in the application's program script to collect runtime data, the application's status information is automatically detected, solving the problem of low efficiency in manual detection in existing technologies and achieving more efficient and accurate detection results.
Patent Information
- Application Number
- CN202210801742.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-08
- Publication Date
- 2025-11-14
- Estimated Expiration
- 2042-07-08
AI Technical Summary
Current technologies rely on manual methods for application detection, which leads to low accuracy and efficiency in the detection results.
By defining the location of the tracking points in the application's program scripts, tracking points are generated to collect runtime data, and the application's status information is automatically determined based on the runtime data, thus achieving automatic detection.
It improves the efficiency and accuracy of application detection, avoiding the inefficiency of manual detection.
Smart Images

Figure CN115292163B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of financial technology or other related fields, and more specifically, to a method, apparatus, and computer-readable storage medium for detecting an application. Background Technology
[0002] During the development and maintenance of applications, a series of tests are usually required for newly developed or modified applications. For example, the updated code parts of the application are tested to confirm whether the code execution logic meets the developer's expected requirements.
[0003] However, in existing technologies, after software development projects are deployed, most applications rely on manual analysis of code execution logic. For example, testers generate business documents in the application and observe the document flow and related results. Finally, they determine whether the application has any anomalies based on the flow and results. However, the results of this detection method are difficult to control and largely depend on the tester's personal ability and experience. Therefore, it not only affects the accuracy of the results but also leads to low detection efficiency.
[0004] There is currently no effective solution to the above problems. Summary of the Invention
[0005] This application provides a method, apparatus, and computer-readable storage medium for detecting applications, thereby at least solving the technical problem of low detection efficiency caused by manual detection of application code execution logic in the prior art.
[0006] According to one aspect of the embodiments of this application, an application detection method is provided, comprising: acquiring application detection information; determining the location of a tracking point based on the location of the detection information in the program script corresponding to the application, and generating a tracking point at the tracking point location, wherein the tracking point is used to collect running data, and the running data is the data actually generated by the application when running the detection information; determining the application's state information based on the running data, wherein the state information is used to characterize the running state of the application when running the detection information.
[0007] Furthermore, the information to be detected includes at least one of the following: first code updated in the application, second code in the application used to implement the target business, and third code in the application with a cyclomatic complexity greater than a preset threshold. The target business is the business that meets the preset business scenario. Cyclomatic complexity is used to characterize the complexity of the code, and cyclomatic complexity is positively correlated with the complexity of the code.
[0008] Furthermore, the application detection method also includes: obtaining multiple business scenario identifiers in the application, wherein each business scenario identifier corresponds to a business scenario that the application is to implement; determining a target business scenario identifier from the multiple business scenario identifiers, wherein the business scenario represented by the target business scenario identifier is a preset business scenario; and determining second code from the program script based on the target business scenario identifier.
[0009] Furthermore, the application detection method also includes: obtaining the program script of the current version of the application and the program script of the previous version; determining the first code based on the program script of the current version and the program script of the previous version.
[0010] Furthermore, the application detection method also includes: obtaining the application scenario type of the information to be detected, wherein the application scenario type includes at least: front-end application scenario and back-end application scenario; and determining the location of the tracking point based on the application scenario type.
[0011] Furthermore, the application detection method also includes: in the case of a front-end application scenario, obtaining the code format of the information to be detected; and determining the location of the tracking point based on the code format and the location of the information to be detected in the program script.
[0012] Furthermore, the application detection method also includes: when the application scenario type is a backend application scenario, obtaining the function type and code format of the information to be detected, wherein the function type is used to characterize the business logic to be implemented by the information to be detected; and determining the placement of the tracking point based on the function type, code format, and the position of the information to be detected in the program script.
[0013] Furthermore, the application detection method also includes: the front-end application scenario includes at least a client display scenario and a webpage display scenario; before determining the application's state information based on the running data, when the front-end application scenario is a client display scenario, the running data is stored in a preset storage area and sent to the server at preset intervals; when the front-end application scenario is a webpage display scenario, the running data is stored in a database corresponding to the webpage and sent to the server when the webpage is closed, wherein the webpage is a display webpage generated based on the information to be detected.
[0014] Furthermore, the application detection method also includes: when the running data matches the preset target result, determining that the application is running normally and is subject to detection information, wherein the target result represents the normal data that the application should generate when running the information to be detected; when the running data does not match the target result, determining that the application is abnormal when running the information to be detected.
[0015] According to another aspect of the embodiments of this application, an application detection device is also provided, comprising: an acquisition module for acquiring application information to be detected; a first determination module for determining the location of a tracking point based on the location of the information to be detected in the program script corresponding to the application, and generating a tracking point at the tracking point location, wherein the tracking point is used to collect running data, and the running data is the data actually generated by the application when running the information to be detected; and a second determination module for determining the state information of the application based on the running data, wherein the state information is used to characterize the running state of the application when running the information to be detected.
[0016] According to another aspect of the embodiments of this application, a computer-readable storage medium is also provided, which stores a computer program, wherein the computer program is configured to execute the above-described detection method for the application program at runtime.
[0017] According to another aspect of the embodiments of this application, an electronic device is also provided, which includes one or more processors and a memory, the memory being used to store one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the above-described application detection method.
[0018] In this embodiment, the method of obtaining runtime data through event tracking and detecting the application based on the runtime data is adopted. After obtaining the application's information to be detected, the event tracking position is determined according to the position of the information to be detected in the program script corresponding to the application, and event tracking is generated at the event tracking position. The event tracking is used to collect runtime data, which is the data actually generated by the application when running the information to be detected. Finally, the application's status information is determined based on the runtime data, whereby the status information is used to characterize the application's running status when running the information to be detected.
[0019] As described above, this application determines the tracking point location by placing the information to be detected within the corresponding program script of the application. Therefore, the tracking points in this application can accurately obtain the runtime data generated by the application when running the information to be detected. It should be noted that since the runtime data is actually generated by the application, analyzing the runtime data can automatically determine whether any abnormalities have occurred during the application's operation, thus determining the application's status information. This application automates the monitoring of the execution process and related results of the information to be detected through tracking points, thereby avoiding the low detection efficiency problem inherent in existing technologies that rely on manual methods for application detection.
[0020] As can be seen from the above analysis, the technical solution of this application achieves the purpose of automatically detecting applications, improves the detection efficiency and accuracy of applications, and solves the technical problem of low detection efficiency caused by manual detection of application code execution logic in the prior art. Attached Figure Description
[0021] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings:
[0022] Figure 1 This is a flowchart of an optional application detection method according to an embodiment of this application;
[0023] Figure 2 This is a schematic diagram of an optional application detection device according to an embodiment of this application;
[0024] Figure 3 This is a schematic diagram of an optional electronic device according to an embodiment of this application. Detailed Implementation
[0025] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.
[0026] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0027] Furthermore, it should be noted that all information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for display, data used for analysis, etc.) disclosed herein are information and data authorized by the user or fully authorized by all parties. For example, this system has interfaces with relevant users or organizations. Before obtaining relevant information, it is necessary to send an acquisition request to the aforementioned user or organization through the interface, and obtain the relevant information only after receiving consent from the aforementioned user or organization.
[0028] Example 1
[0029] According to an embodiment of this application, an embodiment of an application detection method is provided. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.
[0030] Additionally, it should be noted that an application detection system can serve as the execution entity for the application detection method in this application embodiment. This application detection system can run on an electronic device.
[0031] Figure 1 This is a flowchart of an optional application detection method according to an embodiment of this application, such as... Figure 1 As shown, the method includes the following steps:
[0032] Step S101: Obtain the application's detection information.
[0033] In step S101, the information to be detected includes at least one of the following: first code updated in the application, second code in the application used to implement the target business, and third code in the application with a cyclomatic complexity greater than a preset threshold. The target business is a business that meets the preset business scenario. Cyclomatic complexity is used to characterize the complexity of the code, and cyclomatic complexity is positively correlated with the complexity of the code.
[0034] Specifically, the aforementioned first code can be the updated code generated when upgrading or modifying the application, where the update operation includes at least adding, deleting, or modifying code. Since the first code is the updated code, it must be tested to ensure that the updated code meets the expected requirements.
[0035] The aforementioned second code can be code within the application used to implement important business functions (corresponding to target business functions). For example, taking a financial software application as an example, important business functions could include large-value transactions, cross-border transactions, and encryption of user privacy data. The target business function can be determined by technical personnel through setting preset business scenarios. For instance, if the preset business scenario is a cross-border transaction scenario, then cross-border precious metals trading and cross-border futures trading under that scenario would all fall under the target business function. By testing the second code, the stable operation of important business functions can be ensured, improving the stability of the application.
[0036] The aforementioned third-party code can be highly complex code within the application. Due to its complexity, this code requires focused inspection. Specifically, the application can be broken down into functional modules, resulting in multiple subroutines. A control flow graph can then be constructed for each subroutine, and finally, the cyclomatic complexity of that subroutine can be calculated based on the control flow graph. It's important to note that highly complex code is more prone to execution errors; therefore, inspecting this third-party code can further improve the application's stability.
[0037] Furthermore, an application is a whole; modifications to some code may affect the execution of unmodified code. If developers are unaware of the impact of updated code on other unmodified code, unpredictable exceptions may occur. To avoid this, this application tests the application from three dimensions: first code, second code, and third code. This not only verifies the execution of updated code but also verifies the operation of critical business logic and complex code, thereby improving the comprehensiveness of application testing.
[0038] Step S102: Determine the location of the tracking point based on the location of the information to be detected in the program script corresponding to the application, and generate the tracking point at the tracking point location.
[0039] In step S102, the embedded points are used to collect running data, which is the data actually generated by the application when running the information to be detected.
[0040] Specifically, the aforementioned event tracking can be understood as a script embedded in the application. When the application runs to the event tracking location, the data generated by the application at that location can be obtained through the event tracking. Since event tracking can monitor the runtime data generated by the application without affecting the application's operation, it can be used to monitor the application.
[0041] In addition, since this application mainly detects applications by detecting the information to be detected, the application first determines the location of the tracking point based on the location of the information to be detected in the program script corresponding to the application, and then generates tracking points at the tracking point locations in order to accurately obtain the data generated by the application when running the information to be detected.
[0042] Step S103: Determine the application's status information based on the running data.
[0043] Specifically, status information is used to characterize the application's running status when running the information to be tested. Before testing the application, technicians typically pre-generate corresponding target results based on the information to be tested. These target results represent the normal data that the application should generate when running the information to be tested; in other words, the target results are the control group data during the testing process, and they are accurate and reliable. Based on this, after obtaining the running data, if the running data matches the target results, it can be determined that the application is running the information to be tested normally, and the application is a normal program. If the running data does not match the target results, it can be determined that the application is abnormal when running the information to be tested, and the application is an abnormal program. It should be noted that matching can be either identical or meeting the conditions defined by the target results. For example, if the target result is a numerical value, then the running data and the target result can only be considered a match if they are identical; if the target result is a data range, then the running data can be considered a match as long as it falls within this data range.
[0044] Additionally, it should be noted that this application can perform testing in a gray-scale environment. Specifically, testing can be conducted in a gray-scale environment first, and after confirming that the application has no abnormalities, the application can then be deployed or upgraded on the production server. This testing method can ensure the stability of the application and improve the user experience.
[0045] As can be seen from the above steps S101 to S103, in this embodiment of the application, the method of obtaining running data through tracking points and detecting the application based on the running data is adopted. After obtaining the information to be detected of the application, the tracking point position is determined according to the position of the information to be detected in the program script corresponding to the application, and tracking points are generated at the tracking point position. The tracking points are used to collect running data, which is the data actually generated by the application when running the information to be detected. Finally, the status information of the application is determined based on the running data. The status information is used to characterize the running status of the application when running the information to be detected.
[0046] As described above, this application determines the tracking point location by placing the information to be detected within the corresponding program script of the application. Therefore, the tracking points in this application can accurately obtain the runtime data generated by the application when running the information to be detected. It should be noted that since the runtime data is actually generated by the application, analyzing the runtime data can automatically determine whether any abnormalities have occurred during the application's operation, thus determining the application's status information. This application automates the monitoring of the execution process and related results of the information to be detected through tracking points, thereby avoiding the low detection efficiency problem inherent in existing technologies that rely on manual methods for application detection.
[0047] As can be seen from the above analysis, the technical solution of this application achieves the purpose of automatically detecting applications, improves the detection efficiency and accuracy of applications, and solves the technical problem of low detection efficiency caused by manual detection of application code execution logic in the prior art.
[0048] In one optional embodiment, the application detection system can acquire multiple business scenario identifiers in the application, wherein each business scenario identifier corresponds to a business scenario that the application is to implement. Then, the application detection system determines a target business scenario identifier from the multiple business scenario identifiers, wherein the business scenario represented by the target business scenario identifier is a preset business scenario. Finally, based on the target business scenario identifier, the application detection system determines second code from the program script.
[0049] Specifically, taking a financial software application as an example, the financial software includes at least three business scenario identifiers: Business Scenario Identifier 1, Business Scenario Identifier 2, and Business Scenario Identifier 3. Business Scenario Identifier 1 corresponds to the cross-border transaction business scenario that the financial software aims to implement; Business Scenario Identifier 2 corresponds to the large-value transaction business scenario that the financial software aims to implement; and Business Scenario Identifier 3 corresponds to the user privacy data encryption business scenario that the financial software aims to implement. Based on this, if the preset business scenario designed by the technical personnel is a cross-border transaction business scenario, then Business Scenario Identifier 1 is the target business scenario identifier.
[0050] It should be noted that the business scenario identifier can be understood as business description code in the program script. The business scenario identifier is guaranteed to exist in the program script. Therefore, after obtaining the target business scenario identifier, the application detection system can determine the code related to the preset business scenario as the second code based on the location or description information of the business scenario identifier in the program script. For example, since cross-border transactions are an important transaction business, the preset business scenario is determined to be the cross-border transaction business scenario. The business scenario identifier corresponding to the cross-border transaction business scenario is business scenario identifier 1. Based on this, if business scenario identifier 1 is found in a line of code, then that line of code is determined to be the second code.
[0051] In one optional embodiment, the application detection system first obtains the program script of the current version of the application and the program script of the previous version, and then determines the first code based on the program script of the current version and the program script of the previous version.
[0052] Specifically, in general, testing an application involves testing the application's current version's script. To ensure that all updates in the current version's script are found, the script of the previous version can be stored in advance. Then, the script of the previous version is compared with the script of the current version. Based on the comparison results, the code that is different between the current version and the previous version is identified, and these different codes are identified as the first code.
[0053] In one optional embodiment, the application detection system obtains the application scenario type of the information to be detected, wherein the application scenario type includes at least: front-end application scenario and back-end application scenario, and then the application detection system determines the location of the embedding point according to the application scenario type.
[0054] Optionally, different applications may be used in different scenarios, and correspondingly, the application scenarios of the information to be detected from different applications may also differ. Generally speaking, applications can be divided into two main application scenarios: front-end application scenarios and back-end application scenarios. Therefore, this application also classifies the application scenario types of the information to be detected into front-end application scenarios and back-end application scenarios. Based on each application scenario, the application detection system determines the location of the tracking points differently.
[0055] Specifically, in the case of a front-end application scenario, the application detection system first obtains the code format of the information to be detected, and then determines the location of the tracking point based on the code format and the location of the information to be detected in the program script.
[0056] Optionally, the aforementioned front-end application scenarios can be categorized into client-side, JavaScript (JS, an object-oriented and event-driven interpreted scripting language), and React Native (RN, an open-source cross-platform mobile application development framework). For the information to be detected in a front-end application scenario, the application detection system can determine the tracking point location according to method granularity and generate tracking points at those locations to record the application's running status when the information to be detected is being tested. Specifically, method granularity can be understood as the code format of the information to be detected. For example, the information to be detected may be code files with multiple code format types. For each code format type, there will be a fixed method for determining the tracking point location. For instance, if a code file is in XML format, then the end of the code file will be determined as the tracking point location.
[0057] In addition, when the application scenario is a backend application scenario, the application detection system obtains the function type and code format of the information to be detected. The function type represents the business logic that the information to be detected needs to implement. Then, the application detection system determines the placement of the tracking points based on the function type, code format, and the location of the information to be detected within the program script.
[0058] Optionally, in backend application scenarios, the application detection system can determine the tracking point location based on the functional branch granularity (corresponding to the functional type) or the method granularity (corresponding to the code format). Specifically, taking a financial software application as an example, the information to be detected can be two newly added parts of code within the financial software. The first part of the code implements the business logic for calculating the transaction amount of goods, and the second part implements the business logic for obtaining the source of the transaction price of goods. For these two parts of code, the application detection system can use different methods to determine the tracking point location. For example, for the first part of code, the tracking point can be determined at the end of the first part of code; for the second part of code, the tracking point can be determined at the beginning of the second part of code.
[0059] In addition, similar to front-end application scenarios, the location of the tracking points can also be determined based on the code format for the information to be detected in back-end application scenarios, which will not be elaborated on here.
[0060] In one alternative embodiment, Table 1 shows a data structure for embedded points:
[0061] Table 1
[0062]
[0063]
[0064] It should be noted that the sub-item numbering mentioned above can associate business requirements with the application, wherein the business requirements include at least the target result corresponding to the information to be detected.
[0065] In one optional embodiment, the front-end application scenario includes at least a client display scenario and a webpage display scenario. When the front-end application scenario is a client display scenario, the application detection system stores the running data in a preset storage area and sends the running data to the server at preset intervals. When the front-end application scenario is a webpage display scenario, the application detection system stores the running data in a database corresponding to the webpage and sends the running data to the server when the webpage is closed. The webpage is a display webpage generated based on the information to be detected.
[0066] Optionally, for front-end application scenarios, the system can be further divided into client-side display scenarios and webpage display scenarios based on the different display methods. In client-side display scenarios, the application detection system temporarily stores the runtime data obtained from event tracking in a preset storage area, such as the local computer where the application detection system resides, and then periodically sends the runtime data to the server at preset intervals. In webpage display scenarios, since webpages have corresponding databases that temporarily store information, the application detection system stores the runtime data for webpage display scenarios in the database corresponding to the webpage. When the webpage is closed, the database automatically sends the runtime data to the server.
[0067] Optionally, for backend application scenarios, if the tracking point location is determined based on the function type, the application detection system will generate a utility class `EventTrackingOpStep` as the tracking point at the tracking point location, and store the runtime data in the server after obtaining the runtime data. If the tracking point location is determined based on the code format, the application detection system will generate a utility class `EventTrackingUtil` at the tracking point location, and store the runtime data in the server after obtaining the runtime data.
[0068] In one optional embodiment, when the running data matches the preset target result, the application detection system determines that the application is running the information to be detected normally, wherein the target result represents the normal data that the application should generate when running the information to be detected; when the running data does not match the target result, the application detection system determines that there is an anomaly in the application when running the information to be detected.
[0069] Specifically, after the application finishes running, the application detection system can retrieve runtime data from the server, then parse the code in the distributed version control system's Git repository to obtain the preset target result. By comparing the runtime data with the target result, if the two match, it is determined that the application is running the detected information normally, and the application is a normal program; if the two do not match, it is determined that the application has an anomaly when running the detected information, and the application is an abnormal program.
[0070] Optionally, based on the data structure table above, regarding the verification status of the first code, the target result corresponding to the first code can be recorded on the event tracking list. Since the running data and the target result can be associated through the sub-item number, after comparing the running data with the target result on the event tracking list, an unverified sub-item list can be exported. The running data on the unverified sub-item list consists of running data that does not match the target result. Technical personnel can then customize other statistical rules according to actual needs, such as coverage statistics, gray / non-gray verification statistics, client version verification, etc.
[0071] It's important to note that, unlike the first code, the second code is used to implement critical business logic. Therefore, the second code needs to be checked every time a test is performed. Based on this, the target results corresponding to the second code can be recorded in the form of a list of critical business results. Then, the runtime data corresponding to the second code is compared with the target results on the list of critical business results to export an unverified transaction list. The runtime data on the unverified transaction list consists of runtime data that does not match the target results on the list of critical business results.
[0072] As can be seen from the above analysis, the technical solution of this application achieves the purpose of automatically detecting applications, improves the detection efficiency and accuracy of applications, and solves the technical problem of low detection efficiency caused by manual detection of application code execution logic in the prior art.
[0073] Example 2
[0074] According to embodiments of this application, an application detection device is also provided, wherein, Figure 2 This is a schematic diagram of an optional application detection device according to an embodiment of this application, such as... Figure 2As shown, the device includes: an acquisition module 201, used to acquire the application's information to be detected; a first determination module 202, used to determine the location of the tracking point based on the location of the information to be detected in the program script corresponding to the application, and generate the tracking point at the tracking point location, wherein the tracking point is used to collect running data, and the running data is the data actually generated by the application when running the information to be detected; and a second determination module 203, used to determine the application's status information based on the running data, wherein the status information is used to characterize the running status of the application when running the information to be detected.
[0075] It should be noted that the above-mentioned acquisition module 201, first determination module 202 and second determination module 203 correspond to steps S101 to S103 in the above embodiment 1. The examples and application scenarios implemented by the three modules and the corresponding steps are the same, but are not limited to the content disclosed in the above embodiment 1.
[0076] Optionally, the information to be detected mentioned above includes at least one of the following: first code updated in the application, second code in the application used to implement the target business, and third code in the application with a cyclomatic complexity greater than a preset threshold. The target business is a business that meets the preset business scenario. Cyclomatic complexity is used to characterize the complexity of the code, and cyclomatic complexity is positively correlated with the complexity of the code.
[0077] Optionally, the above-mentioned acquisition module further includes: a first acquisition module, a third determination module, and a fourth determination module. The first acquisition module is used to acquire multiple business scenario identifiers in the application, wherein each business scenario identifier corresponds to a business scenario to be implemented by the application; the third determination module is used to determine a target business scenario identifier from the multiple business scenario identifiers, wherein the business scenario represented by the target business scenario identifier is a preset business scenario; and the fourth determination module is used to determine second code from the program script based on the target business scenario identifier.
[0078] Optionally, the above-mentioned acquisition module further includes: a second acquisition module and a fifth determination module. The second acquisition module is used to acquire the program script of the current version of the application and the program script of the previous version; the fifth determination module is used to determine the first code based on the program script of the current version and the program script of the previous version.
[0079] Optionally, the first determining module further includes a third acquiring module and a sixth determining module. The third acquiring module is used to acquire the application scenario type of the information to be detected, wherein the application scenario type includes at least: front-end application scenario and back-end application scenario; the sixth determining module is used to determine the location of the tracking point based on the application scenario type.
[0080] Optionally, the sixth determining module also includes a fourth acquiring module and a seventh determining module. The fourth acquiring module is used to acquire the code format of the information to be detected when the application scenario type is a front-end application scenario; the seventh determining module is used to determine the placement of the tracking point based on the code format and the location of the information to be detected in the program script.
[0081] Optionally, the sixth determining module also includes a fifth acquiring module and an eighth determining module. The fifth acquiring module is used to acquire the function type and code format of the information to be detected when the application scenario type is a backend application scenario. The function type is used to characterize the business logic to be implemented by the information to be detected. The eighth determining module is used to determine the location of the tracking point based on the function type, code format, and the position of the information to be detected in the program script.
[0082] Optionally, the application detection device further includes a first sending module and a second sending module. The first sending module is used to store runtime data in a preset storage area and send the runtime data to the server at preset intervals when the front-end application scenario is a client-side display scenario. The second sending module is used to store runtime data in a database corresponding to the webpage when the front-end application scenario is a webpage display scenario, and send the runtime data to the server when the webpage is closed, wherein the webpage is a display webpage generated based on the information to be detected.
[0083] Optionally, the second determining module described above further includes a ninth determining module and a tenth determining module. The ninth determining module is used to determine that the application is running normally and is detecting the information when the running data matches a preset target result, wherein the target result represents the normal data that the application should generate when running the information to be detected. The tenth determining module is used to determine that there is an anomaly in the application when running the information to be detected, when the running data does not match the target result.
[0084] Example 3
[0085] According to an embodiment of this application, a computer-readable storage medium is also provided, in which a computer program is stored, wherein the computer program is configured to execute the detection method of the application program in Embodiment 1 above when running.
[0086] Example 4
[0087] According to an embodiment of this application, an embodiment of an electronic device is also provided, wherein, Figure 3 This is a schematic diagram of an optional electronic device according to an embodiment of this application, such as... Figure 3 As shown, the electronic device includes a processor, a memory, and a program stored in the memory and executable on the processor. When the processor executes the program, it performs the following steps:
[0088] Obtain the application's detection information; determine the tracking point location based on the location of the detection information in the corresponding program script of the application, and generate tracking points at the tracking point location, wherein the tracking points are used to collect running data, and the running data is the data actually generated by the application when running the detection information; determine the application's status information based on the running data, wherein the status information is used to characterize the running status of the application when running the detection information.
[0089] Optionally, the information to be detected includes at least one of the following: first code updated in the application, second code in the application used to implement the target business, and third code in the application with a cyclomatic complexity greater than a preset threshold. The target business is the business that meets the preset business scenario. Cyclomatic complexity is used to characterize the complexity of the code, and cyclomatic complexity is positively correlated with the complexity of the code.
[0090] Optionally, when the processor executes the program, it also performs the following steps: obtaining multiple business scenario identifiers in the application, wherein each business scenario identifier corresponds to a business scenario that the application is to implement; determining a target business scenario identifier from the multiple business scenario identifiers, wherein the business scenario represented by the target business scenario identifier is a preset business scenario; and determining second code from the program script based on the target business scenario identifier.
[0091] Optionally, when the processor executes the program, it also performs the following steps: obtaining the program script of the current version of the application and the program script of the previous version; determining the first code based on the program script of the current version and the program script of the previous version.
[0092] Optionally, the processor may also perform the following steps when executing the program: obtaining the application scenario type of the information to be detected, wherein the application scenario type includes at least: front-end application scenario and back-end application scenario; and determining the location of the embedding point based on the application scenario type.
[0093] Optionally, the processor may also perform the following steps when executing the program: in the case of a front-end application scenario, obtain the code format of the information to be detected; determine the location of the tracking point based on the code format and the location of the information to be detected in the program script.
[0094] Optionally, when the processor executes the program, it also performs the following steps: when the application scenario type is a backend application scenario, it obtains the function type and code format of the information to be detected, wherein the function type is used to characterize the business logic to be implemented by the information to be detected; and determines the location of the tracking point based on the function type, code format and the position of the information to be detected in the program script.
[0095] Optionally, the processor also performs the following steps when executing the program: the front-end application scenario includes at least a client display scenario and a webpage display scenario. Before determining the application's state information based on the running data, if the front-end application scenario is a client display scenario, the running data is stored in a preset storage area and sent to the server at preset intervals; if the front-end application scenario is a webpage display scenario, the running data is stored in a database corresponding to the webpage and sent to the server when the webpage is closed, wherein the webpage is a display webpage generated based on the information to be detected.
[0096] Optionally, the processor also performs the following steps when executing the program: when the running data matches the preset target result, it is determined that the application is running the information to be detected normally, wherein the target result represents the normal data that the application should generate when running the information to be detected; when the running data does not match the target result, it is determined that there is an anomaly in the application when running the information to be detected.
[0097] The sequence numbers of the embodiments in this application are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.
[0098] In the above embodiments of this application, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0099] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. The device embodiments described above are merely illustrative; for example, the division of units can be a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the displayed or discussed mutual couplings, direct couplings, or communication connections may be through some interfaces; indirect couplings or communication connections between units or modules may be electrical or other forms.
[0100] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0101] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0102] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard drive, magnetic disk, or optical disk.
[0103] The above are merely preferred embodiments of this application. It should be noted that those skilled in the art can make various improvements and modifications without departing from the principles of this application, and these improvements and modifications should also be considered within the scope of protection of this application.
Claims
1. A method for detecting an application, characterized in that, include: Obtain the application's detection information; the detection information includes at least one of the following: first code updated in the application, second code in the application used to implement the target business, and third code in the application with a cyclomatic complexity greater than a preset threshold, wherein the target business is a business that meets a preset business scenario, the cyclomatic complexity is used to characterize the complexity of the code, and the cyclomatic complexity is positively correlated with the complexity of the code; The location of the embedding point is determined based on the position of the information to be detected in the program script corresponding to the application, and the embedding point is generated at the embedding point location. The embedding point is used to collect running data, which is the data actually generated by the application when running the information to be detected. The application's status information is determined based on the running data, wherein the status information is used to characterize the application's running status when running the information to be detected; Determining the embedding point location based on the position of the information to be detected in the program script corresponding to the application includes: The application scenario type for obtaining the information to be detected includes at least: front-end application scenario and back-end application scenario. The location of the embedding point is determined according to the application scenario type; The method also includes correlating runtime data with target results; Determining the location of the embedding point based on the application scenario type includes: When the application scenario type is the front-end application scenario, the code format for obtaining the information to be detected is used. The location of the embedded point is determined based on the code format and the location of the information to be detected in the program script. When the application scenario type is the backend application scenario, the function type and code format of the information to be detected are obtained, wherein the function type is used to characterize the business logic to be implemented by the information to be detected; The location of the embedded point is determined based on the function type, the code format, and the position of the information to be detected in the program script.
2. The method according to claim 1, characterized in that, Obtain the application's detection information, including: Obtain multiple business scenario identifiers from the application, wherein each business scenario identifier corresponds to a business scenario that the application is to implement; A target business scenario identifier is determined from a plurality of business scenario identifiers, wherein the business scenario represented by the target business scenario identifier is the preset business scenario; The second code is determined from the program script based on the target business scenario identifier.
3. The method according to claim 1, characterized in that, Obtain the application's detection information, including: Obtain the program script of the current version of the application and the program script of the previous version; The first code is determined based on the current version of the program script and the previous version of the program script.
4. The method according to claim 1, characterized in that, The front-end application scenarios include at least client-side display scenarios and webpage display scenarios. Before determining the application's state information based on the runtime data, the method further includes: When the front-end application scenario is a client-side display scenario, the running data is stored in a preset storage area and sent to the server at preset intervals. In the case where the front-end application scenario is a webpage display scenario, the running data is stored in a database corresponding to the webpage, and the running data is sent to the server when the webpage is closed, wherein the webpage is a display webpage generated based on the information to be detected.
5. The method according to claim 1, characterized in that, Determining the application's status information based on the runtime data includes: When the running data matches the preset target result, it is determined that the application is running the information to be detected normally, wherein the target result represents the normal data that the application should generate when running the information to be detected; When the running data does not match the target result, it is determined that the application is abnormal when running the information to be detected.
6. A detection device for an application, characterized in that, include: The acquisition module is used to acquire the application's detection information; the detection information includes at least one of the following: first code updated in the application, second code in the application used to implement the target business, and third code in the application with a cyclomatic complexity greater than a preset threshold. The target business is a business that meets a preset business scenario. Cyclomatic complexity is used to characterize the complexity of the code, and cyclomatic complexity is positively correlated with the complexity of the code. The first determining module is used to determine the location of the embedding point based on the location of the information to be detected in the program script corresponding to the application, and to generate the embedding point at the embedding point location. The embedding point is used to collect running data, and the running data is the data actually generated by the application when running the information to be detected. The second determining module is used to determine the status information of the application based on the running data, wherein the status information is used to characterize the running status of the application when running the information to be detected; The first determining module further includes: a third obtaining module, used to obtain the application scenario type of the information to be detected, wherein the application scenario type includes at least: front-end application scenario and back-end application scenario; and a sixth determining module, used to determine the location of the embedding point according to the application scenario type. The device also includes the association of operational data with target results; The sixth determination module also includes: the fourth acquisition module, used to acquire the code format of the information to be detected when the application scenario type is a front-end application scenario; and the seventh determination module, used to determine the location of the tracking point based on the code format and the location of the information to be detected in the program script. The sixth determining module also includes: the fifth obtaining module, which is used to obtain the function type and code format of the information to be detected when the application scenario type is a backend application scenario, wherein the function type is used to characterize the business logic to be implemented by the information to be detected; and the eighth determining module, which is used to determine the location of the tracking point based on the function type, code format and the position of the information to be detected in the program script.
7. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, wherein the computer program is configured to execute the detection method of the application program as described in any one of claims 1 to 5 when it is run.
8. An electronic device, characterized in that, It includes one or more processors and a memory for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors cause the one or more processors to implement the application detection method according to any one of claims 1 to 5.
Citation Information
Patent Citations
Software function extension method and device, computer equipment and storage medium
CN108762809A
Application program running fault monitoring method and device, equipment and a storage medium
CN112631913A