Anti-duplicate mechanism verification method, verification system, electronic device and storage medium
By constructing the request message sequence list and assertion information, simulating the request information, and automatically performing button click operations, the problem of low efficiency of manual verification of the anti-reducing mechanism in the existing technology is solved, and efficient anti-reducing mechanism verification is achieved, ensuring testing comprehensiveness and accuracy.
Patent Information
- Application Number
- CN202110621633.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-06-03
- Publication Date
- 2024-11-26
- Estimated Expiration
- 2041-06-03
AI Technical Summary
In the prior art, the method of manually checking the weight prevention mechanism is single operation, the tester has a large workload, long time, low efficiency, and it is difficult to ensure the accuracy of the test and comprehensive coverage in multi-button or multi-request scenarios.
By constructing a sequence list of request messages, the first assertion information and the second assertion information are generated, the request information is simulated, the button click operation is performed, the response information is obtained, and the response information is matched based on the response information and assertion information, the client and server should be generated to prevent reimbursement. Verify the results to realize automated verification of the anti-duplication mechanism.
It effectively reduces testing costs, improves testing efficiency, ensures comprehensive coverage of button re-release verification, reduces the risk of omissions, and provides support for product quality assurance.
Smart Images

Figure CN113362173B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the fields of finance and computer technology, and more specifically, to an anti-duplicate mechanism verification method, a verification system, an electronic device, a storage medium, and a computer program product. Background Art
[0002] According to the application security specifications of banks and other institutions, a double anti-duplicate verification mechanism must be implemented on both the client and server sides for submit buttons, especially for transaction submissions involving accounting, to prevent customers or business personnel from repeatedly clicking submit operations, which may lead to business risks.
[0003] In the process of realizing the concept of the present disclosure, the inventors found that there are at least the following problems in the related technology: the current operation mechanism of the manual verification method is relatively simple, the testers have a large amount of repetitive work, the verification and inspection takes a long time, and the test efficiency is low. Summary of the invention
[0004] In view of this, the present disclosure provides an anti-duplicate mechanism verification method and verification system.
[0005] One aspect of the present disclosure provides an anti-duplication mechanism verification method, including:
[0006] Constructing a request message sequence table according to a button element in a target web page and a request message associated with the button element;
[0007] generating first assertion information and second assertion information associated with the button element according to the request message sequence table, wherein the first assertion information is different from the second assertion information;
[0008] When the client page anti-duplicate check succeeds, generating simulated request information according to the attribute information of the button element and the request message;
[0009] Performing a click operation on the button element to obtain first response information corresponding to the simulation request information;
[0010] In the case where the first response information successfully matches the first assertion information, performing a click operation on the button element again to obtain second response information corresponding to the simulation request information;
[0011] Generate a server-side anti-duplicate verification result according to the second response information and the second assertion information.
[0012] According to an embodiment of the present disclosure, the anti-duplication mechanism verification method further includes:
[0013] Acquire the button element and the attribute information in the target webpage;
[0014] Execute a click operation on each of the button elements in sequence to obtain the request message associated with the button element.
[0015] According to an embodiment of the present disclosure, the acquiring the button element and the attribute information in the target webpage includes:
[0016] Obtaining page data of the target page;
[0017] The button element and the attribute information in the target webpage are determined according to the page data.
[0018] According to an embodiment of the present disclosure, the method for preventing duplicate verification of a client page includes:
[0019] Execute a click operation on the button element and detect status information of the button element;
[0020] When the state information indicates that the button element is valid, performing a click operation on the button element again to detect whether a prompt message pops up;
[0021] When the prompt message is detected to be popped up, a verification result indicating that the client anti-duplication verification is successful is generated.
[0022] According to an embodiment of the present disclosure, the anti-duplication mechanism verification method further includes:
[0023] In the case where the state information indicates that the button element is invalid, a verification result indicating that the client anti-duplication verification is successful is generated.
[0024] According to an embodiment of the present disclosure, the anti-duplication mechanism verification method further includes:
[0025] In the case where the prompt message is not detected to be popped up, a verification result indicating that the client anti-recheck has failed is generated.
[0026] According to an embodiment of the present disclosure, the attribute information includes at least one of the following: uniform resource locator text information and user local terminal data.
[0027] According to an embodiment of the present disclosure, the anti-duplication mechanism verification method further includes:
[0028] In the case that the first response information fails to match the first assertion information, the simulation request information is regenerated until the first response information corresponding to the simulation request information successfully matches the first assertion information.
[0029] According to an embodiment of the present disclosure, generating a server-side anti-duplicate verification result according to the second response information and the second assertion information includes:
[0030] If the second response information matches the second assertion information successfully, generating a verification result indicating that the server-side anti-duplicate verification is successful; or
[0031] In the event that the second response information fails to match the second assertion information, a verification result indicating that the server-side anti-duplicate verification is successful is generated.
[0032] Another aspect of the present disclosure provides an anti-duplication mechanism verification system, comprising:
[0033] A construction module, used to construct a request message sequence list according to a button element in a target web page and a request message associated with the button element;
[0034] A first generating module, configured to generate first assertion information and second assertion information associated with the button element according to the request message sequence table, wherein the first assertion information is different from the second assertion information;
[0035] A second generating module is used to generate simulated request information according to the attribute information of the button element and the request message when the client page anti-duplicate check succeeds;
[0036] A first acquisition module, used to execute a click operation on the button element to acquire first response information corresponding to the simulation request information;
[0037] A second acquisition module is used to perform a click operation on the button element again to acquire second response information corresponding to the simulation request information when the first response information matches the first assertion information successfully;
[0038] The third generating module is used to generate a server-side anti-duplication verification result according to the second response information and the second assertion information.
[0039] Another aspect of the present disclosure provides an electronic device, comprising: one or more processors; and a memory for storing one or more instructions, wherein when the one or more instructions are executed by the one or more processors, the one or more processors implement the method as described above.
[0040] Another aspect of the present disclosure provides a computer-readable storage medium storing computer-executable instructions, which are used to implement the above method when executed.
[0041] Another aspect of the present disclosure provides a computer program product, which includes computer executable instructions, and when the instructions are executed, are used to implement the method as described above.
[0042] According to the embodiments of the present disclosure, the first assertion information and the second assertion information are generated according to the message sequence table constructed by the button element and the request message associated with the button element. When the client page anti-duplicate check is successful, the simulated request information is generated, and the first response information and the second response information corresponding to the simulated request information are compared with the first assertion information and the second assertion information to generate the test result. Since the test result is obtained by comparing the response information and the assertion information, the test cost can be effectively reduced, the test efficiency can be improved, and at the same time, the verification of button anti-duplicate can be ensured to be fully covered, the risk of omission can be reduced, and support can be provided for product quality assurance. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] The above and other objects, features and advantages of the present disclosure will become more apparent through the following description of the embodiments of the present disclosure with reference to the accompanying drawings, in which:
[0044] Figure 1 An exemplary system architecture to which the anti-duplication mechanism verification method according to an embodiment of the present disclosure can be applied is schematically shown.
[0045] Figure 2 The flowchart of the anti-duplicate mechanism verification method according to an embodiment of the present disclosure is schematically shown.
[0046] Figure 3 A schematic diagram of a button element acquisition method according to an embodiment of the present disclosure is schematically shown.
[0047] Figure 4 A schematic diagram of a client page anti-duplication verification method according to an embodiment of the present disclosure is schematically shown.
[0048] Figure 5 A schematic diagram of an anti-duplication mechanism verification method according to another embodiment of the present disclosure is schematically shown.
[0049] Figure 6 A block diagram of an anti-repetition mechanism verification system according to an embodiment of the present disclosure is schematically shown.
[0050] Figure 7 A block diagram of a computer system suitable for implementing the method described above according to an embodiment of the present disclosure is schematically shown. DETAILED DESCRIPTION
[0051] Hereinafter, embodiments of the present disclosure 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 disclosure. In the following detailed description, for ease of explanation, many specific details are set forth to provide a comprehensive understanding of the embodiments of the present disclosure. 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 the concepts of the present disclosure.
[0052] The terms used herein are only for describing specific embodiments and are not intended to limit the present disclosure. 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.
[0053] 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.
[0054] In the case of using expressions such as "at least one of A, B, and C, etc.", it should generally be interpreted in accordance with the meaning of the expression generally 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.). In the case of using expressions such as "at least one of A, B, or C, etc.", it should generally be interpreted in accordance with the meaning of the expression generally understood by those skilled in the art (for example, "a system having at least one of A, B, or 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.).
[0055] According to the application security specifications of banks and other institutions, a double anti-duplicate verification mechanism must be implemented on both the client and server sides for submit buttons, especially for transaction submissions involving accounting, to prevent customers or business personnel from repeatedly clicking submit operations, which may lead to business risks.
[0056] At present, the method of preventing duplicate buttons on the client side is mainly implemented by graying out buttons, popping up prompt boxes, etc. On the server side, the method of preventing duplicate buttons is to perform unique constraints and verification on fields such as application number and serial number. At present, most of the verification methods for preventing duplicate buttons are for testers to log in to the client page, select the request button to be verified on the page, submit the request data by manually clicking the button continuously, check the returned results, and observe the page control or page prompt verification to see whether the client and server button anti-duplicate mechanisms are implemented. However, when the application involves more submission or approval-related functions, the number of buttons is large, or when special treatment is done on buttons in technical transformation projects, the workload of manual verification is very large, and it is easy to miss test verification points, which is high-risk.
[0057] Currently, some scanning tools support crawling all page requests and recording all request messages and response messages. It is necessary to find the corresponding request through the corresponding request path and method name for playback, and then the tester will compare and check the corresponding results to determine whether anti-duplicate is achieved. Manual verification is labor-intensive.
[0058] In the process of realizing the concept of the present disclosure, the inventors found that there are at least the following problems in the related technology: the current manual verification method has a relatively simple operation mechanism, the tester has a large amount of repetitive work, the verification and inspection takes a long time, and the test efficiency is low. At the same time, if the transaction is replayed through tool interception, it is necessary to screen the test button objects in the page crawling request. When the number of page buttons or the number of requests is large, the screening is difficult and easy to miss. At the same time, it is necessary to manually control the request time for repeatedly sending transactions, which makes it difficult to ensure the accuracy of the test.
[0059] The embodiments of the present disclosure provide an anti-duplicate mechanism verification method, a verification system, an electronic device, a storage medium and a computer program product. The anti-duplicate mechanism verification method includes: constructing a request message sequence list according to a button element in a target web page and a request message associated with the button element; generating first assertion information and second assertion information associated with the button element according to the request message sequence list, wherein the first assertion information is different from the second assertion information; in the case where the client page anti-duplicate verification is successful, generating simulated request information according to the attribute information of the button element and the request message; performing a click operation on the button element to obtain first response information corresponding to the simulated request information; in the case where the first response information successfully matches the first assertion information, performing a click operation on the button element again to obtain second response information corresponding to the simulated request information; generating a server-side anti-duplicate verification result according to the second response information and the second assertion information.
[0060] It should be noted that the method and system for verifying the anti-duplicate mechanism disclosed herein can be used in the financial field and the computer technology field, and can also be used in any field other than the financial field and the computer technology field. The application field of the method and system for verifying the anti-duplicate mechanism disclosed herein is not limited.
[0061] Figure 1 The exemplary system architecture 100 to which the anti-duplication mechanism verification method can be applied according to an embodiment of the present disclosure is schematically shown. It should be noted that: Figure 1 What is shown is merely an example of a system architecture to which the embodiments of the present disclosure can be applied, in order to help those skilled in the art understand the technical content of the present disclosure, but it does not mean that the embodiments of the present disclosure cannot be used in other devices, systems, environments or scenarios.
[0062] like Figure 1 As shown, the system architecture 100 according to this embodiment may include terminal devices 101, 102, 103, a network 104 and a server 105. The network 104 is used to provide a medium for communication links between the terminal devices 101, 102, 103 and the server 105. The network 104 may include various connection types, such as wired and / or wireless communication links, etc.
[0063] Users can use terminal devices 101, 102, 103 to interact with server 105 through network 104 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 101, 102, 103, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients and / or social platform software, etc. (only as examples).
[0064] The terminal devices 101 , 102 , and 103 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, and desktop computers.
[0065] The server 105 may be a server that provides various services, such as a background management server (only an example) that provides support for websites browsed by users using the terminal devices 101, 102, and 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.
[0066] It should be noted that the anti-duplication mechanism verification method provided in the embodiment of the present disclosure can generally be executed by the server 105. Accordingly, the anti-duplication mechanism verification system provided in the embodiment of the present disclosure can generally be set in the server 105. The anti-duplication mechanism verification method provided in the embodiment of the present disclosure can also be executed by a server or server cluster that is different from the server 105 and can communicate with the terminal devices 101, 102, 103 and / or the server 105. Correspondingly, the anti-duplication mechanism verification system provided in the embodiment of the present disclosure can also be set in a server or server cluster that is different from the server 105 and can communicate with the terminal devices 101, 102, 103 and / or the server 105. Alternatively, the anti-duplication mechanism verification method provided in the embodiment of the present disclosure can also be executed by the terminal devices 101, 102, or 103, or can also be executed by other terminal devices different from the terminal devices 101, 102, or 103. Accordingly, the anti-duplication mechanism verification system provided in the embodiment of the present disclosure may also be set in the terminal device 101 , 102 , or 103 , or in other terminal devices different from the terminal device 101 , 102 , or 103 .
[0067] For example, the anti-duplication mechanism to be verified may be originally installed in any one of the terminal devices 101, 102, or 103 (for example, the terminal device 101, but not limited thereto). Then, the terminal device 101 may locally execute the anti-duplication mechanism verification method provided by the embodiment of the present disclosure. The terminal device 101 may also be connected to other terminal devices, servers, or server clusters, and the anti-duplication mechanism verification method provided by the embodiment of the present disclosure may be executed by other terminal devices, servers, or server clusters connected to the terminal device 101. Alternatively, the anti-duplication mechanism to be verified may be installed in a server or a server cluster, and the anti-duplication mechanism verification method provided by the embodiment of the present disclosure may be locally executed by the server or server cluster on which the anti-duplication mechanism to be verified is installed.
[0068] 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.
[0069] Figure 2 The flowchart of the anti-duplicate mechanism verification method according to an embodiment of the present disclosure is schematically shown.
[0070] like Figure 2 As shown, the method includes operations S201 to S206.
[0071] In operation S201, a request message sequence table is constructed according to a button element in a target web page and a request message associated with the button element.
[0072] According to an embodiment of the present disclosure, the target webpage may refer to a webpage that needs to be displayed on a carrier, for example. The type of the target interface may include a PC (personal computer) end webpage, a counter end webpage, or a mobile end webpage. The carrier may include an electronic device, the electronic device may include a terminal device, and the terminal device may include a smart phone, a tablet computer, a portable computer, or a desktop computer, etc.
[0073] According to an embodiment of the present disclosure, the target webpage may include, for example, at least one button element, all the button elements are named, and the button elements and the request messages associated therewith are displayed in the form of a list.
[0074] In operation S202, first assertion information and second assertion information associated with the button element are generated according to the request message sequence table, wherein the first assertion information is different from the second assertion information.
[0075] According to an embodiment of the present disclosure, the first assertion information may include, for example, a first assertion condition, and the second assertion information may include, for example, a second assertion condition. The first assertion condition may be used, for example, to determine whether the request issued by pressing a button is matched successfully. The second assertion condition may be used, for example, to determine whether duplicate prevention is successful when repeatedly sending a request.
[0076] According to an embodiment of the present disclosure, a button element in a request message sequence table is selected to display a request message associated with the button element. A first assertion condition and a second assertion condition are generated according to the request message. Furthermore, the request message display method may be, for example, displayed in the text form of a Json (JavaScript Object Notation) message. The generation method of the first assertion condition and the second assertion condition may be, for example, automatically generated by the system or manually entered by a tester.
[0077] According to an embodiment of the present disclosure, before generating the first assertion condition and the second assertion condition, the request message may be adaptively modified according to specific implementation requirements, and then the first assertion condition and the second assertion condition may be generated according to the modified request message.
[0078] In operation S203, when the client page anti-duplication check succeeds, simulated request information is generated according to the attribute information of the button element and the request message.
[0079] According to an embodiment of the present disclosure, the attribute information may include, for example, URL (Uniform Resource Locator) text information, cookies (data stored on the user's local terminal) information, etc. The request message may include, for example, request data, request header, etc.
[0080] In operation S204, a click operation is performed on the button element to obtain first response information corresponding to the simulation request information.
[0081] According to an embodiment of the present disclosure, by clicking a button element, for example, the simulated request information can be sent through the Requests library, the first response information can be obtained, and the first assertion condition can be matched to verify whether the simulated request information is sent successfully and the expected result is returned.
[0082] In operation S205, when the first response information matches the first assertion information successfully, a click operation on the button element is performed again to obtain second response information corresponding to the simulation request information.
[0083] In operation S206, a server-side anti-duplication verification result is generated according to the second response information and the second assertion information.
[0084] According to the embodiments of the present disclosure, the first assertion information and the second assertion information are generated according to the message sequence table constructed by the button element and the request message associated with the button element. When the client page anti-duplicate check is successful, the simulated request information is generated, and the first response information and the second response information corresponding to the simulated request information are compared with the first assertion information and the second assertion information to generate the test result. Since the test result is obtained by comparing the response information and the assertion information, the test cost can be effectively reduced, the test efficiency can be improved, and at the same time, the verification of button anti-duplicate can be ensured to be fully covered, the risk of omission can be reduced, and support can be provided for product quality assurance.
[0085] According to an embodiment of the present disclosure, the anti-duplication mechanism verification method further includes:
[0086] Obtain button elements and attribute information in the target web page; perform click operations on each button element in turn to obtain request messages associated with the button elements.
[0087] According to an embodiment of the present disclosure, the method for obtaining the button element can be determined by, for example, locating all elements with "button" in tags in the target web page using Selenium (automated testing tool). Whenever a button element is found, the attribute information corresponding to the button element is recorded.
[0088] According to an embodiment of the present disclosure, after a button element is determined, for example, it may be named, and the naming format may include, for example: button+determination order (such as button 1).
[0089] According to an embodiment of the present disclosure, after all button elements are recorded, the recorded attribute information is matched through the find_element.click method, and each button is executed to realize the automatic clicking operation of the button. After clicking, the request message is immediately recorded and associated with the button name, and all recorded buttons and corresponding request messages are looped through.
[0090] According to an embodiment of the present disclosure, during the processing, if no button element is crawled in the target web page, a prompt "There is no button that can be verified on this page" is displayed and the process ends.
[0091] According to an embodiment of the present disclosure, obtaining button elements and attribute information in a target webpage includes:
[0092] Obtain page data of the target page; determine button elements and attribute information in the target web page according to the page data.
[0093] According to the embodiment of the present disclosure, firstly, data analysis is performed on the target page, the URL of the target page is entered, the corresponding web page is opened, and the front-end page data is output. Data analysis is performed on the page data.
[0094] Figure 3 A schematic diagram of a button element acquisition method according to an embodiment of the present disclosure is schematically shown.
[0095] like Figure 3 As shown, the method includes operations S310 to S370.
[0096] First, operation S310 is performed to crawl page elements after data processing of the target page. In operation S320, it is detected whether there is a button element in the target page.
[0097] In the case that the button element does not exist, operation S370 is performed to prompt that the target page does not have a button element.
[0098] In the case where a button element exists, perform operation S330, and name each button element according to the preset naming rules when crawled. In operation S340, automatically click the button, record the attribute name and request message of the button, and match the recorded information with the name of the button. In operation S350, check whether there is a button element below the target page. In the case where the button element still exists, perform operation S330. In the case where there is no button element, perform operation S360 to display the crawling results.
[0099] According to an embodiment of the present disclosure, a method for preventing duplicate verification of a client page includes:
[0100] Execute a click operation on the button element and detect the status information of the button element; when the status information indicates that the button element is valid, execute the click operation on the button element again to detect whether a prompt message pops up; when a prompt message pops up, generate a verification result indicating that the client anti-duplicate check is successful.
[0101] According to an embodiment of the present disclosure, the execution method of the click operation may include methods such as find_element.click. The state information of the button element may include, for example, a valid state and an invalid state. The valid state may include, for example, an available state. The invalid state may include, for example, a disabled state. The prompt information may include, for example, a prompt box, a prompt sound, etc.
[0102] According to an embodiment of the present disclosure, the method for preventing duplicate verification of client pages further includes:
[0103] In the case where the state information indicates that the button element is invalid, a verification result is generated indicating that the client anti-duplicate verification is successful.
[0104] According to an embodiment of the present disclosure, the method for preventing duplicate verification of client pages further includes:
[0105] In the case where no pop-up prompt message is detected, a verification result indicating that the client anti-duplication verification fails is generated.
[0106] Figure 4 A schematic diagram of a client page anti-duplication verification method according to an embodiment of the present disclosure is schematically shown.
[0107] like Figure 4 As shown, the method includes operations S410 to S460.
[0108] First, operation S410 is performed to locate a button in a target page and click it automatically. In operation S420, the state of the button element is detected.
[0109] When the state of the button element is disabled, it indicates that the client page anti-duplication check is successful, and operation S450 is performed to output the check result.
[0110] When the state of the button element is available, operation S430 is performed to locate the button again and click it. In operation S440, it is detected whether prompt information pops up in the target page.
[0111] If the prompt information is detected, it means that the client page anti-duplication check is successful, and operation S450 is executed to output the check result.
[0112] If no prompt information is detected, it means that the client page anti-duplication check has failed, and operation S460 is executed to output the check result.
[0113] Repeat the above steps until all button elements in the target page are verified.
[0114] According to an embodiment of the present disclosure, the attribute information includes at least one of the following: uniform resource locator text information and user local terminal data.
[0115] According to an embodiment of the present disclosure, the anti-duplication mechanism verification method further includes:
[0116] In the case where the first response information fails to match the first assertion information, the simulation request information is regenerated until the first response information corresponding to the simulation request information successfully matches the first assertion information.
[0117] According to an embodiment of the present disclosure, if the first response information fails to match the first assertion information, it means that the simulation request does not get the expected response. In the case where the first response information fails to match the first assertion information, the verification may also be terminated.
[0118] According to an embodiment of the present disclosure, generating a server-side anti-duplicate verification result according to the second response information and the second assertion information includes:
[0119] If the second response information matches the second assertion information successfully, a verification result is generated indicating that the server-side anti-duplicate verification is successful; or if the second response information matches the second assertion information unsuccessfully, a verification result is generated indicating that the server-side anti-duplicate verification is successful.
[0120] Figure 5 A schematic diagram of an anti-duplication mechanism verification method according to another embodiment of the present disclosure is schematically shown.
[0121] like Figure 5 As shown, the method includes operations S510 to S580.
[0122] First, perform operation S510 to send a virtual request through the Requests library. Perform operation S520 to record the first response information for the virtual request. In operation S530, determine whether the first response information matches the first assertion condition.
[0123] In the case where the first response information does not match the first assertion condition, for example, operation S510 may be re-executed. Further, before re-executing operation S510, for example, a virtual request may be re-generated, and operation S510 may be performed using the re-generated virtual request. Alternatively, in the case where the first response information does not match the first assertion condition, the inspection work is terminated.
[0124] In the case where the first response information matches the first assertion condition, operation S540 is executed to send the virtual request again through the Requests library. Further, for example, an interval time can be preset so that there is a certain time interval between the time when the virtual request is sent for the second time and the time when the virtual request is sent for the first time. Operation S550 is executed to record the second response information for the virtual request. In operation S560, it is determined whether the second response information matches the second assertion condition.
[0125] If the second response information does not match the second assertion condition, it indicates that the server-side anti-duplicate check has failed, and operation S580 is performed to output the check result. If the second response information matches the second assertion condition, it indicates that the server-side anti-duplicate check has succeeded, and operation S560 is performed to output the check result.
[0126] It should be noted that, unless it is explicitly stated that there is a sequence of execution between different operations shown in the flowchart in the embodiments of the present disclosure, or there is a sequence of execution between different operations in technical implementation, otherwise, the execution order of multiple operations may not be prioritized, and multiple operations may also be executed simultaneously.
[0127] According to the embodiments of the present disclosure, the anti-duplication mechanism verification method can display the anti-duplication mechanism display results after repeated clicks on the client target page, and automatically execute request replay and result assertion comparison according to the tester's choice. For the tester, he only needs to pay attention to whether the result returned by the tool is anti-duplication, and he no longer needs to replay the request and compare the corresponding results by himself, thereby lowering the testing threshold, improving testing efficiency, and effectively reducing the current testing workload for verifying anti-duplication technology.
[0128] Furthermore, according to the embodiments of the present disclosure, while effectively ensuring the front-end and back-end verification effects, the controllability of the test is increased. By crawling the page content to match the listed button elements, and then allowing the tester to select the button requests that need to be repeatedly clicked for verification, the tester can perform more targeted testing.
[0129] Figure 6 A block diagram of an anti-repetition mechanism verification system according to an embodiment of the present disclosure is schematically shown.
[0130] like Figure 6 As shown, the anti-duplication mechanism verification system 600 includes a construction module 601 , a first generation module 602 , a second generation module 603 , a first acquisition module 604 , a second acquisition module 605 and a third generation module 606 .
[0131] A construction module 601 is used to construct a request message sequence table according to a button element in a target web page and a request message associated with the button element;
[0132] A first generating module 602, configured to generate first assertion information and second assertion information associated with the button element according to the request message sequence table, wherein the first assertion information is different from the second assertion information;
[0133] The second generating module 603 is used to generate simulated request information according to the attribute information of the button element and the request message when the client page anti-duplicate check succeeds;
[0134] A first acquisition module 604 is used to perform a click operation on the button element to acquire first response information corresponding to the simulation request information;
[0135] The second acquisition module 605 is used to perform a click operation on the button element again to acquire second response information corresponding to the simulation request information when the first response information matches the first assertion information successfully;
[0136] The third generating module 606 is used to generate a server-side anti-duplication verification result according to the second response information and the second assertion information.
[0137] According to the embodiments of the present disclosure, the first assertion information and the second assertion information are generated according to the message sequence table constructed by the button element and the request message associated with the button element. When the client page anti-duplicate check is successful, the simulated request information is generated, and the first response information and the second response information corresponding to the simulated request information are compared with the first assertion information and the second assertion information to generate the test result. Since the test result is obtained by comparing the response information and the assertion information, the test cost can be effectively reduced, the test efficiency can be improved, and at the same time, the verification of button anti-duplicate can be ensured to be fully covered, the risk of omission can be reduced, and support can be provided for product quality assurance.
[0138] According to an embodiment of the present disclosure, the anti-duplication mechanism verification system 600 further includes a third acquisition module and a fourth acquisition module.
[0139] The third acquisition module is used to acquire button elements and attribute information in the target web page.
[0140] The fourth acquisition module is used to perform a click operation on each button element in turn to acquire a request message associated with the button element.
[0141] According to an embodiment of the present disclosure, the third acquisition module includes a first acquisition unit and a determination unit.
[0142] The first acquisition unit is used to acquire page data of a target page.
[0143] The determination unit is used to determine the button elements and attribute information in the target web page according to the page data.
[0144] According to an embodiment of the present disclosure, the second generating module 603 includes: a first detecting unit, a second detecting unit and a first generating unit.
[0145] The first detection unit is used to perform a click operation on a button element and detect state information of the button element.
[0146] The second detection unit is used to execute the click operation on the button element again to detect whether prompt information pops up when the state information indicates that the button element is valid.
[0147] The first generating unit is used to generate a verification result indicating that the client anti-duplication verification is successful when a pop-up prompt message is detected.
[0148] According to an embodiment of the present disclosure, the anti-duplication mechanism verification system 600 further includes a fourth generation module.
[0149] The fourth generating module is used to generate a verification result indicating that the client anti-duplicate verification is successful when the status information indicates that the button element is invalid.
[0150] According to an embodiment of the present disclosure, the anti-duplication mechanism verification system 600 further includes a fifth generation module.
[0151] The fifth generating module is used to generate a verification result indicating that the client anti-duplication verification has failed when no pop-up prompt information is detected.
[0152] According to an embodiment of the present disclosure, the attribute information includes at least one of the following: uniform resource locator text information and user local terminal data.
[0153] According to an embodiment of the present disclosure, the anti-duplication mechanism verification system 600 further includes a sixth generation module.
[0154] The sixth generating module is used to regenerate the simulation request information when the first response information fails to match the first assertion information, until the first response information corresponding to the simulation request information successfully matches the first assertion information.
[0155] According to an embodiment of the present disclosure, the third generating module 606 includes a second generating unit and a third generating unit.
[0156] The second generating unit is used to generate a verification result indicating that the server-side anti-duplicate verification is successful when the second response information matches the second assertion information successfully.
[0157] The third generating unit is used to generate a verification result indicating that the server-side anti-duplicate verification is successful when the second response information fails to match the second assertion information.
[0158] According to the embodiments of the present invention, any one or more of the modules, submodules, units, and subunits, or at least part of the functions of any one of them can be implemented in one module. According to the embodiments of the present invention, any one or more of the modules, submodules, units, and subunits can be split into multiple modules for implementation. According to the embodiments of the present invention, any one or more of the modules, submodules, units, and subunits can be at least partially implemented as hardware circuits, such as field programmable gate arrays (FPGAs), programmable logic arrays (PLAs), systems on chips, systems on substrates, systems on packages, application specific integrated circuits (ASICs), or can be implemented by hardware or firmware in 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 any appropriate combination of any of them. Alternatively, according to the embodiments of the present invention, one or more of the modules, submodules, units, and subunits can be at least partially implemented as computer program modules, and when the computer program modules are run, the corresponding functions can be performed.
[0159] For example, any multiple of the construction module 601, the first generation module 602, the second generation module 603, the first acquisition module 604, the second acquisition module 605, and the third generation module 606 can be combined in one module / unit / sub-unit for implementation, or any one of the modules / units / sub-units can be split into multiple modules / units / sub-units. Alternatively, at least part of the functions of one or more of the modules / units / sub-units can be combined with at least part of the functions of other modules / units / sub-units and implemented in one module / unit / sub-unit. According to an embodiment of the present disclosure, at least one of the construction module 601, the first generation module 602, the second generation module 603, the first acquisition module 604, the second acquisition module 605, and the third generation module 606 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 by any one of the three implementation methods of software, hardware, and firmware, or by an appropriate combination of any of them. Alternatively, at least one of the construction module 601, the first generation module 602, the second generation module 603, the first acquisition module 604, the second acquisition module 605, and the third generation module 606 can be at least partially implemented as a computer program module, and when the computer program module is run, the corresponding function can be executed.
[0160] It should be noted that the anti-duplication mechanism verification system part in the embodiment of the present disclosure corresponds to the anti-duplication mechanism verification method part in the embodiment of the present disclosure. The description of the anti-duplication mechanism verification system part specifically refers to the anti-duplication mechanism verification method part, which will not be repeated here.
[0161] Figure 7 A block diagram of a computer system suitable for implementing the method described above according to an embodiment of the present disclosure is schematically shown. Figure 7 The computer system shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0162] like Figure 7 As shown, the computer system 700 according to the embodiment of the present disclosure includes a processor 701, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 702 or the program loaded from the storage part 708 to the random access memory (RAM) 703. The processor 701 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 701 may also include an onboard memory for caching purposes. The processor 701 may include a single processing unit or multiple processing units for performing different actions of the method flow according to the embodiment of the present disclosure.
[0163] In RAM 703, various programs and data required for the operation of system 700 are stored. Processor 701, ROM 702 and RAM 703 are connected to each other through bus 704. Processor 701 performs various operations of the method flow according to the embodiment of the present disclosure by executing the program in ROM 702 and / or RAM 703. It should be noted that the program can also be stored in one or more memories other than ROM 702 and RAM 703. Processor 701 can also perform various operations of the method flow according to the embodiment of the present disclosure by executing the program stored in the one or more memories.
[0164] According to an embodiment of the present disclosure, the system 700 may further include an input / output (I / O) interface 705, which is also connected to the bus 704. The system 700 may further include one or more of the following components connected to the I / O interface 705: an input section 706 including a keyboard, a mouse, etc.; an output section 707 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 708 including a hard disk, etc.; and a communication section 709 including a network interface card such as a LAN card, a modem, etc. The communication section 709 performs communication processing via a network such as the Internet. A drive 710 is also connected to the I / O interface 705 as needed. A removable medium 711, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 710 as needed, so that a computer program read therefrom is installed into the storage section 708 as needed.
[0165] According to an embodiment of the present disclosure, the method flow according to an embodiment of the present disclosure can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a computer-readable storage medium, and the computer program contains a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 709, and / or installed from the removable medium 711. When the computer program is executed by the processor 701, the above-mentioned functions defined in the system of the embodiment of the present disclosure are executed. According to an embodiment of the present disclosure, the system, equipment, device, module, unit, etc. described above can be implemented by a computer program module.
[0166] The present disclosure also provides a computer-readable storage medium, which may be included in the device / apparatus / system described in the above embodiments; 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 disclosure is implemented.
[0167] According to an embodiment of the present disclosure, the computer-readable storage medium may be a non-volatile computer-readable storage medium. For example, it 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 disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in combination with an instruction execution system, apparatus, or device.
[0168] For example, according to an embodiment of the present disclosure, the computer-readable storage medium may include the ROM 702 and / or the RAM 703 described above and / or one or more memories other than the ROM 702 and the RAM 703 .
[0169] An embodiment of the present disclosure also includes a computer program product, which includes a computer program, and the computer program contains a program code for executing the method provided by the embodiment of the present disclosure. When the computer program product runs on an electronic device, the program code is used to enable the electronic device to implement the anti-duplication mechanism verification method provided by the embodiment of the present disclosure.
[0170] When the computer program is executed by the processor 701, the above functions defined in the system / device of the embodiment of the present disclosure are executed. According to the embodiment of the present disclosure, the system, device, module, unit, etc. described above can be implemented by a computer program module.
[0171] 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 709, and / or installed from the removable medium 711. 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.
[0172] According to an embodiment of the present disclosure, the program code for executing the computer program provided by the embodiment of the present disclosure 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 (for example, using an Internet service provider to connect through the Internet).
[0173] The flowcharts and block diagrams in the accompanying drawings illustrate the possible architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each box in the flowchart or block diagram may represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of the code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box may also occur in an order different from that 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 flowchart, and the combination of boxes in the block diagram or flowchart, can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions. It can be understood by those skilled in the art that the features recorded in the various embodiments and / or claims of the present disclosure can be combined and / or combined in a variety of ways, even if such a combination or combination is not explicitly recorded in the present disclosure. In particular, without departing from the spirit and teaching of the present disclosure, the features described in the various embodiments and / or claims of the present disclosure may be combined and / or combined in a variety of ways. All of these combinations and / or combinations fall within the scope of the present disclosure.
[0174] The embodiments of the present disclosure are described above. However, these embodiments are only for the purpose of illustration and are not intended to limit the scope of the present disclosure. Although the embodiments are described above separately, this does not mean that the measures in the various embodiments cannot be used in combination to advantage. The scope of the present disclosure is defined by the attached claims and their equivalents. Without departing from the scope of the present disclosure, those skilled in the art may make various substitutions and modifications, which should all fall within the scope of the present disclosure.
Claims
1. A method for verifying an anti-duplicate mechanism, comprising: Constructing a request message sequence list according to a button element in a target web page and a request message associated with the button element; generating first assertion information and second assertion information associated with the button element according to the request message sequence table, wherein the first assertion information is different from the second assertion information; In the case where the client page anti-duplicate check succeeds, generating simulated request information according to the attribute information of the button element and the request message, wherein the attribute information and the request message are obtained by crawling the client page; Performing a click operation on the button element to obtain first response information corresponding to the simulation request information; In the case where the first response information successfully matches the first assertion information, performing a click operation on the button element again to obtain second response information corresponding to the simulated request information, wherein the successful match between the first response information and the first assertion information is used to indicate that the simulated request information is successfully sent and meets a predetermined condition; A server-side anti-duplicate verification result is generated according to the second response information and the second assertion information, wherein a successful match between the second response information and the second assertion information is used to indicate that the server-side anti-duplicate verification is successful.
2. The method according to claim 1, further comprising: Acquire the button element and the attribute information in the target webpage; Execute a click operation on each of the button elements in sequence to obtain the request message associated with the button element.
3. The method according to claim 2, wherein: The acquiring of the button element and the attribute information in the target webpage includes: Acquire page data of the target web page; The button element and the attribute information in the target webpage are determined according to the page data.
4. The method according to claim 1, wherein: The client page anti-duplication verification method includes: Execute a click operation on the button element and detect status information of the button element; When the state information indicates that the button element is valid, performing a click operation on the button element again to detect whether a prompt message pops up; When the prompt message is detected to be popped up, a verification result indicating that the client anti-duplication verification is successful is generated.
5. The method according to claim 4, further comprising: In the case where the state information indicates that the button element is invalid, a verification result indicating that the client anti-duplication verification is successful is generated.
6. The method according to claim 4, further comprising: In the case where the prompt message is not detected to be popped up, a verification result indicating that the client anti-recheck has failed is generated.
7. The method according to claim 1, wherein: The attribute information includes at least one of the following: uniform resource locator text information and user local terminal data.
8. The method according to claim 1, further comprising: In the case that the first response information fails to match the first assertion information, the simulation request information is regenerated until the first response information corresponding to the simulation request information successfully matches the first assertion information.
9. The method according to claim 1, wherein: The generating a server-side anti-duplicate verification result according to the second response information and the second assertion information includes: If the second response information matches the second assertion information successfully, generating a verification result indicating that the server-side anti-duplicate verification is successful; or In the event that the second response information fails to match the second assertion information, a verification result indicating that the server-side anti-duplication verification has failed is generated.
10. An anti-duplicate mechanism verification system, comprising: A construction module, used to construct a request message sequence list according to a button element in a target web page and a request message associated with the button element; A first generating module, configured to generate first assertion information and second assertion information associated with the button element according to the request message sequence table, wherein the first assertion information is different from the second assertion information; A second generating module is used to generate simulated request information according to the attribute information of the button element and the request message when the anti-duplicate check of the client page succeeds, wherein the attribute information and the request message are obtained by crawling the client page; A first acquisition module, used to execute a click operation on the button element to acquire first response information corresponding to the simulation request information; A second acquisition module is used to perform a click operation on the button element again to acquire second response information corresponding to the simulation request information when the first response information successfully matches the first assertion information, wherein the successful matching of the first response information with the first assertion information is used to indicate that the simulation request information is successfully sent and meets a predetermined condition; The third generation module is used to generate a server-side anti-duplication verification result according to the second response information and the second assertion information, wherein the successful matching of the second response information and the second assertion information is used to indicate that the server-side anti-duplication verification is successful.
11. An electronic device, comprising: one or more processors; a memory for storing one or more instructions, Wherein, when the one or more instructions are executed by the one or more processors, the one or more processors are enabled to implement the method according to any one of claims 1 to 9.
12. A computer-readable storage medium having executable instructions stored thereon, which, when executed by a processor, enables the processor to implement the method according to any one of claims 1 to 9.
13. A computer program product, comprising computer executable instructions, which when executed are used to implement the method of any one of claims 1 to 9.
