Application program testing method and device

By using large language models to analyze entry point information and operation response results in web application testing, simulate the trigger target operational items and determine the test path, and solve the problem of low coverage when detecting complex web applications, and achieve higher testing depth and accuracy.

CN119415440BActive Publication Date: 2025-05-13TIANJIN UNIV +2
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510020049.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-01-07
Publication Date
2025-05-13
Estimated Expiration
2045-01-07

AI Technical Summary

Technical Problem

The existing black box testing methods have low coverage when detecting complex web applications, making it difficult to deeply detect internal functions of web applications, resulting in poor testing results.

Method used

By determining the entry point information based on the program source code of the current application page of the application to be tested, the entry point information is analyzed using a large language model to determine the operation response result of the operable item, thereby simulating the trigger target operable item, repeating the operation until it jumps to the last application page, determining the test path, and testing based on this path.

Benefits of technology

It improves the depth coverage and accuracy of application testing, can detect internal functions of web applications more deeply, and enhances the testing effect.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119415440B_ABST
    Figure CN119415440B_ABST
Patent Text Reader

Abstract

The present invention provides an application testing method and device, which can be applied to the field of computer technology. The method includes: determining at least one entry point information in the program source code based on the program source code of the current application page of the application to be tested; analyzing the at least one entry point information using a large language model to determine the operation response result of at least one operable item corresponding to each of the at least one entry point information; determining a target operable item from at least one operable item based on the at least one operation response result; simulating triggering the target operable item to run the entry point information corresponding to the target operable item, so that the state of the application to be tested changes; repeatedly performing the above operations until jumping to the last application page, determining a test path based on multiple target operable items and jump relationships; and testing the application to be tested based on the test path to determine the test result of the application to be tested.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to an application testing method and device. Background Art

[0002] In the current Internet environment, Web applications have become an important network service. Their wide application in various industries has had a profound impact on social development. However, while expanding the scope of application, Web applications have also caused more and more security issues. In particular, with the popularization of cross-platform frameworks, the security risks of Web applications are no longer limited to the use scenarios within traditional browsers, but also involve a variety of application environments such as desktops and mobile devices, and may pose a threat to software, applications and even other application platforms. The complexity of Web applications and the diversity of development languages ​​and frameworks have brought great challenges to existing security detection methods. Among them, Cross Site Scripting (XSS) is a common and serious security vulnerability in Web applications. In related technologies, in order to deal with XSS attacks, black box vulnerability detection methods are usually used to detect applications.

[0003] In the process of implementing the present invention, it is found that the prior art has at least the following problems: since black box testing lacks a specific understanding of Web applications, it is usually necessary to model Web applications through crawler technology, and to discover potential attack surfaces in applications by detecting input fields such as URLs and forms in Web pages. Existing black box testing methods often have shortcomings when covering complex Web applications, especially the random navigation and breadth-first strategies they mainly use, which make it difficult to deeply detect the internal functions of Web applications, resulting in low test coverage and poor test results. Summary of the invention

[0004] In view of the above problems, the present invention provides an application testing method and device.

[0005] According to a first aspect of the present invention, there is provided an application testing method, comprising: determining at least one entry point information in the program source code based on the program source code of the current application page of the application to be tested, wherein the entry point information represents a program segment for executing an operation corresponding to an operable item on the current application page; analyzing at least one entry point information using a large language model to determine an operation response result of at least one operable item corresponding to each of the at least one entry point information, wherein the operation response result represents an impact on the current application page when the operation is executed in response to the operable item; determining a target operable item from at least one operable item based on the at least one operation response result; simulating triggering the target operable item to run the entry point information corresponding to the target operable item, so that the state of the application to be tested changes; repeatedly performing the above operations until jumping to the last application page, and determining a test path based on multiple target operable items and jump relationships; and testing the application to be tested based on the test path to determine a test result of the application to be tested.

[0006] According to an embodiment of the present invention, at least one entry point information is analyzed using a large language model to determine the operation response result of at least one operable item corresponding to the at least one entry point information, including: using a large language model to analyze each entry point information to determine the page state of the current application page after running the entry point information; and determining the operation response result of the operable item based on the page state and the page state before performing the operation on the operable item.

[0007] According to an embodiment of the present invention, a target operable item is triggered by simulating to run the entry point information corresponding to the target operable item so that a state change occurs in the application to be tested, including: when it is determined that there are parameters to be configured in the entry point information, parameter configuration is performed on the entry point information to obtain the target entry point information; and running the target entry point information so that a state change occurs in the application to be tested.

[0008] According to an embodiment of the present invention, an application to be tested is tested based on a test path to determine a test result of the application to be tested, including: for each target operable item, using a large language model to determine one or more attackable injection points present in entry point information corresponding to the target operable item; using an attack script to perform script injection on one or more attackable injection points to obtain entry point information injected with the attack script; running the entry point information injected with the attack script to determine an operation result corresponding to the target operable item; and determining a test result based on at least one operation result.

[0009] According to an embodiment of the present invention, a test result is determined based on at least one operation result, including: when the operation results all indicate that the operation is normal, determining a test result indicating that the application to be tested has passed the test; when there is an operation result indicating that the operation is abnormal, determining the test result based on entry point information injected with an attack script used to obtain the operation result.

[0010] According to an embodiment of the present invention, in the presence of an operation result that characterizes an operation abnormality, a test result is determined based on entry point information of an attack script injected for obtaining the operation result, including: determining an associated test path associated with the operation result based on the entry point information of the attack script injected; and determining the test result based on the entry point information of a target operable item on the associated test path.

[0011] According to an embodiment of the present invention, based on the program source code of the current application page of the application to be tested, at least one entry point information in the program source code is determined, including: obtaining the program source code of the current application page; running the program source code in a virtual environment to obtain a simulation page; and simulating operation on the operation items on the simulation page to determine the entry point information of the operation items.

[0012] According to an embodiment of the present invention, a target operable item is determined from at least one operable item based on multiple operation response results, including: determining, based on the operation response results, whether a state change occurs in the application to be tested in response to an operation performed on the operable item; and in the event that a state change occurs after the operation is performed, determining the operable item as a target operable item.

[0013] According to an embodiment of the present invention, after an operation is performed, when a state change occurs, an operable item is determined as a target operable item, including: determining that an operation response result represents an application interface after the operation is performed and a state change occurs; determining at least one operable item from the current application interface; when the number of operable items is greater than 1, determining the similarity between multiple operable items based on entry point information corresponding to each of the multiple operable items; dividing multiple operable items whose similarities are higher than a preset threshold into the same operable item group; and for each operable item group, selecting one from the operable item group as the target operable item.

[0014] A second aspect of the present invention provides an application testing device, comprising: an information determination module, for determining at least one entry point information in a program source code based on a program source code of a current application page of an application to be tested, wherein the entry point information represents a program segment for executing an operation corresponding to an operable item on the current application page; an information analysis module, for analyzing at least one entry point information using a large language model, and determining an operation response result of at least one operable item corresponding to each of the at least one entry point information, wherein the operation response result represents an impact on the current application page when the operation is executed in response to the operable item; an operation item determination module, for determining a target operable item from at least one operable item based on at least one operation response result; a page jump module, for simulating triggering a target operable item to run the entry point information corresponding to the target operable item, so that the state of the application to be tested changes; a path determination module, for repeatedly performing the above operations until jumping to the last application page, and determining a test path based on multiple target operable items and jump relationships; and an application testing module, for testing the application to be tested based on the test path, and determining a test result of the application to be tested.

[0015] A third aspect of the present invention provides an electronic device, comprising: one or more processors; a memory for storing one or more computer programs, wherein the one or more processors execute the one or more computer programs to implement the steps of the above method.

[0016] The fourth aspect of the present invention further provides a computer-readable storage medium on which a computer program or instruction is stored, and the steps of the above method are implemented when the above computer program or instruction is executed by a processor.

[0017] The fifth aspect of the present invention also provides a computer program product, including a computer program or instructions, which implement the steps of the above method when executed by a processor.

[0018] According to an embodiment of the present invention, entry point information is determined for the current application page of the application to be tested, and is analyzed using a large language model to determine the operation response result after running the entry point information, that is, performing an operation on an operable item corresponding to the entry point information, and based on the operation response result, a target operable item is determined from at least one operable item, so that after performing the operation on the target operable item, the state of the application to be tested can be changed, thereby making the test path determined according to the target operable item deeper, thereby improving the depth coverage and accuracy of the application test. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] The above contents and other objects, features and advantages of the present invention will become more apparent through the following description of the embodiments of the present invention with reference to the accompanying drawings, in which:

[0020] Figure 1 An application scenario diagram of the application program testing method and device according to an embodiment of the present invention is shown.

[0021] Figure 2 A flow chart of an application testing method according to an embodiment of the present invention is shown.

[0022] Figure 3 A schematic diagram of determining an associated test path according to an embodiment of the present invention is shown.

[0023] Figure 4 A structural block diagram of an application program testing device according to an embodiment of the present invention is shown.

[0024] Figure 5 A block diagram of an electronic device suitable for implementing an application testing method according to an embodiment of the present invention is shown. DETAILED DESCRIPTION

[0025] Below, embodiments of the present invention will be described with reference to the accompanying drawings. However, it should be understood that these descriptions are exemplary only and are not intended to limit the scope of the present invention. In the following detailed description, for ease of explanation, many specific details are set forth to provide a comprehensive understanding of embodiments of the present invention. However, it is apparent that one or more embodiments may also be implemented without these specific details. In addition, in the following description, descriptions of known structures and technologies are omitted to avoid unnecessary confusion of concepts of the present invention.

[0026] The terms used herein are only for describing specific embodiments and are not intended to limit the present invention. The terms "comprise", "include", etc. used herein indicate the existence of the features, steps, operations and / or components, but do not exclude the existence or addition of one or more other features, steps, operations or components.

[0027] All terms (including technical and scientific terms) used herein have the meanings commonly understood by those skilled in the art unless otherwise defined. It should be noted that the terms used herein should be interpreted as having a meaning consistent with the context of this specification and should not be interpreted in an idealized or overly rigid manner.

[0028] When using expressions such as "at least one of A, B, and C, etc.", they should generally be interpreted according to the meaning of the expression commonly understood by those skilled in the art (for example, "a system having at least one of A, B, and C" should include but is not limited to a system having A alone, B alone, C alone, A and B, A and C, B and C, and / or A, B, C, etc.).

[0029] In the technical solution of the present invention, the user information (including but not limited to user personal information, user image information, user device information, such as location information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved are all information and data authorized by the user or fully authorized by all parties, and the collection, storage, use, processing, transmission, provision, invention and application of the relevant data comply with relevant laws, regulations and standards, take necessary confidentiality measures, do not violate public order and good morals, and provide corresponding operation entrances for users to choose to authorize or refuse.

[0030] In the scenario of using personal information for automated decision-making, the methods, devices, and systems provided by the embodiments of the present invention provide users with corresponding operation portals for users to choose to agree or reject the automated decision-making results; if the user chooses to reject, the expert decision-making process will be entered. The expression "automated decision-making" here refers to the activity of automatically analyzing and evaluating an individual's behavioral habits, interests and hobbies, or economic, health, credit status, etc. through computer programs, and making decisions. The expression "expert decision-making" here refers to the activity of making decisions by people who specialize in a certain field, have specialized experience, knowledge and skills, and have reached a certain level of professionalism.

[0031] An embodiment of the present invention provides an application testing method, which determines at least one entry point information in the program source code based on the program source code of the current application page of the application to be tested, wherein the entry point information represents a program segment used to execute an operation corresponding to an operable item on the current application page; uses a large language model to analyze at least one entry point information, and determines an operation response result of at least one operable item corresponding to each of the at least one entry point information, wherein the operation response result represents an impact on the current application page when the operation is executed in response to the operable item; based on the at least one operation response result, determines a target operable item from the at least one operable item; simulates triggering the target operable item to run the entry point information corresponding to the target operable item, and jumps to the next application page; repeats the above operations until jumping to the last application page, and determines a test path based on multiple target operable items and jump relationships; and tests the application to be tested based on the test path to determine a test result of the application to be tested.

[0032] Figure 1 An application scenario diagram of the application program testing method and device according to an embodiment of the present invention is shown.

[0033] like Figure 1 As shown, the application scenario 100 according to this embodiment may include a first terminal device 101, a second terminal device 102, a third terminal device 103, a network 104, and a server 105. The network 104 is used to provide a medium for a communication link between the first terminal device 101, the second terminal device 102, the third terminal device 103, and the server 105. The network 104 may include various connection types, such as wired, wireless communication links, or optical fiber cables, etc.

[0034] The user can use the first terminal device 101, the second terminal device 102, and the third terminal device 103 to interact with the server 105 through the network 104 to receive or send messages, etc. Various communication client applications can be installed on the first terminal device 101, the second terminal device 102, and the third terminal device 103, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc. (only for example).

[0035] The first terminal device 101, the second terminal device 102, and the third terminal device 103 may be various electronic devices having display screens and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, desktop computers, and the like.

[0036] The server 105 may be a server that provides various services, such as a background management server (only as an example) that provides support for websites browsed by users using the first terminal device 101, the second terminal device 102, and the third terminal device 103. The background management server may analyze and process the received data such as user requests, and feed back the processing results (such as web pages, information, or data obtained or generated according to user requests) to the terminal device.

[0037] It should be noted that the application testing method provided in the embodiment of the present invention can generally be executed by the server 105. Accordingly, the application testing device provided in the embodiment of the present invention can generally be set in the server 105. The application testing method provided in the embodiment of the present invention can also be executed by a server or server cluster that is different from the server 105 and can communicate with the first terminal device 101, the second terminal device 102, the third terminal device 103 and / or the server 105. Accordingly, the application testing device provided in the embodiment of the present invention can also be set in a server or server cluster that is different from the server 105 and can communicate with the first terminal device 101, the second terminal device 102, the third terminal device 103 and / or the server 105.

[0038] It should be understood that Figure 1 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.

[0039] The following will be based on Figure 1 The scene described by Figure 2~Figure 3 The application program testing method according to the embodiment of the present invention is described in detail.

[0040] Figure 2 A flow chart of an application testing method according to an embodiment of the present invention is shown.

[0041] like Figure 2 As shown, the application testing method of this embodiment includes operations S210 to S260.

[0042] In operation S210 , at least one entry point information in the program source code is determined based on the program source code of the current application page of the application to be tested.

[0043] According to an embodiment of the present invention, the application to be tested may be a website consisting of multiple web pages, a mobile application (Application, APP), a cross-platform application (Cross-Platform Apps), etc.

[0044] According to an embodiment of the present invention, the application to be tested may include multiple application pages. For the application interface currently displayed by the application to be tested, the program source code of the current application interface is determined, and the current application interface is operated using an automated testing framework to determine at least one entry point information in the program source code, wherein the entry point information represents a program segment for executing operations corresponding to operable items on the current application page.

[0045] In operation S220, at least one entry point information is analyzed using a large language model to determine an operation response result of each at least one operable item corresponding to each of the at least one entry point information.

[0046] According to an embodiment of the present invention, entry point information is input into a large language model, and through prompt words, the large language model outputs an operation response result of an operable item corresponding to the entry point information, wherein the operation response result represents the impact on the current application page when performing an operation in response to the operable item.

[0047] In operation S230, a target operable item is determined from at least one operable item based on the at least one operation response result.

[0048] According to an embodiment of the present invention, when the current application interface includes only one operable item, the operable item is determined as the target operable item. When the current application interface includes multiple operable items, an operation response result that can make the test path longer is selected from the operation response results of the multiple operable items, and the operable item is determined as the target operable item.

[0049] According to an embodiment of the present invention, when the operation response result corresponding to an operable item indicates that the operation on the operable item will affect the continued operation of other operable items, the operable item cannot be operated as a target operable item. For example, when the operable item is "reset" and the current application interface also includes an operable item of "submit", if the reset operable item is operated, the filled-in form content in the current application interface will be cleared, and the operable item cannot be submitted. Therefore, it cannot be used as a target operable item.

[0050] In operation S240 , the target operable item is triggered by simulation to execute entry point information corresponding to the target operable item, so that a state change occurs in the application to be tested.

[0051] In operation S250, the above operations are repeatedly performed until the last application page is jumped to, and a test path is determined based on multiple target operable items and jump relationships.

[0052] According to an embodiment of the present invention, after determining the target operable item, a simulation script is used to simulate the operation thereof, thereby running the entry point information and causing the state of the application to be tested to change, and continuing to determine the target operable item on the next application page. In the case that there is no next application page after triggering the target operable item, multiple target operable items and jump relationships determined in the above operation process are determined, and the order relationship between the multiple target operable items is determined based on the jump relationship, thereby determining the test path.

[0053] In operation S260 , the application to be tested is tested based on the test path, and a test result of the application to be tested is determined.

[0054] According to an embodiment of the present invention, the test result can be used to characterize whether the application to be tested has an XSS vulnerability.

[0055] According to an embodiment of the present invention, entry point information is determined for the current application page of the application to be tested, and is analyzed using a large language model to determine the operation response result after running the entry point information, that is, performing an operation on an operable item corresponding to the entry point information, and based on the operation response result, a target operable item is determined from at least one operable item, so that after performing the operation on the target operable item, the state of the application to be tested can be changed, thereby making the test path determined according to the target operable item deeper, thereby improving the depth coverage and accuracy of the application test.

[0056] According to an embodiment of the present invention, at least one entry point information is analyzed using a large language model to determine the operation response result of at least one operable item corresponding to the at least one entry point information, including: using a large language model to analyze each entry point information to determine the page state of the current application page after running the entry point information; and determining the operation response result of the operable item based on the page state and the page state before performing the operation on the operable item.

[0057] According to an embodiment of the present invention, the page state may include the value of a form element in the current application page, the jump of the current application page, etc. According to the page state after the entry point information is executed and the page state before the entry point information is executed, the change of the page state before and after the operable item is executed can be determined, thereby determining the operation response result after the operable item is executed.

[0058] According to an embodiment of the present invention, by determining the page status of the current application page before and after the running entry point information, and comparing to determine the change in the page status before and after the running, the operation response result after executing the operable item can be determined, thereby improving the degree of automation of the test.

[0059] According to an embodiment of the present invention, a target operable item is triggered by simulating to run the entry point information corresponding to the target operable item so that a state change occurs in the application to be tested, including: when it is determined that there are parameters to be configured in the entry point information, parameter configuration is performed on the entry point information to obtain the target entry point information; and running the target entry point information so that a state change occurs in the application to be tested.

[0060] According to an embodiment of the present invention, by parsing the entry point information, it is determined whether there are parameters to be configured in the entry point information, wherein the current application page may include multiple configuration parameters, each configuration parameter corresponds to an operable element in the current application page, wherein the operable elements include forms, buttons, hyperlinks, etc. In the case that there are configuration parameters corresponding to a form that must be filled in before performing an operation on a target operable item in the current page, it can be determined that there are parameters to be configured in the entry point information.

[0061] According to an embodiment of the present invention, the data type and format requirements of the parameters to be configured can be determined according to the entry point information, and fill data that meets the data type and format requirements can be randomly generated. The fill data can be filled in the form of the current application page, or the entry point information can be directly changed to configure the fill data in the entry point information to obtain the target entry point information. The target entry point information is run to trigger the target operable item, so that the state of the application to be tested changes.

[0062] According to an embodiment of the present invention, by configuring parameters of entry point information, the execution conditions of the target operable items can be met, so that the target operable items are executed smoothly, the state of the application to be tested changes, the feasibility of the test is improved, and the degree of automation of the test is further improved.

[0063] According to an embodiment of the present invention, an application to be tested is tested based on a test path to determine a test result of the application to be tested, including: for each target operable item, using a large language model to determine one or more attackable injection points present in entry point information corresponding to the target operable item; using an attack script to perform script injection on one or more attackable injection points to obtain entry point information injected with the attack script; running the entry point information injected with the attack script to determine an operation result corresponding to the target operable item; and determining a test result based on at least one operation result.

[0064] According to an embodiment of the present invention, a large language model is used to process entry point information to determine attackable injection points in the entry point information, wherein the attackable injection points represent locations that may be attacked by XSS. After determining one or more attackable injection points, an attack script is written to perform script injection on the one or more attackable injection points.

[0065] According to an embodiment of the present invention, the initial entry point information is replaced by the entry point information injected with the attack script, and the target operable item is triggered, the entry point information injected with the attack script is run, and the operation result corresponding to the target operable item is determined. Based on the operation result of each of at least one target operable item on the test path, the test result for the application to be tested is determined.

[0066] According to an embodiment of the present invention, by determining the vulnerable injection points existing in the entry point information, injecting attack scripts into the vulnerable injection points, and then running the entry point information injected with the attack scripts, potential XSS attacks can be simulated, thereby determining whether the application to be tested has an XSS vulnerability, making application testing more accurate and effective.

[0067] According to an embodiment of the present invention, a test result is determined based on at least one operation result, including: when the operation results all indicate that the operation is normal, determining a test result indicating that the application to be tested has passed the test; when there is an operation result indicating that the operation is abnormal, determining the test result based on entry point information injected with an attack script used to obtain the operation result.

[0068] According to an embodiment of the present invention, a plurality of different test paths may be determined for the same application program to be tested.

[0069] According to an embodiment of the present invention, when the operation results on multiple test paths all indicate normal operation, it can be determined that the XSS attack on multiple target operable items of the application to be tested on multiple test paths has failed, that is, the application to be tested does not have XSS vulnerabilities on multiple test paths and passes the test.

[0070] According to an embodiment of the present invention, in the presence of an operation result that characterizes an operation abnormality, the entry point information into which the attack script is injected that causes the operation result that causes the operation abnormality is determined from multiple entry point information into which the attack script is injected, thereby determining that the XSS attack on the entry point information of the target operable item is successful. Therefore, it can be determined that an XSS vulnerability exists in the application to be tested, and the vulnerability location is the entry point information into which the attack script is injected.

[0071] According to an embodiment of the present invention, the test result is determined based on the operation result of each target operable item in multiple test paths, which can comprehensively and accurately determine whether the application to be tested has XSS vulnerabilities in multiple test paths.

[0072] According to an embodiment of the present invention, in the presence of an operation result that characterizes an operation abnormality, a test result is determined based on entry point information of an attack script injected for obtaining the operation result, including: determining an associated test path associated with the operation result based on the entry point information of the attack script injected; and determining the test result based on the entry point information of a target operable item on the associated test path.

[0073] According to an embodiment of the present invention, for an operation result that characterizes an operation abnormality, multiple entry point information injected with an attack script is parsed, and the test path where the entry point information injected with the attack script that causes the operation result is located is determined as an associated test path. The target operation item corresponding to the entry point information injected with the attack script on the associated test path is determined, and the test result is determined based on the entry point information of the target operable item.

[0074] According to an embodiment of the present invention, since the operation result represents an operation abnormality, it may not be caused by the existence of an XSS vulnerability in the test path where the operable item corresponding to the operation is located. Therefore, based on the entry point information of the attack script injected in multiple test paths, the associated test path corresponding to the operation result representing the operation abnormality can be determined, and the test result can be further determined, so that the existing XSS vulnerability can be accurately located, thereby improving the accuracy of application testing.

[0075] Figure 3 A schematic diagram of determining an associated test path according to an embodiment of the present invention is shown.

[0076] like Figure 3 As shown, the application to be tested may be, for example, an application of a shopping platform, including a first test path 301 and a second test path 302, wherein an attackable injection point exists in the first test path 301, and an attack script is used to inject a script into the attackable injection point.

[0077] The multiple target operable items on the first test path 301 are operated sequentially, and the user can click on the homepage of the application to be tested, jump to the registration page, fill in the registration information on the registration page and submit the registration, jump to the login page, log in using the information submitted during registration, jump to the product management page, click on the product management page, jump to the add product page, fill in the product information to be added on the add product page and submit the addition, and obtain the operation result of successfully adding the product. Therefore, the multiple operation results on the first test path 301 all indicate that the operation is normal.

[0078] By operating the target operable items on the second test path 302, you can click on the homepage of the application to be tested to jump to the product display page. Based on the display results, it can be determined that the products added when executing the first test path 301 are not added to the product library, but are replaced by other abnormal products. Therefore, it can be determined that the operation is abnormal.

[0079] Based on the add product page in the first test path 301, it is determined that the operations performed on this page will affect the subsequent operations on the display product page, that is, the associated test path associated with the display product page is the first test path 301, and backtracking is performed based on multiple target operable items on the first test path 301 to determine the target operable item that causes the operation result of the display product page to represent an operation abnormality, and the test result is determined based on the entry point information of the target operable item.

[0080] According to an embodiment of the present invention, based on the program source code of the current application page of the application to be tested, at least one entry point information in the program source code is determined, including: obtaining the program source code of the current application page; running the program source code in a virtual environment to obtain a simulation page; and simulating operation on the operation items on the simulation page to determine the entry point information of the operation items.

[0081] According to an embodiment of the present invention, since the application to be tested may be an application in operation, and the information of each entry point in the program source code needs to be modified during the test process, directly testing the application to be tested may cause errors in the running application, affecting the data security and normal operation of the application. The application to be tested can be simulated in a virtual environment and subjected to simulation operations to avoid the impact of the test on the application.

[0082] According to an embodiment of the present invention, the program source code of the current page is run in a virtual environment to obtain a simulation page, wherein the virtual environment can be constructed according to the operating environment of the application environment to be tested. Simulation operations are performed on the operation items on the simulation page to determine multiple entry point information on the simulation page, wherein the simulation operation can be initiated through a Selenium framework to simulate the actual operation of the application environment to be tested.

[0083] According to an embodiment of the present invention, a simulation page is simulated in a virtual environment, simulation operations are performed on the simulation page and subsequent tests are performed, so that the application test will not affect the running application to be tested, thereby ensuring data security and the normal operation of the application.

[0084] According to an embodiment of the present invention, a target operable item is determined from at least one operable item based on multiple operation response results, including: determining, based on the operation response results, whether a state change occurs in the application to be tested in response to an operation performed on the operable item; and in the event that a state change occurs after the operation is performed, determining the operable item as a target operable item.

[0085] According to an embodiment of the present invention, based on multiple operation response results, when there is at least one operable item whose state will change after the operation is performed, a target operable item is determined based on this type of operable item.

[0086] According to an embodiment of the present invention, when it is determined that multiple operation response results all represent that an operation is performed in response to an operable item and no state change can occur, a target operable item is determined based on multiple operable items on the current application page.

[0087] According to an embodiment of the present invention, when all the operable items on the current application page cannot cause a state change, it indicates that the current test on the application has entered the deepest layer of the current test path, and a target operable item can be determined from multiple operable items. When there are operable items in the current application interface that can cause a state change in the application to be tested, the target operable item is determined based on the above operable items, so that after executing the target operable item, the program jumps to the next application interface, thereby increasing the length of the test path and improving the depth of the application test.

[0088] According to an embodiment of the present invention, after an operation is performed, in the case where a state change occurs, an operable item is determined as a target operable item, including: determining that an operation response result represents the current application interface after the operation is performed and a state change occurs; determining at least one operable item from the current application interface; when the number of operable items is greater than 1, determining the similarity between the multiple operable items based on entry point information corresponding to each of the multiple operable items; dividing the multiple operable items whose similarities are higher than a preset threshold into the same operable item group; and for each operable item group, selecting one from the operable item group as the target operable item.

[0089] According to an embodiment of the present invention, when there are multiple operable items in the current application page, the similarity between each operable item and the other operable items is calculated respectively, wherein the similarity between two operable items can be determined by entry point information corresponding to the two operable items respectively, and Web key elements such as Hypertext Markup Language (HTML), Document Object Model (DOM), page style (style or Cascading Style Sheets, CSS) in the two entry point information are determined respectively, and by calculating the similarity between the above key elements, the similarity between the two entry point information is determined, and then the similarity between the two operable items is determined.

[0090] According to an embodiment of the present invention, after determining the similarities between multiple operable items, multiple operable items with similarities higher than a preset threshold are grouped into the same operable item group, and one operable item is selected from each operable item group as a target operable item.

[0091] According to an embodiment of the present invention, when there are multiple operable items, the multiple operable items are grouped, and one operable item is selected from each operable item group as a target operable item, thereby reducing the number of target operable items and reducing the complexity of the test. Moreover, since a target operable item is determined for each operable item group, the comprehensiveness of the test is ensured.

[0092] Table 1 shows the test paths used by the application testing method according to the embodiment of the present invention and other testing methods.

[0093] Table 1

[0094]

[0095] As shown in Table 1, five other test methods are selected for comparison with the test method provided by the present invention. The application to be tested may be a Web application with security vulnerabilities used for network security teaching and detection.

[0096] According to the test path proportions shown in Table 1, it can be found that the application testing method provided in the embodiment of the present invention can parse and understand the application to be tested, guide the request and test direction, and focus most of the requests on the core functions of the application, thereby achieving in-depth exploration and testing of the Web application. Other testing methods focus more on the homepage of the application to be tested or the next level page of the homepage. The test path is not deep enough and it is difficult to discover deep-seated vulnerabilities.

[0097] Based on the above application testing method, the present invention also provides an application testing device. Figure 4 The device is described in detail.

[0098] Figure 4 A structural block diagram of an application program testing device according to an embodiment of the present invention is shown.

[0099] like Figure 4 As shown, the application program testing device 400 of this embodiment includes an information determination module 410 , an information analysis module 420 , an operation item determination module 430 , a state change module 440 , a path determination module 450 and an application testing module 460 .

[0100] The information determination module 410 is used to determine at least one entry point information in the program source code based on the program source code of the current application page of the application to be tested, wherein the entry point information represents a program segment for executing an operation corresponding to an operable item on the current application page. In one embodiment, the information determination module 410 can be used to execute the operation S210 described above, which will not be repeated here.

[0101] The information analysis module 420 is used to analyze the at least one entry point information using a large language model, and determine the operation response result of each of the at least one operable item corresponding to each of the at least one entry point information, wherein the operation response result represents the impact on the current application page when the operation is performed in response to the operable item. In one embodiment, the information analysis module 420 can be used to perform the operation S220 described above, which will not be repeated here.

[0102] The operation item determination module 430 is used to determine a target operable item from at least one operable item based on at least one operation response result. In one embodiment, the operation item determination module 430 can be used to perform the operation S230 described above, which will not be described in detail herein.

[0103] The state change module 440 is used to simulate triggering the target operable item to run the entry point information corresponding to the target operable item, so that the state of the application to be tested changes. In one embodiment, the state change module 440 can be used to perform the operation S240 described above, which will not be repeated here.

[0104] The path determination module 450 is used to repeatedly perform the above operations until jumping to the last application page, and determine the test path based on multiple target operable items and jump relationships. In one embodiment, the path determination module 450 can be used to perform the operation S250 described above, which will not be repeated here.

[0105] The application testing module 460 is used to test the application to be tested based on the test path and determine the test result of the application to be tested. In one embodiment, the application testing module 460 can be used to perform the operation S260 described above, which will not be repeated here.

[0106] According to an embodiment of the present invention, the information analysis module 420 includes a state determination submodule and a response result determination submodule.

[0107] The state determination submodule is used to analyze each entry point information using a large language model to determine the page state of the current application page after running the entry point information.

[0108] The response result determination submodule is used to determine the operation response result of the operable item based on the page state and the page state before the operation is performed on the operable item.

[0109] According to an embodiment of the present invention, the state change module 440 includes a parameter configuration submodule and a state change submodule.

[0110] The parameter configuration submodule is used to configure the parameters of the entry point information when it is determined that there are parameters to be configured in the entry point information to obtain the target entry point information.

[0111] The state change submodule is used to run the target entry point information so that the state of the application under test changes.

[0112] According to an embodiment of the present invention, the application testing module 460 includes an injection point determination submodule, a script injection submodule, an entry point execution submodule and a test result determination submodule.

[0113] The injection point determination submodule is used to determine, for each target operable item, one or more attackable injection points existing in the entry point information corresponding to the target operable item using a large language model.

[0114] The script injection submodule is used to use the attack script to inject the script into one or more attackable injection points to obtain the entry point information injected with the attack script.

[0115] The entry point running submodule is used to run the entry point information injected with the attack script and determine the operation result corresponding to the target operable item.

[0116] The test result determination submodule is used to determine a test result based on at least one operation result.

[0117] According to an embodiment of the present invention, the test result determination submodule includes a first test result determination unit and a second test result determination unit.

[0118] The first test result determination unit is used to determine a test result indicating that the application to be tested has passed the test when all operation results indicate that the operation is normal.

[0119] The second test result determination unit is used to determine the test result based on the entry point information injected with the attack script used to obtain the operation result when there is an operation result indicating an abnormal operation.

[0120] According to an embodiment of the present invention, the second test result determination unit includes an associated path determination subunit and a test result determination unit.

[0121] The associated path determination subunit is used to determine an associated test path associated with the operation result based on the entry point information injected with the attack script.

[0122] The test result determination unit is used to determine the test result based on the entry point information of the target operable item on the associated test path.

[0123] According to an embodiment of the present invention, the information determination module 410 includes a source code determination submodule, a source code operation submodule and a simulation operation submodule.

[0124] The source code determination submodule is used to obtain the program source code of the current application page.

[0125] The source code running submodule is used to run the program source code in a virtual environment to obtain a simulation page.

[0126] The simulation operation submodule is used to perform simulation operations on the operation items on the simulation page and determine the entry point information of the operation items.

[0127] According to an embodiment of the present invention, the operation item determination module 430 includes a change determination submodule and an operation item determination submodule.

[0128] The change determination submodule is used to determine, based on the operation response result, whether a state change occurs in the application to be tested after an operation is performed on the operable item.

[0129] The operation item determination submodule is used to determine the operable item as the target operable item when a state change occurs after the operation is performed.

[0130] According to an embodiment of the present invention, the operation item determination submodule includes an operation item determination unit, a similarity determination unit, an operation item grouping unit and a target operation item determination unit.

[0131] The page determination unit is used to determine that the operation response result represents the current application interface after the execution of the operation and the state change occurs.

[0132] The operation item determination unit is used to determine at least one operable item from the current application interface.

[0133] The similarity determination unit is used to determine the similarity between the multiple operable items based on the entry point information corresponding to each of the multiple operable items when the number of the operable items is greater than 1.

[0134] The operation item grouping unit is used to group multiple operable items with similarities higher than a preset threshold into the same operable item group.

[0135] The target operation item determination unit is used to select one of the operable item groups as a target operable item for each operable item group.

[0136] According to an embodiment of the present invention, any multiple modules among the information determination module 410, the information analysis module 420, the operation item determination module 430, the state change module 440, the path determination module 450 and the application test module 460 can be combined in one module for implementation, or any one of the modules can be split into multiple modules. Alternatively, at least part of the functions of one or more of these modules can be combined with at least part of the functions of other modules and implemented in one module. According to an embodiment of the present invention, at least one of the information determination module 410, the information analysis module 420, the operation item determination module 430, the state change module 440, the path determination module 450 and the application test module 460 can be at least partially implemented as a hardware circuit, such as a field programmable gate array (FPGA), a programmable logic array (PLA), a system on a chip, a system on a substrate, a system on a package, an application specific integrated circuit (ASIC), or can be implemented by hardware or firmware such as any other reasonable way of integrating or packaging the circuit, or implemented in any one of the three implementation methods of software, hardware and firmware or in a proper combination of any of them. Alternatively, at least one of the information determination module 410, the information analysis module 420, the operation item determination module 430, the state change module 440, the path determination module 450 and the application testing module 460 can be at least partially implemented as a computer program module, which can perform corresponding functions when the computer program module is executed.

[0137] Figure 5 A block diagram of an electronic device suitable for implementing an application testing method according to an embodiment of the present invention is shown.

[0138] like Figure 5 As shown, the electronic device 500 according to an embodiment of the present invention includes a processor 501, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 502 or a program loaded from a storage part 508 to a random access memory (RAM) 503. The processor 501 may include, for example, a general-purpose microprocessor (such as a CPU), an instruction set processor and / or a related chipset and / or a special-purpose microprocessor (for example, an application-specific integrated circuit (ASIC)), etc. The processor 501 may also include an onboard memory for caching purposes. The processor 501 may include a single processing unit or multiple processing units for performing different actions of the method flow according to an embodiment of the present invention.

[0139] In RAM 503, various programs and data required for the operation of electronic device 500 are stored. Processor 501, ROM 502 and RAM 503 are connected to each other via bus 504. Processor 501 performs various operations of the method flow according to the embodiment of the present invention by executing the program in ROM 502 and / or RAM 503. It should be noted that the program can also be stored in one or more memories other than ROM 502 and RAM 503. Processor 501 can also perform various operations of the method flow according to the embodiment of the present invention by executing the program stored in the one or more memories.

[0140] According to an embodiment of the present invention, the electronic device 500 may further include an input / output (I / O) interface 505, which is also connected to the bus 504. The electronic device 500 may further include one or more of the following components connected to the input / output (I / O) interface 505: an input portion 506 including a keyboard, a mouse, etc.; an output portion 507 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage portion 508 including a hard disk, etc.; and a communication portion 509 including a network interface card such as a LAN card, a modem, etc. The communication portion 509 performs communication processing via a network such as the Internet. A drive 510 is also connected to the input / output (I / O) interface 505 as needed. A removable medium 511, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 510 as needed, so that the computer program read therefrom is installed into the storage portion 508 as needed.

[0141] The present invention also provides a computer-readable storage medium, which may be included in the device / apparatus / system described in the above embodiment; or may exist independently without being assembled into the device / apparatus / system. The above computer-readable storage medium carries one or more programs, and when the above one or more programs are executed, the method according to the embodiment of the present invention is implemented.

[0142] According to an embodiment of the present invention, the computer-readable storage medium may be a non-volatile computer-readable storage medium, for example, may include but is not limited to: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In the present invention, the computer-readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system, an apparatus or a device. For example, according to an embodiment of the present invention, the computer-readable storage medium may include the ROM 502 and / or RAM 503 described above and / or one or more memories other than ROM 502 and RAM 503.

[0143] The embodiment of the present invention also includes a computer program product, which includes a computer program, and the computer program contains program code for executing the method shown in the flowchart. When the computer program product is run in a computer system, the program code is used to enable the computer system to implement the method provided by the embodiment of the present invention.

[0144] The computer program executes the above functions defined in the system / device of the embodiment of the present invention when it is executed by the processor 501. According to the embodiment of the present invention, the system, device, module, unit, etc. described above can be implemented by a computer program module.

[0145] In one embodiment, the computer program may rely on tangible storage media such as optical storage devices, magnetic storage devices, etc. In another embodiment, the computer program may also be transmitted and distributed in the form of signals on a network medium, and downloaded and installed through the communication part 509, and / or installed from the removable medium 511. The program code contained in the computer program may be transmitted using any appropriate network medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.

[0146] In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 509, and / or installed from the removable medium 511. When the computer program is executed by the processor 501, the above functions defined in the system of the embodiment of the present invention are performed. According to the embodiment of the present invention, the system, device, means, module, unit, etc. described above can be implemented by a computer program module.

[0147] According to an embodiment of the present invention, the program code for executing the computer program provided by the embodiment of the present invention can be written in any combination of one or more programming languages. Specifically, these computing programs can be implemented using high-level process and / or object-oriented programming languages, and / or assembly / machine languages. Programming languages ​​include, but are not limited to, Java, C++, python, "C" language or similar programming languages. The program code can be executed entirely on the user computing device, partially on the user device, partially on the remote computing device, or entirely on the remote computing device or server. In the case of a remote computing device, the remote computing device can be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computing device (e.g., using an Internet service provider to connect through the Internet).

[0148] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0149] It will be appreciated by those skilled in the art that the features described in the various embodiments of the present invention may be combined and / or combined in various ways, even if such combinations or combinations are not explicitly described in the present invention. In particular, without departing from the spirit and teachings of the present invention, the features described in the various embodiments of the present invention may be combined and / or combined in various ways. All of these combinations and / or combinations fall within the scope of the present invention.

[0150] The embodiments of the present invention are described above. However, these embodiments are only for the purpose of illustration, and are not intended to limit the scope of the present invention. Although each embodiment is described above, it does not mean that the measures in each embodiment cannot be used in combination advantageously. Without departing from the scope of the present invention, those skilled in the art may make various substitutions and modifications, which should all fall within the scope of the present invention.

Claims

1. An application testing method, characterized in that: The method comprises: Based on the program source code of the current application page of the application to be tested, determining at least one entry point information in the program source code, wherein the entry point information represents a program segment for executing an operation corresponding to an operable item on the current application page; Analyzing the at least one entry point information using a large language model to determine an operation response result of each of at least one operable item corresponding to each of the at least one entry point information, wherein the operation response result represents an impact on the current application page when an operation is performed in response to the operable item; Determining a target operable item from at least one of the operable items based on at least one of the operation response results; Simulate triggering the target operable item to run the entry point information corresponding to the target operable item, so that the state of the application to be tested changes; Repeat the above operation, and when the state change indicates entering the next application page, determine the next application page as the current application page, continue to determine the target operable item, simulate triggering the target operable item of the current application page, so that the state of the application to be tested changes; until jumping to the last application page, determine the test path based on multiple target operable items and jump relationships; and Based on the test path, the application to be tested is tested to determine the test result of the application to be tested; Wherein, determining a target operable item from at least one operable item based on at least one of the operation response results includes: Based on the operation response result, determining whether a state of the application to be tested changes after the operation is performed on the operable item; After the operation is performed, in the case where a state change occurs, the operable item is determined as the target operable item.

2. The method according to claim 1, characterized in that: The using of the large language model to analyze the at least one entry point information to determine the operation response result of at least one operable item corresponding to each of the at least one entry point information includes: Analyzing each entry point information using the large language model to determine the page state of the current application page after running the entry point information; and An operation response result of the operable item is determined based on the page state and the page state before the operation is performed on the operable item.

3. The method according to claim 1, characterized in that: The simulation triggers the target operable item to run the entry point information corresponding to the target operable item, so that the state of the application to be tested changes, including: If it is determined that the entry point information has parameters to be configured, performing parameter configuration on the entry point information to obtain target entry point information; and The target entry point information is run so that the state of the application to be tested changes.

4. The method according to claim 1, characterized in that: The step of testing the application to be tested based on the test path and determining a test result of the application to be tested includes: For each of the target actionable items, Using the large language model, determining one or more attackable injection points present in the entry point information corresponding to the target operable item; Using the attack script, injecting the script into the one or more attackable injection points to obtain entry point information injected with the attack script; Running the entry point information injected with the attack script to determine the operation result corresponding to the target operable item; and Based on at least one of the operation results, the test result is determined.

5. The method according to claim 4, characterized in that The determining the test result based on at least one of the operation results comprises: In a case where the operation results all indicate that the operation is normal, determining the test result indicating that the application to be tested has passed the test; In the case where the operation result indicating an abnormal operation exists, the test result is determined based on entry point information injected with an attack script for obtaining the operation result.

6. The method according to claim 5, characterized in that In the case where the operation result indicating an operation abnormality exists, determining the test result based on the entry point information injected with the attack script used to obtain the operation result, comprises: Determining an associated test path associated with the operation result based on the entry point information into which the attack script is injected; and The test result is determined based on the entry point information of the target operable item on the associated test path.

7. The method according to claim 1, characterized in that The step of determining at least one entry point information in the program source code based on the program source code of the current application page of the application to be tested includes: Obtaining the program source code of the current application page; Run the program source code in the virtual environment to obtain a simulation page; and A simulation operation is performed on the operation item on the simulation page to determine entry point information of the operation item.

8. The method according to claim 1, characterized in that The step of determining the operable item as the target operable item when a state change occurs after the operation is performed includes: Determine that the operation response result represents the execution of the operation, and the current application page after the state change appears; Determine at least one of the operable items from the current application page; When the number of the operable items is greater than 1, determining similarities between the plurality of operable items based on entry point information corresponding to each of the plurality of operable items; Grouping the plurality of operable items whose similarity is higher than a preset threshold into the same operable item group; and For each of the operable item groups, one is selected from the operable item group as the target operable item.

9. An application testing device, characterized in that: The device comprises: An information determination module, configured to determine at least one entry point information in the program source code of the current application page of the application to be tested, based on the program source code of the current application page, wherein the entry point information represents a program segment for executing an operation corresponding to an operable item on the current application page; An information analysis module, configured to analyze the at least one entry point information using a large language model, and determine an operation response result of each of the at least one operable item corresponding to each of the at least one entry point information, wherein the operation response result represents an impact on the current application page when an operation is performed in response to the operable item; An operation item determination module, configured to determine a target operable item from at least one of the operable items based on at least one of the operation response results; A state change module, used for simulating triggering the target operable item to run the entry point information corresponding to the target operable item, so that the state of the application to be tested changes; a path determination module, configured to repeatedly perform the above operations, and when the state change indicates entering a next application page, determine the next application page as the current application page, continue to determine target operable items, simulate triggering the target operable items of the current application page, so that the state of the application to be tested changes; until jumping to the last application page, determine the test path based on a plurality of the target operable items and the jump relationship; and An application testing module, used to test the application to be tested based on the test path, and determine the test result of the application to be tested; Wherein, the operation item determination module includes: a change determination submodule, configured to determine, based on the operation response result, whether a state change occurs in the application to be tested after the operation is performed on the operable item; The operation item determination submodule is used to determine the operable item as the target operable item when a state change occurs after the operation is performed.

Citation Information

Patent Citations

  • Application test method and device, equipment and readable storage medium

    CN110442515A

  • Application program testing method and device

    CN111694756A