Method, device and equipment for determining test case and readable medium
Through automated methods of detecting pages, identifying interactive elements and generating test cases, the problems of high cost of generating test cases and insufficient coverage in the existing technology are solved, and efficient and automated test case generation is achieved to adapt to programming language changes and unpublished pages test requirements.
Patent Information
- Application Number
- CN202411404611.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-09
- Publication Date
- 2025-01-03
AI Technical Summary
When generating test cases, manual writing or recording leads to high costs, higher maintenance costs, and difficult to cover all possible interaction types and boundaries, especially when programming languages change frequently, it is impossible to effectively generate unpublished pages. Test cases.
By detecting the page, determining the interactive page, identifying interactive elements, determining the operation path based on the interaction, generating test cases to test page attributes, and automating the interaction with machine learning models and event listening functions to reduce manual intervention.
It realizes automatic generation of test cases, reduces costs, promptly detects page exceptions, covers richer test scenarios, adapts to programming language changes, and is suitable for unpublished pages.
Smart Images

Figure CN119248652A_ABST
Abstract
Description
Technical Field
[0001] Example embodiments of the present disclosure generally relate to the field of computer technology, and more particularly, to a method, apparatus, device, and computer-readable storage medium for determining a test case. Background Art
[0002] With the update and upgrade of Web (World Wide Web) technology, page testing is a very important link. Page testing can be used to test the functionality, compatibility, security, performance and other aspects of the page. Summary of the invention
[0003] In a first aspect of the present disclosure, a method for determining a test case is provided. The method comprises: determining an interactive page for generating a test case for page detection; determining at least one interactive element from the interactive page; determining at least one operation path based on an interactive operation associated with the at least one interactive element, the at least one operation path indicating an operation line determined based on the interactive operation; and determining a test case for the interactive page based on the at least one operation path, the test case being configured to test a page attribute of the interactive page.
[0004] In a second aspect of the present disclosure, a device for determining a test case is provided. The device includes: a detection module configured to detect a page and determine an interactive page for generating a test case; a determination module configured to determine at least one interactive element from the interactive page; an interaction module configured to determine at least one operation path based on an interactive operation associated with at least one interactive element, wherein the at least one operation path indicates an operation line determined based on the interactive operation; and an execution module configured to determine a test case for the interactive page based on the at least one operation path, wherein the test case is configured to test the page attributes of the interactive page.
[0005] In a third aspect of the present disclosure, an electronic device is provided. The electronic device includes at least one processing unit; and at least one memory, the at least one memory is coupled to the at least one processing unit and stores instructions for execution by the at least one processing unit, and when the instructions are executed by the at least one processing unit, the electronic device executes the method of the first aspect of the present disclosure.
[0006] In a fourth aspect of the present disclosure, a computer-readable storage medium is provided, wherein a computer program is stored on the computer-readable storage medium, and the computer program can be executed by a processor to perform the method according to the first aspect of the present disclosure.
[0007] In a fifth aspect of the present disclosure, a computer program product is provided, comprising computer executable instructions, wherein the computer executable instructions can be executed by a processor to perform the method according to the first aspect of the present disclosure.
[0008] It should be understood that the contents described in the summary of the invention are not intended to limit the key features or important features of the embodiments of the present disclosure, nor are they intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0009] In the following, in conjunction with the accompanying drawings and with reference to the following detailed description, the above and other features, advantages and aspects of various implementations of the present disclosure will become more apparent. In the accompanying drawings, the same or similar reference numerals represent the same or similar elements, wherein:
[0010] Figure 1 A schematic diagram showing an example environment in which embodiments of the present disclosure can be implemented;
[0011] Figure 2 A flowchart showing a process of determining a test case according to some embodiments of the present disclosure is shown;
[0012] Figure 3 A flowchart showing a process of determining a test case according to some embodiments of the present disclosure is shown;
[0013] Figure 4 A schematic structural block diagram of an apparatus for determining a test case according to some embodiments of the present disclosure is shown; and
[0014] Figure 5 A block diagram of an electronic device is shown in which one or more embodiments of the present disclosure may be implemented. DETAILED DESCRIPTION
[0015] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although some embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as being limited to the embodiments described herein. On the contrary, these embodiments are provided to provide a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not intended to limit the scope of protection of the present disclosure.
[0016] In the description of the embodiments of the present disclosure, the term "including" and similar terms should be understood as open inclusion, that is, "including but not limited to". The term "based on" should be understood as "based at least in part on". The term "one embodiment" or "the embodiment" should be understood as "at least one embodiment". The term "some embodiments" should be understood as "at least some embodiments". Other explicit and implicit definitions may also be included below.
[0017] It should be noted that the acquisition, storage and application of user personal information involved in the technical solution of the present disclosure are in compliance with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0018] It is understandable that before using the technical solutions disclosed in the embodiments of the present disclosure, the types, scope of use, usage scenarios, etc. of the personal information involved in the present disclosure should be informed to the user and the user's authorization should be obtained in an appropriate manner in accordance with relevant laws and regulations.
[0019] For example, in response to receiving an active request from a user, a prompt message is sent to the user to clearly prompt the user that the operation requested to be performed will require obtaining and using the user's personal information, so that the user can independently choose whether to provide personal information to software or hardware such as electronic devices, applications, servers or storage media that execute operations of the technical solution of the present disclosure based on the prompt message.
[0020] As an optional but non-limiting implementation, in response to receiving an active request from the user, the prompt information is sent to the user in a manner such as a pop-up window, in which the prompt information can be presented in text form. In addition, the pop-up window can also carry a selection control for the user to choose "agree" or "disagree" to provide personal information to the electronic device.
[0021] Traditionally, the solution for determining test cases mainly generates test cases in three ways. The first is to generate test cases through programming languages and interactive pages written by relevant technicians. Specifically, some methods can be used to navigate to the login page, enter credentials in the username and password fields, click the login button, wait for page navigation, and verify whether the login is successful. For example, the page.goto method, page.fill method, page.click method, page.waitForNavigation method, and expect method are used to complete the above operations. Then further verify whether there is a specific element (for example, a welcome message) on the page. The second method is to record and generate a document through a recording tool (which can be determined based on a browser plug-in). Specifically, the pages visited by the user and the operations related to the page are recorded until the user clicks to end the recording. After the recording is completed, the tool automatically generates the parts of the above test cases except the assertion. When the user clicks on the page to assert the type and the corresponding element, the recording tool can generate the corresponding type assertion. The third method is to generate a test case script based on the user operation by collecting and recording the user's page operation.
[0022] However, the above three methods use manually written or recorded test cases, which leads to high costs for writing and maintaining test cases, especially when the programming language changes frequently. In addition, the types of interactions that relevant technicians write test cases based on conventional business understanding are limited, and there may be boundary conditions that are not considered. Moreover, for unpublished pages, there are no real users, and test cases cannot be generated by recording user operations.
[0023] In view of this, an embodiment of the present disclosure provides a solution for determining test cases. The solution includes: determining an interactive page for generating a test case for page detection; determining at least one interactive element from the interactive page; determining at least one operation path based on an interactive operation associated with at least one interactive element, at least one operation path indicating an operation line determined based on the interactive operation; and determining a test case for the interactive page based on at least one operation path, the test case being configured to test the page attributes of the interactive page. In this way, page anomalies can be discovered in a timely manner, and the cost of determining test cases can also be reduced.
[0024] Figure 1 A schematic diagram of an example environment 100 is shown in which embodiments of the present disclosure can be implemented.
[0025] like Figure 1 As shown, the electronic device 110 can determine the test case 120 based on the received interactive page 112. In some embodiments, the interactive page 112 can be received from the user. In some embodiments, the electronic device 110 determines the interactive page 112 based on at least a page link. In some embodiments, the test case can be configured to test the page attributes of the interactive page. In some embodiments, the page attributes of the interactive page include at least one of function, performance, security, compatibility, and ease of use.
[0026] The electronic device 110 may include any computing system with computing capabilities, such as various computing devices / systems, terminal devices, server devices, etc. The terminal device may be any type of mobile terminal, fixed terminal or portable terminal, including a mobile phone, a desktop computer, a laptop computer, a notebook computer, a netbook computer, a tablet computer, a media computer, a multimedia tablet, a handheld computer, a portable game terminal, a VR / AR device, a personal communication system (PCS) device, a personal navigation device, a personal digital assistant (PDA), an audio / video player, a digital camera / camcorder, a positioning device, a television receiver, a radio broadcast receiver, an e-book device, a game device, or any combination of the foregoing, including accessories and peripherals of these devices or any combination thereof.
[0027] It should be understood that the structure and function of the various elements in the environment 100 are described for exemplary purposes only and do not imply any limitation on the scope of the present disclosure.
[0028] Some example embodiments of the present disclosure will be described below with continued reference to the accompanying drawings.
[0029] Figure 2 FIG. 2 is a flowchart of a process 200 for determining a test case according to some embodiments of the present disclosure. The process 200 may be implemented at the electronic device 110. For ease of discussion, reference will be made to FIG. Figure 1 The process 200 is described with reference to the environment 100 of FIG.
[0030] In some embodiments, the electronic device 110 can determine the interactive page 112 for generating the test case 120 for page detection. In other embodiments, the interactive page 112 can be determined based on at least a page link. In some examples, the electronic device 110 can also determine the interactive page 112 based on at least one of the page link and the page login state, the page component library, and the Playwright test framework related configuration. In some examples, the page link and other page information (such as the page login state, the page component library, and the Playwright test framework related configuration) can be received from the user. That is, in the case where the user provides more page information, the electronic device 110 can access the interactive page 112 with richer page information. In some examples, after receiving the page link and other page information, the electronic device 110 can first generate a part of the test case 120 based on the interactive page 112 determined by the page link, and then generate another part of the test case 120 based on the interactive page 112 determined by the page link and other page information.
[0031] At block 210 , the electronic device 110 accesses the interactive page 112 .
[0032] In some embodiments, when the electronic device 110 receives a page link, the interactive page 112 can be accessed based on the page link. In other embodiments, when the electronic device 110 receives a page link and other page information (such as the login state of the page), the interactive page 112 can be accessed based on the page link and other page information.
[0033] In some embodiments, the electronic device 110 may record the interactive page request, return value, and unstored interface data of the interactive page 112 during the process of accessing the interactive page 112. Specifically, when receiving new interface data, the electronic device 110 may first determine whether the new interface data is stored interface data. If the electronic device 110 determines that the new interface data is stored interface data, the stored interface data may be used to replace the new interface data. If the electronic device 110 determines that the new interface data is unstored interface data, the new interface data may be stored.
[0034] In some embodiments, the electronic device 110 may determine at least one interactive element from the interactive page 112. In some examples, the interactive element may include at least one of a link element, a button element, a form element, an a tag, a button, an input box, a selector, and a text area output box. In some examples, the interactive element may also be associated with an interactive event. Specifically, the interactive event may include at least one of a click event, a hover event, a scroll event, a drag event, and a focus event.
[0035] At block 220 , the electronic device 110 identifies an interactable element.
[0036] In some embodiments, the electronic device 110 can determine from the interactive page 112 a first set of candidate elements that match a predetermined selector group for selecting interactive elements of a predetermined style in the interactive page 112. In some examples, the first candidate elements in the first set of candidate elements may include at least one of a link, a button, a form element, an anchor element (a) tag, a button, an input box, a selector, and an output box (textarea). In some examples, a list of elements in a document that matches a specified selector group can be returned by the "Document.querySelectorAll()" method. That is, the "Document.querySelectorAll()" method can be used to determine the first set of candidate elements. It can be understood that this is merely exemplary and not restrictive.
[0037] In some embodiments, the electronic device 110 can determine a second set of candidate elements associated with at least one interactive event from the interactive page 112, and the at least one interactive event can indicate a condition for triggering a corresponding interactive operation on the interactive page 112. In some examples, the interactive event may include at least one of a click event, a hover event, a scroll event, a drag event, and a drag event. In some examples, a click event may be triggered when a click operation is detected. In some examples, a hover event may be triggered when the cursor is moved in or removed. In some examples, a scroll event is triggered when the document view is scrolled. In some examples, a drag event may be triggered when an element is dragged or text is selected. In addition, a focus event may be triggered when focus is acquired through an element.
[0038] In some embodiments, the electronic device 110 may determine the interactive element as the second candidate element in the process of binding the interactive element of the interactive page 112 to at least one interactive event based on the updated event listening function. In some examples, the event listening function (e.g., event listener) may be determined by the "addEventListener()" method. In some examples, the updated event listening function may be determined by a written programming language (e.g., JavaScript). Then, the electronic device 110 may determine the second candidate element set based on the second candidate element.
[0039] In some embodiments, the electronic device 110 may use a machine learning model to determine a third set of candidate elements from an image associated with the interactive page 112. In some examples, the machine learning model may indicate a machine learning model with large-scale parameters and complex computing structures. For example, the machine learning model may indicate an OpenAI model. It can be understood that this is merely exemplary and not restrictive. In some embodiments, the electronic device 110 may use a machine learning model to determine at least one interactive element and element coordinates from an image. The electronic device 110 may determine a third candidate element based on the element coordinates. In some examples, the image associated with the interactive page 112 may indicate a screenshot of the interactive page 112. It can be understood that this is merely exemplary and not restrictive. In some examples, the element coordinates may indicate the coordinates of the element in the image associated with the interactive page 112. Then, the electronic device 110 may determine a third set of candidate elements based on the third candidate element.
[0040] After determining the first candidate element set, the second candidate element set and the third candidate element set, the electronic device 110 may perform a deduplication operation on the candidate elements in the first candidate element set, the second candidate element set and the third candidate element set to obtain at least one interactive element.
[0041] In some embodiments, the electronic device 110 determines the operation interaction page based on at least one interactive element. In some examples, the electronic device 110 may determine the first layer operation A layer based on at least one interactive element.
[0042] In box 230, the electronic device 110 determines the operation interaction page.
[0043] In some embodiments, the electronic device 110 determines at least one operation execution page based on the operation interaction page, and each operation execution page corresponds to an interactive element. In some examples, in the operation interaction page, each interactive element in at least one interactive element can correspond to a number, such as A1click, A2hover, A3click, A4scroll, etc. Specifically, A1Click can represent the first click operation of layer A.
[0044] In box 240, the electronic device 110 performs the interactive operations associated with the corresponding interactive elements on each operation execution page.
[0045] In some embodiments, at least one interactive element of the interactive page can perform a corresponding interactive operation according to the number. Then, during the execution of each interactive operation, it is determined whether there is a page change and whether the operation number threshold is exceeded. That is, block 250 is executed.
[0046] At block 250 , the electronic device 110 determines whether there is a page change and whether a threshold number of operations is exceeded.
[0047] In some embodiments, the interactive page change indicates at least one of a page element change, an interactive page image change, a Uniform Resource Locator (URL) change, and a data storage method change. In some examples, the data storage method may indicate local storage. It is understood that this is merely exemplary and not restrictive.
[0048] In some embodiments, if there is no interactive page change after performing an interactive operation or the number of interactive operations performed reaches an operation number threshold, the electronic device 110 determines at least one operation path, that is, executes block 270. In some examples, the operation path can be represented as "A5click-B3input-C1click".
[0049] In some embodiments, if there is an interactive page change after the electronic device 110 performs an interactive operation and the number of interactive operations performed does not reach the operation number threshold, box 260 is executed.
[0050] In block 260 , the electronic device 110 records the current interaction operation as a historical interaction operation.
[0051] After the current interaction operation is recorded as a historical interaction operation, block 265 is executed.
[0052] In block 265 , the electronic device 110 determines whether there are newly added interactable elements.
[0053] In some examples, if the electronic device 110 determines that there are newly added interactive elements, the newly added interactive elements can be identified. In some examples, the newly identified interactive elements can be processed in the hierarchy after the operation based on A1. That is, after executing the first interactive element A1, the newly added interactive element can be identified and the interactive operation corresponding to the newly added interactive element can be performed on the newly opened operation execution page (e.g., layer B). In addition, layer B includes interactive element A1 and newly added interactive element B1. Then, after opening layer B, the interactive operation corresponding to interactive element A1 is executed first, and then the interactive operation corresponding to interactive element B1 is executed. And so on, until all operations have no interactive page changes or the number of interactive operations executed does not reach the operation number threshold. For example, A1, A1-B1, A1-B1-C1...A2, A2-B1, A2-B2, etc. will be executed in sequence. It can be understood that this is merely exemplary and not restrictive. In addition, a similar processing procedure as that of the interactive element A1 is performed for each newly added interactive element (eg, the interactive element B1 ).
[0054] At block 270 , the electronic device 110 records the operation path.
[0055] In some embodiments, the electronic device 110 determines at least one operation path based on the interactive operation associated with at least one interactive element, and the at least one operation path indicates an operation line determined based on the interactive operation. Then, a test case 120 can be generated based on the operation path, that is, execution block 280.
[0056] At block 280 , the electronic device 110 determines the test case 120 .
[0057] In some examples, the test case 120 can be expressed as "visit the xxx page, click the 5th interactive element in layer A, enter a random value (string, number, Boolean value, etc.) in the 3rd interactive element in layer B, and click the 1st interactive element in layer C". It will be understood that this is merely exemplary and not restrictive. In some embodiments, the test case 120 is configured to test the page properties of the interactive page 112. In some embodiments, the page properties of the interactive page 112 include at least one of the following: functionality, performance, security, compatibility, and ease of use.
[0058] Next, after the test case 120 is generated, the page screenshots, interactive elements, and URL information may be stored, ie, execution block 285 .
[0059] In box 285, the electronic device 110 executes the test case 120 and records the final URL and page screenshots.
[0060] In box 290, the electronic device 110 determines whether the new URL is consistent with the interactive page 112.
[0061] In some examples, if a different URL is visited in the interactive page 112, all of the above steps are repeated for the new URL.
[0062] In block 295 , the electronic device 110 generates a final test case 120 .
[0063] In some examples, the electronic device 110 can combine the stored interface data, test cases, page screenshots, interactive elements, and URL information to determine the complete test case 120. After the electronic device 110 generates all the test cases 120, some test cases may fail each time the front-end page changes, and the relevant technicians can determine whether the code changes exceed the scope based on the failed test cases.
[0064] In some examples, a sample table of test cases looks like this:
[0065] Table 1 Test case table
[0066]
[0067]
[0068] In other embodiments of the present disclosure, the determined interactive elements can be randomly arranged and combined. For example, if 100 interactive elements are identified and the use case interaction depth threshold is set to 10, 100×10 use case combinations will be generated. This example method is suitable for use when there are fewer interactive elements, and the test cases obtained are more comprehensive. In other embodiments of the present disclosure, all interactive elements can also be processed by preset templates. In some examples, all interactive elements are taken out, and the information corresponding to the interactive elements (type, text, etc.) is filled in the form items with the help of fakerjs or AI. Then, all form items can be used as an interactive item to participate in the full random collision. This method can effectively reduce the number of random permutations and combinations and improve the efficiency of path generation. In other examples, if a page component library is provided, the elements of the page component library that come with all interactive elements can be removed and replaced with corresponding elements. When performing the operation corresponding to the element, only the interactive operations that can be provided by the component library are performed.
[0069] In other embodiments of the present disclosure, the interaction path can be generated by collecting and recording the user's operations. In some examples, the user's operations can be collected and recorded by calling the "nplaywright codegen" method. In other embodiments of the present disclosure, artificial intelligence (AI) can be used to read requirement documents, interface documents, existing test cases, and page programming languages to generate possible interaction paths.
[0070] Continue to refer to Figure 3 The process of determining test cases is further explained.
[0071] Figure 3 FIG. 3 is a flowchart of a process 300 for determining a test case according to some embodiments of the present disclosure. The process 300 may be implemented at the electronic device 110. For ease of discussion, reference will be made to FIG. Figure 1 The process 300 is described with reference to the environment 100 of FIG.
[0072] In block 310 , for page detection, an interactive page for generating a test case is determined.
[0073] At block 320 , at least one interactable element is determined from the interactive page.
[0074] At block 330 , at least one operation path is determined based on the interaction operation associated with the at least one interactable element, the at least one operation path indicating an operation route determined based on the interaction operation.
[0075] In block 340 , a test case for the interactive page is determined based on at least one operation path, where the test case is configured to test page properties of the interactive page.
[0076] In some embodiments, based on the interactive operation associated with at least one interactive element, determining at least one operation path includes: determining an operation interaction page based on the at least one interactive element; determining at least one operation execution page based on the operation interaction page, each operation execution page corresponding to an interactive element; on each operation execution page, respectively executing the interactive operations associated with the corresponding interactive element; determining at least one operation path in response to no change in the interactive page after performing the interactive operation or the number of interactive operations executed reaching an operation number threshold.
[0077] In some embodiments, determining at least one interactive element from an interactive page includes: determining from the interactive page a first set of candidate elements that matches a predetermined selector group for selecting interactive elements of a predetermined style in the interactive page, and a second set of candidate elements associated with at least one interactive event, the at least one interactive event indicating a condition for triggering a corresponding interactive operation on the interactive page; using a machine learning model, determining a third set of candidate elements from an image associated with the interactive page; and performing a deduplication operation on the candidate elements in the first set of candidate elements, the second set of candidate elements, and the third set of candidate elements to obtain at least one interactive element.
[0078] In some embodiments, using a machine learning model to determine a third set of candidate elements from an image associated with an interactive page includes: using a machine learning model to determine at least one interactive element and element coordinates from the image; based on the element coordinates, determining a third candidate element; and based on the third candidate element, determining a third set of candidate elements.
[0079] In some embodiments, determining a second set of candidate elements associated with at least one interactive event from an interactive page includes: based on an updated event listening function, in the process of binding an interactive element of the interactive page with at least one interactive event, determining the interactive element as a second candidate element; and determining a second set of candidate elements based on the second candidate element.
[0080] In some embodiments, the interactive page is determined based at least on the page link.
[0081] In some embodiments, the interactive page change indicates at least one of the following: a page element change, an interactive page image change, a uniform resource locator change, and a data storage method change.
[0082] In some embodiments, each of the at least one interactive element corresponds to a number, and at least one interactive element on the operation interaction page performs a corresponding interactive operation according to the number.
[0083] In some embodiments, determining an interactive page for generating a test case includes: in the process of accessing the interactive page, recording an interactive page request, a return value, and unstored interface data of the interactive page.
[0084] In some embodiments, the page attributes of the interactive page include at least one of the following: functionality, performance, security, compatibility, and ease of use.
[0085] In summary, the embodiments of the present disclosure determine test cases based on the received interactive pages, and can use the test cases to test the properties of the interactive pages (such as functions, performance, security, compatibility, and usability), so that page anomalies can be discovered in time when problems occur on the interactive pages, and the cost of determining test cases can be reduced. In addition, the embodiments of the present disclosure generate test cases from the perspective of programming languages, covering richer test scenarios.
[0086] The embodiments of the present disclosure also provide corresponding devices for implementing the above methods or processes.
[0087] Figure 4 A schematic structural block diagram of an apparatus 400 for determining a test case according to some embodiments of the present disclosure is shown. The apparatus 400 may be implemented as or included in the electronic device 110. Each module / component in the apparatus 400 may be implemented by hardware, software, firmware, or any combination thereof.
[0088] like Figure 4 As shown, the device 400 includes a detection module 410, which is configured to detect the page and determine the interactive page for generating the test case. The device 400 also includes a determination module 420, which is configured to determine at least one interactive element from the interactive page. The device 400 also includes an interaction module 430, which is configured to determine at least one operation path based on the interactive operation associated with at least one interactive element, and the at least one operation path indicates an operation line determined based on the interactive operation; the device 400 also includes an execution module 440, which is configured to determine a test case for the interactive page based on the at least one operation path, and the test case is configured to test the page attributes of the interactive page.
[0089] In some embodiments, the interaction module 430 is also configured to determine an operation interaction page based on at least one interactive element; determine at least one operation execution page based on the operation interaction page, each operation execution page corresponding to an interactive element; on each operation execution page, respectively execute the interactive operations associated with the corresponding interactive element; in response to no change in the interactive page after performing the interactive operation or the number of interactive operations executed reaching an operation number threshold, determine at least one operation path.
[0090] In some embodiments, the determination module 420 is also configured to determine from the interactive page a first set of candidate elements that match a predetermined selector group for selecting interactive elements of a predetermined style in the interactive page, and a second set of candidate elements associated with at least one interactive event, wherein the at least one interactive event indicates a condition for triggering a corresponding interactive operation on the interactive page; determine a third set of candidate elements from an image associated with the interactive page using a machine learning model; and perform a deduplication operation on the candidate elements in the first set of candidate elements, the second set of candidate elements, and the third set of candidate elements to obtain at least one interactive element.
[0091] In some embodiments, the determination module 420 is further configured to determine at least one interactive element and element coordinates from the image using a machine learning model; determine a third candidate element based on the element coordinates; and determine a third candidate element set based on the third candidate element.
[0092] In some embodiments, the determination module 420 is also configured to determine the interactive element as a second candidate element based on the updated event listening function in the process of binding the interactive element of the interactive page with at least one interactive event; and determine a second candidate element set based on the second candidate element.
[0093] In some embodiments, the interactive page is determined based at least on the page link.
[0094] In some embodiments, the interactive page change indicates at least one of the following: a page element change, an interactive page image change, a uniform resource locator change, and a data storage method change.
[0095] In some embodiments, each of the at least one interactive element corresponds to a number, and at least one interactive element on the operation interaction page performs a corresponding interactive operation according to the number.
[0096] In some embodiments, the detection module 410 is further configured to record the interactive page request, return value, and unstored interface data of the interactive page during the process of accessing the interactive page.
[0097] In some embodiments, the page attributes of the interactive page include at least one of the following: functionality, performance, security, compatibility, and ease of use.
[0098] The units and / or modules included in the device 400 can be implemented in various ways, including software, hardware, firmware, or any combination thereof. In some embodiments, one or more units and / or modules can be implemented using software and / or firmware, such as machine executable instructions stored on a storage medium. In addition to or as an alternative to machine executable instructions, some or all of the units and / or modules in the device 400 can be implemented at least in part by one or more hardware logic components. As an example and not limitation, exemplary types of hardware logic components that can be used include field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), and the like.
[0099] It should be understood that one or more steps in the above method can be performed by a suitable electronic device or a combination of electronic devices. Such an electronic device or a combination of electronic devices may include, for example, Figure 1 The electronic device 110 in.
[0100] Figure 5 1 shows a block diagram of an electronic device 500 in which one or more embodiments of the present disclosure may be implemented. It should be understood that Figure 5 The electronic device 500 shown is merely exemplary and should not constitute any limitation on the functionality and scope of the embodiments described herein. Figure 5 The electronic device 500 shown can be used to implement Figure 1 electronic device 110 or Figure 4 Device 400.
[0101] like Figure 5 As shown, the electronic device 500 is in the form of a general electronic device. The components of the electronic device 500 may include, but are not limited to, one or more processors or processing units 510, a memory 520, a storage device 530, one or more communication units 540, one or more input devices 550, and one or more output devices 560. The processing unit 510 may be an actual or virtual processor and is capable of performing various processes according to a program stored in the memory 520. In a multi-processor system, multiple processing units execute computer executable instructions in parallel to improve the parallel processing capability of the electronic device 500.
[0102] The electronic device 500 typically includes a plurality of computer storage media. Such media may be any available media accessible to the electronic device 500, including but not limited to volatile and non-volatile media, removable and non-removable media. The memory 520 may be a volatile memory (e.g., registers, caches, random access memory (RAM)), a non-volatile memory (e.g., a read-only memory (ROM), an electrically erasable programmable read-only memory (EEPROM), flash memory), or some combination thereof. The storage device 530 may be a removable or non-removable medium, and may include a machine-readable medium, such as a flash drive, a disk, or any other medium, which may be capable of being used to store information and / or data and may be accessed within the electronic device 500.
[0103] The electronic device 500 may further include additional removable / non-removable, volatile / non-volatile storage media. Figure 5 As shown in , a disk drive for reading or writing from a removable, non-volatile disk (e.g., a "floppy disk") and an optical drive for reading or writing from a removable, non-volatile optical disk may be provided. In these cases, each drive may be connected to the bus (not shown) by one or more data media interfaces. The memory 520 may include a computer program product 525 having one or more program modules that are configured to perform various methods or actions of various embodiments of the present disclosure.
[0104] The communication unit 540 implements communication with other electronic devices through a communication medium. Additionally, the functions of the components of the electronic device 500 can be implemented in a single computing cluster or multiple computing machines that can communicate through a communication connection. Therefore, the electronic device 500 can operate in a networked environment using a logical connection with one or more other servers, a network personal computer (PC), or another network node.
[0105] The input device 550 may be one or more input devices, such as a mouse, a keyboard, a tracking ball, etc. The output device 560 may be one or more output devices, such as a display, a speaker, a printer, etc. The electronic device 500 may also communicate with one or more external devices (not shown) through the communication unit 540 as needed, such as a storage device, a display device, etc., communicate with one or more devices that allow a user to interact with the electronic device 500, or communicate with any device that allows the electronic device 500 to communicate with one or more other electronic devices (e.g., a network card, a modem, etc.). Such communication may be performed via an input / output (I / O) interface (not shown).
[0106] According to an exemplary implementation of the present disclosure, a computer-readable storage medium is provided, on which computer-executable instructions are stored, wherein the computer-executable instructions are executed by a processor to implement the method described above. According to an exemplary implementation of the present disclosure, a computer program product is also provided, which is tangibly stored on a non-transitory computer-readable medium and includes computer-executable instructions, and the computer-executable instructions are executed by a processor to implement the method described above.
[0107] Various aspects of the present disclosure are described herein with reference to the flowcharts and / or block diagrams of the methods, devices, equipment, and computer program products implemented according to the present disclosure. It should be understood that each box in the flowchart and / or block diagram and the combination of each box in the flowchart and / or block diagram can be implemented by computer-readable program instructions.
[0108] These computer-readable program instructions can be provided to a processing unit of a general-purpose computer, a special-purpose computer, or other programmable data processing device, thereby producing a machine, so that when these instructions are executed by the processing unit of the computer or other programmable data processing device, a device that implements the functions / actions specified in one or more boxes in the flowchart and / or block diagram is generated. These computer-readable program instructions can also be stored in a computer-readable storage medium, and these instructions cause the computer, programmable data processing device, and / or other equipment to work in a specific manner, so that the computer-readable medium storing the instructions includes a manufactured product, which includes instructions for implementing various aspects of the functions / actions specified in one or more boxes in the flowchart and / or block diagram.
[0109] Computer-readable program instructions can be loaded onto a computer, other programmable data processing apparatus, or other device so that a series of operational steps are performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, so that the instructions executed on the computer, other programmable data processing apparatus, or other device implement the functions / actions specified in one or more boxes in the flowchart and / or block diagram.
[0110] The flow chart and block diagram in the accompanying drawings show the possible architecture, function and operation of the system, method and computer program product according to multiple implementations of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a part of a module, program segment or instruction, and a part of a module, program segment or instruction includes one or more executable instructions for realizing the logical function of the specification. In some implementations as replacements, the function marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two continuous square boxes can actually be executed substantially in parallel, and they can sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be realized by a special hardware-based system that performs the function or action of the specification, or can be realized by a combination of special hardware and computer instructions.
[0111] The above descriptions of various implementations of the present disclosure are exemplary, non-exhaustive, and not limited to the disclosed implementations. Many modifications and variations will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described implementations. The selection of terms used herein is intended to best explain the principles of the implementations, practical applications, or improvements to the technology in the market, or to enable other persons of ordinary skill in the art to understand the various implementations disclosed herein.
Claims
1. A method for determining a test case, comprising: For page detection, determine the interactive page used to generate test cases; Determining at least one interactive element from the interactive page; Determining at least one operation path based on an interactive operation associated with the at least one interactable element, the at least one operation path indicating an operation route determined based on the interactive operation; as well as Based on the at least one operation path, a test case for the interactive page is determined, and the test case is configured to test a page attribute of the interactive page.
2. The method of claim 1 , wherein determining at least one operation path based on the interactive operation associated with the at least one interactable element comprises: Based on the at least one interactive element, determining an operation interaction page; Based on the operation interaction page, determining at least one operation execution page, each operation execution page corresponding to an interactive element; On each operation execution page, execute the interactive operations associated with the corresponding interactive elements respectively; In response to no interactive page change after the interactive operation is performed or the number of interactive operations that have been performed reaches an operation number threshold, the at least one operation path is determined.
3. The method of claim 1, wherein determining at least one interactive element from the interactive page comprises: Determining from the interactive page a first set of candidate elements that match a predetermined selector group for selecting interactive elements of a predetermined style in the interactive page and a second set of candidate elements associated with at least one interactive event, wherein the at least one interactive event indicates a condition for triggering a corresponding interactive operation on the interactive page; Determine, using a machine learning model, a third set of candidate elements from an image associated with the interactive page; as well as A deduplication operation is performed on the candidate elements in the first candidate element set, the second candidate element set, and the third candidate element set to obtain the at least one interactive element.
4. The method according to claim 3, wherein determining the third set of candidate elements from the image associated with the interactive page using a machine learning model comprises: Determine at least one interactive element and element coordinates from the image using the machine learning model; Based on the element coordinates, determining a third candidate element; as well as Based on the third candidate element, a third candidate element set is determined.
5. The method according to claim 3, wherein determining a second set of candidate elements associated with at least one interaction event from the interaction page comprises: Based on the updated event listening function, in the process of binding the interactive element of the interactive page with the at least one interactive event, determining the interactive element as a second candidate element; as well as Based on the second candidate element, a second candidate element set is determined. The method according to claim 1 , wherein the interactive page is determined based at least on a page link.
7. The method according to claim 2, wherein the interactive page change indicates at least one of the following: a page element change, an interactive page image change, a uniform resource locator change, and a data storage method change.
8. The method according to claim 1, wherein each of the at least one interactive element corresponds to a number, and on the operation interaction page, the at least one interactive element performs a corresponding interactive operation according to the number.
9. The method according to claim 2, wherein determining an interactive page for generating a test case comprises: In the process of accessing the interactive page, the interactive page request, return value and unstored interface data of the interactive page are recorded.
10. The method according to claim 1, wherein the page attributes of the interactive page include at least one of the following: Functionality, performance, security, compatibility, and ease of use.
11. A device for determining a test case, comprising: The detection module is configured to detect the page and determine the interactive page for generating the test case; A determination module, configured to determine at least one interactive element from the interactive page; an interaction module configured to determine at least one operation path based on an interaction operation associated with the at least one interactable element, the at least one operation path indicating an operation line determined based on the interaction operation; as well as The execution module is configured to determine a test case for the interactive page based on the at least one operation path, and the test case is configured to test a page attribute of the interactive page.
12. An electronic device comprising: at least one processing unit; as well as At least one memory, the at least one memory is coupled to the at least one processing unit and stores instructions for execution by the at least one processing unit, the instructions, when executed by the at least one processing unit, causing the electronic device to perform the method according to any one of claims 1 to 10.
13. A computer-readable storage medium having a computer program stored thereon, wherein the computer program can be executed by a processor to implement the method according to any one of claims 1 to 10.
14. A computer program product comprising computer executable instructions, wherein the computer executable instructions, when executed by a processor, implement the method according to any one of claims 1 to 10.
