Method and apparatus for testing application, and device, medium and program product
By sending the application page state to the server and generating target transformation commands using a directed graph of state transitions, the application state transformation is automatically implemented. This solves the problems of time-consuming reading of technical documents and difficulties in communication and understanding during the development process, thereby improving application development efficiency and user experience.
Patent Information
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Filing Date
- 2024-09-14
- Publication Date
- 2026-03-19
AI Technical Summary
Existing software development models rely on technical documentation, which causes developers to spend a lot of time reading and understanding the documentation. Furthermore, differences in the ability of front-end, back-end, and testers to understand the documentation lead to communication difficulties, affecting testing efficiency and schedule.
By sending the application's page state to the server and generating target transition commands using a directed graph of state transitions, the application state can be automatically changed, improving debugging and testing efficiency.
It accelerated application development, improved user experience, reduced communication and comprehension difficulties during testing, and increased testing efficiency.
Smart Images

Figure CN2024119179_19032026_PF_FP_ABST
Abstract
Description
Method, device, equipment, medium and program product for testing an application TECHNICAL FIELD
[0001] Embodiments of the present disclosure generally relate to the field of application development, and in particular, to a method, device, equipment, medium and program product for testing an application. BACKGROUND
[0002] Currently, techniques for testing an application are increasingly valued by developers. The current common software development mode usually needs to rely on relevant technical documents, which are usually written based on text and have strong technicality and logicality. Developers read the relevant technical documents to develop software.
[0003] With the development of application testing techniques, the writing of technical documents before the development process and the arrangement of document contents have been optimized several times. With continuous optimization, the readability and logicality of technical documents have been significantly improved, so that front-end developers, back-end developers and testers involved in the development process can better use technical documents to speed up the development of the application.
[0004] SUMMARY
[0005] Embodiments of the present disclosure provide a method, device, equipment, medium and program product for testing an application.
[0006] According to a first aspect of the present disclosure, a method for testing an application is provided. The method comprises sending, to a server, a first state of an application running on a terminal, the first state being a state related to a page of the application. The method further comprises receiving, from the server, a target transition command based on the sending of the first state, the target transition command being determined based on a state transition directed graph for the application, the state transition directed graph comprising a set of states related to the page of the application and a set of operation sequences for implementing state transitions. The method further comprises generating, based on the first state and the target transition command, a second state of the application to implement testing of the application.
[0007] According to a second aspect of the present disclosure, a method for testing an application is provided. The method comprises determining a target execution sequence related to a state transition directed graph, the state transition directed graph comprising a set of states related to a page of the application and a set of operation sequences for implementing state transitions. The method further comprises receiving a first state from a terminal, the first state being a state related to the page of the application running on the terminal. The method further comprises determining, based on the first state and the target execution sequence, a target transition command for transitioning the first state to a second state. The method further comprises sending the target transition command to the terminal to implement testing of the application.
[0008] In a third aspect of the present disclosure, an apparatus for testing an application is provided. The apparatus includes a first state sending module configured to send a first state of an application running on a terminal to a server, the first state being a state related to a page of the application; a target transition command receiving module configured to receive a target transition command from the server based on the sending of the first state, the target transition command being determined based on a state transition directed graph for the application, the state transition directed graph including a set of states related to pages of the application and a set of operation sequences for implementing state transitions; and a second state generating module configured to generate a second state of the application based on the first state and the target transition command to implement testing of the application.
[0009] In a fourth aspect of the present disclosure, an apparatus for testing an application is provided. The apparatus includes a target execution sequence determining module configured to determine a target execution sequence related to a state transition directed graph, the state transition directed graph including a set of states related to pages of the application and a set of operation sequences for implementing state transitions; a first state receiving module configured to receive a first state from a terminal, the first state being a state related to a page of an application running on the terminal; a target transition command determining module configured to determine a target transition command for transitioning the first state to a second state based on the first state and the target execution sequence; and a target transition command sending module configured to send the target transition command to the terminal to implement testing of the application.
[0010] In a fifth aspect of the present disclosure, an electronic device is provided, including at least one processor; and a storage device for storing at least one program, when the at least one program is executed by the at least one processor, the at least one processor implements the method according to the first aspect and the second aspect of the present disclosure.
[0011] In a sixth aspect of the present disclosure, a computer readable storage medium is provided, having stored thereon a computer program, which when executed by a processor implements the method according to the first aspect and the second aspect of the present disclosure.
[0012] In a seventh aspect of the present disclosure, a computer program product is provided. The computer program product includes a computer program which when executed by a processor implements the method according to the first aspect and the second aspect of the present disclosure.
[0013] It should be understood that the content described in this content part is not intended to limit key or important features of the embodiments of the present disclosure, nor to limit the scope of the present disclosure. Other features of the present disclosure will become apparent through the following description. BRIEF DESCRIPTION OF DRAWINGS
[0014] The above and other objects, features and advantages of the present disclosure will become more apparent from the following detailed description when taken in conjunction with the accompanying drawings, in which like reference characters refer to like parts throughout the figures, exemplary embodiments of the present disclosure.
[0015] FIG. 1 illustrates a schematic diagram of an example environment in which devices and / or methods of some embodiments of the present disclosure can be implemented;
[0016] FIG. 2 illustrates a schematic diagram of an example method 200 for testing an application, according to some embodiments of the present disclosure;
[0017] FIG. 3 illustrates a schematic diagram of an example method 300 for testing an application, according to some embodiments of the present disclosure;
[0018] FIG. 4 illustrates a schematic diagram of an example of a state transition directed graph for testing an application, according to some embodiments of the present disclosure;
[0019] FIG. 5 illustrates a schematic diagram of an example of a system framework for testing an application, according to some embodiments of the present disclosure;
[0020] FIG. 6 illustrates a schematic block diagram of an apparatus 600 for testing an application, according to some embodiments of the present disclosure;
[0021] FIG. 7 illustrates a schematic block diagram of an apparatus 700 for testing an application, according to some embodiments of the present disclosure;
[0022] FIG. 8 illustrates a schematic block diagram of an example device suitable for use in implementing embodiments of the present disclosure.
[0023] In the various drawings, same or corresponding reference numbers denote same or corresponding parts. DETAILED DESCRIPTION
[0024] It can be understood that the data involved in the technical solutions of the present disclosure (including but not limited to the data itself, the acquisition or use of the data) should comply with the requirements of the relevant laws and regulations and relevant provisions.
[0025] It can be understood that, before using the technical solutions disclosed in the embodiments of the present disclosure, the type of personal information involved in the present disclosure, the scope of use, the scenario of use, etc. should be informed to the user and the authorization of the user should be obtained through appropriate means according to the relevant laws and regulations.
[0026] For example, when receiving the active request of the user, prompt information is sent to the user to explicitly prompt the user that the operation requested to be executed will need to acquire and use the personal information of the user. Thus, the user can voluntarily choose whether to provide the personal information to the software or hardware such as electronic device, application program, server or storage medium, etc. that executes the operation of the technical solutions of the present disclosure according to the prompt information.
[0027] As an optional but non-limiting implementation, in response to receiving the active request of the user, the manner of sending the prompt information to the user may be, for example, a pop-up window manner, in which the prompt information may be presented in a text manner. In addition, the pop-up window may also carry a selection control for the user to select "agree" or "disagree" to provide the personal information to the electronic device.
[0028] It can be understood that the above notification and user authorization obtaining process is only illustrative and does not limit the implementation of the present disclosure, and other manners meeting the relevant laws and regulations can also be applied to the implementation of the present disclosure.
[0029] 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 drawings, it should be understood that the present disclosure can be implemented in various forms, and should not be interpreted as being limited to the embodiments set forth herein, but rather these embodiments are provided to more thoroughly and completely understand 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.
[0030] In the description of embodiments of the present disclosure, the term "comprising" and similar terms are understood to encompass open-ended inclusion, i.e., "comprising but not limited to". The term "based on" should be understood as "at least partially based on". The term "one embodiment" or "the embodiment" should be understood as "at least one embodiment". The terms "first", "second", etc. can refer to different or the same objects. Other explicit and implicit definitions can also be included below.
[0031] In the process of software development, there are still many problems to be solved. The current common software development mode usually needs to rely on related technical documents. The developer needs to spend a lot of time not only in reading the related technical documents, but also in understanding the content in the technical documents to ensure that the content is understood correctly. This development mode is relatively low in efficiency.
[0032] With the development of application testing technology, the writing of technical documents and the content of the documents have been optimized. However, in the process of application development, there are front-end developers, back-end developers and testers, and the understanding ability of the three for technical documents may be biased, which leads to difficulties in communication and understanding in the testing process, further leading to problems such as stagnation of testing progress and reduction of testing efficiency.
[0033] For example, in the debugging and testing phase, the application needs to be tested. During the testing of the application, the front-end and back-end developers and / or testers need to work together to test and debug the application. Sometimes, the test code needs to be rewritten to overcome the problem of test failure, which wastes a lot of time and reduces the efficiency of testing the application.
[0034] At least to solve the above and other potential problems, embodiments of the present disclosure propose a method for testing an application. In the method, a terminal can first send a first state of an application running on the terminal to a server. The first state is a state related to a page of the application. Since the first state is sent to the server, the terminal can subsequently receive a target transition command from the server. The target transition command is determined according to a state transition directed graph for the application, and the state transition directed graph includes a set of states related to the pages of the application and a set of operation sequences for implementing state transitions. Finally, the computing device generates a second state of the application according to the first state and the target transition command to implement the testing of the application. By this method, the automatic transformation of the state is realized by using the target transition instruction generated by the state transition directed graph, which improves the efficiency of the debugging and testing process of the application, speeds up the development of the application, and improves the user experience.
[0035] Embodiments of the present disclosure will be described in detail below with further reference to the accompanying drawings. FIG. 1 shows an example environment in which devices and / or methods of embodiments of the present disclosure can be implemented. In the environment 100, a terminal 102 first sends a first state 106 of an application 104 running on the terminal to a server 108. The first state 106 is a state related to a page presented by the application on the terminal. After the terminal 102 sends the first state to the server 108, a target transition command 112 can be received from the server 108. The target transition command 112 is determined by the server 108 according to a state transition directed graph 114 for the application 104, and the state transition directed graph includes a set of states 116 related to the pages of the application 104 and a set of operation sequences 118 for implementing state transitions. The set of states 116 includes the first state 106 and a second state 110. Then, the terminal 102 can execute the operations in the target transition command on the page presenting the first state, so that the second state of the application 104 can be generated for implementing the testing of the application.
[0036] Examples of the terminal 102 include, but are not limited to, a mobile phone (e.g., a smartphone), a laptop computer, a portable digital assistant (PDA), an electronic book (e-book) reader, a portable game console, a portable media player, a game console, a set-top box (STB), a smart television (TV), a personal computer, a laptop computer, a vehicle-mounted computer (e.g., a navigation unit), etc.
[0037] Examples of server 108 include, but are not limited to, a personal computer, a server computer, a multiprocessor system, a minicomputer, a mainframe computer, a distributed computing environment that includes any of the above systems or devices, etc.
[0038] As shown in FIG. 1, terminal 102 can first send a first state 106 of an application 104 running on terminal 102 to server 108. The first state 106 is a state related to a page of the application 102. Terminal 102 can collect the page identifier of the page in the application and some parameters of the page to generate the state of the page. In one example, the parameters can be the content entered in different text boxes or the state of buttons, etc. After terminal 102 sends the first state 106, server 108 receives the first state 106.
[0039] In some embodiments, the page identifier of the page in the application 102 is a uniform resource locator. The page identifier of the page and the parameters in the page can change according to the change of the uniform resource locator of the page, for example, when the address of the uniform resource locator changes, the page identifier of the application and the page parameters for the page also change. In some embodiments, user operations can also change the parameters in the page. For example, when an input operation is performed on a control in the page, the parameter corresponding to the control changes. For example, entering a username and password in a registration page causes the parameters of the page to change.
[0040] In some embodiments, when the page of the application changes, the state of the application also changes. For example, the current page corresponds to the first state of the application, and when the page changes or the parameters change, the application changes from the first state to other states.
[0041] After terminal 102 sends the first state 106, terminal 102 can receive a target transition command 112 from server 108. The target transition command 112 is determined by server according to the state transition directed graph 114. In addition, server 108 can also determine the target execution sequence 120 for the test application 104 from the state transition directed graph 114.
[0042] In some embodiments, the state transition directed graph 114 includes a set of states 116 and a set of operation sequences 118. The set of states 116 can include multiple states, for example, the first state 106 and the second state 110. Alternatively, the set of states 116 also includes a virtual state for a network request.
[0043] In some embodiments, the set of operation sequences can include one or more operation sequences. Each operation sequence in the set of operation sequences can include at least one operation. Each operation sequence can be used to implement the transition of two states.
[0044] In some embodiments, the server 108 first determines the target execution sequence. For example, the server 108 obtains the target execution sequence from the state transition directed graph by receiving the target state to be tested by the user from the terminal; or in the testing stage, selects one execution sequence from the set of execution sequences generated from the state transition directed graph 114 as the target execution sequence. Then, the server 108 further determines the operation sequence for the page in the terminal 102 by combining the first state with the target execution sequence, and then generates the target transition command according to the operation sequence. The server 108 sends the target transition command 112 to the terminal 102 to implement further testing.
[0045] After the terminal 102 accepts the target transition command 112, it further generates the second state 110 of the application 104 based on the first state 106 and the target transition command 112. Then the second state 110 is reported to the server 108 until the state transition in the target execution sequence is executed, thereby implementing the testing of the application.
[0046] In some embodiments, the transition of the second state is obtained by executing the operation sequence in the target transition command 112 on the page of the first state.
[0047] In some embodiments, when the page in the application is transitioned from the first state to the second state, the original page identifier and the set of parameters for the first state are changed. For example, a new page identifier and / or a new set of parameters are generated.
[0048] In some embodiments, the second state can be a virtual state indicating a network request. The virtual state can obtain different processing states for the network request. In one example, when the network request is passed, the second state is further transitioned to the state of the page that can be operated subsequently. In another example, when the network request is not passed, it is transitioned to the page state of the network request not passed. Alternatively, when the network request is not passed, a page prompt information of the network request not passed is sent to the application of the terminal.
[0049] FIG. 1 shows that the state transition directed graph 114 is arranged outside the server, which is only an example and not a specific limitation of the present disclosure. The state transition directed graph 114 can be arranged in the server 108 or any suitable computing device.
[0050] By this method, the automatic transition of the state is implemented by using the target transition command generated from the state transition directed graph, which improves the efficiency of the debugging and testing process of the application, speeds up the development of the application, and improves the user experience.
[0051] The schematic diagram of the example environment in which the apparatus and / or method of some embodiments of the present disclosure described above in connection with FIG. 1 can be implemented is shown above, and the schematic diagram of an example method 200 for testing an application according to some embodiments of the present disclosure is shown below in connection with FIG. 2. The method in FIG. 2 can be performed by the terminal 102 or any suitable device in FIG. 1.
[0052] As shown in FIG. 2, in the example method 200, at block 202, a first state 106 of an application 104 running on a terminal 102 is sent to a server 108, and the first state 106 is a state related to a page of the application 104. In some embodiments, the first state 106 is a state related to a page of the application 102.
[0053] In some embodiments, the terminal is taken as a smartphone, and the application running on the terminal is taken as a chat software. When the chat software is opened on the smartphone, the page contains multiple chat boxes, and the first state of the page of the application includes the page identifier and the parameter information, such as the information of the chat boxes.
[0054] In some embodiments, the terminal can accept one or more operations performed on the page of the application, and the one or more operations constitute an operation sequence including at least one of the following: a click operation, an input operation, or a sliding operation. The click operation represents a click on a specified element. The input operation represents an input of a specified value on a specified element. The sliding operation represents a sliding operation on a specified element in a specified direction.
[0055] In some embodiments, when a user performs a click operation on a control in the page, such as clicking on one of the multiple chat boxes in the chat software, the application is converted from the original state to a state corresponding to the page state after the chat box is expanded. Then, the terminal 102 can collect the page identifier and the corresponding parameters of the page at this time to generate the first state.
[0056] Next, at block 204, based on the sending of the first state 106, the terminal 102 receives a target conversion command 112 from the server 108. The target conversion command 112 is determined by the server 108 according to the state conversion directed graph 114 of the application 104, and the state conversion directed graph 114 includes a set of states 116 related to the page of the application 104 and a set of operation sequences 118 for implementing state conversion.
[0057] In some embodiments, the set of states includes multiple states, such as a first state and a second state, which represent the states of the page. Additionally, the set of states also includes a virtual state for a network request, which is a state associated with the page and corresponds to a network request generated by the page.
[0058] In some embodiments, the set of operation sequences also includes a plurality of operation sequences. Each operation sequence in the plurality of operation sequences is used to implement a transition between two states, and the transitions between the plurality of states can be implemented by the plurality of operation sequences in a sequential order.
[0059] In some embodiments, before determining the target transition command, the server 108 needs to determine a target execution sequence. After determining the target execution sequence, the server 108 further determines the target transition command for the terminal by combining the first state and the target execution sequence, so as to enable the terminal to implement the test on the application.
[0060] In some embodiments, when determining the target execution sequence, the server first determines a target state to be executed, and then finds the target execution sequence from the state transition directed graph according to the target state. Then, the server further determines the target transition command by combining the first state. For example, the target transition command is determined according to the first state, the target state and the set of operation sequences in the target execution sequence in the state transition directed graph. Additionally, there can be multiple execution sequences in the state transition directed graph.
[0061] Finally, at block 206, after accepting the target transition command 112, the terminal 102 further generates a second state 110 of the application 104 based on the first state 106 and the target transition command 112, so as to implement the test on the application 104. After receiving the target transition command 112, the terminal 102 can execute the operation sequence in the target transition command on the page corresponding to the first state, so as to obtain the second state of the page of the application. Therefore, the transition of the second state is implemented by changing the page identifier and / or the set of parameters in the page of the first state.
[0062] In some embodiments, when the application is transitioned from the first state to the second state, the page identifier and the set of parameters for the first state are changed. For example, a new page identifier and a second set of parameters are generated.
[0063] In some embodiments, the terminal is taken as a smart phone, and the application running on the terminal is taken as a chat software. When the chat software is opened on the smart phone, the page of the first state of the application is a page containing multiple chat boxes.
[0064] For example, the first state is that the page contains multiple chat boxes in the chat software, and the second state is a virtual state in which a network request for requesting new information is received after a downward sliding operation on the multiple chat boxes.
[0065] When the network request in the virtual state for the second state is sent to the server, the server returns a network response for the network request. In one example, the network response is successful, and the chat software sends a new message to the application through communication with the server. In another example, the network response is unsuccessful, and the chat software displays a prompt of the network request failure on the interface of the application. Additionally, the terminal can not receive an instant message (IM).
[0066] In some embodiments, when the network response for the network request in the second state is successful, if it is determined that there is a new message for the application, the application can be converted from the second state to a third state according to a page identifier in the page of the application and a set of parameters. For example, the third state is a prompt mark of receiving a new message in the chat box.
[0067] By this method, the automatic conversion of the state is realized by using the target conversion instruction generated by the state conversion directed graph, the efficiency of the debugging and testing process of the application is improved, the speed of the application development is accelerated, and the user experience is improved.
[0068] The above describes an example method 200 for testing an application according to some embodiments of the disclosure in connection with FIG. 2. The following describes an example method 300 for testing an application according to some embodiments of the disclosure in connection with FIG. 3. The example of FIG. 3 can be performed by the server 108 shown in FIG. 1 or any suitable device.
[0069] As shown in the example 300 of FIG. 3, at block 302, the server 108 first determines a target execution sequence related to the state conversion directed graph, the state conversion directed graph including a set of states related to a page of the application and a set of operation sequences for realizing the state conversion.
[0070] In some embodiments, the state conversion directed graph includes a set of states and a set of operation sequences. The set of states includes a plurality of states, each of which corresponds to a page of the application. The set of operation sequences also includes a plurality of operation sequences. Each of the plurality of operation sequences is used to realize the conversion of the state of the page.
[0071] In some embodiments, before determining the target execution sequence, it is necessary to determine a target state to be executed in the state conversion directed graph. The target state can be the second state, the third state, or other states in the state conversion directed graph. For example, the server 108 can receive a user-selected target state from the terminal 102. Alternatively, the server 108 can select a state in the state conversion directed graph as the target state.
[0072] Then, after the server 108 receives the target state of the state transition directed graph, the target execution sequence is further determined in combination with the first state and the state transition directed graph. In one example, the link between the first state and the target state is the target execution sequence.
[0073] In some embodiments, a set of states and a set of operation sequences in the state transition graph can be divided to determine a plurality of execution sequences in the state transition directed graph, and then one of the plurality of execution sequences is determined as the target execution sequence when determining a specific test for the application.
[0074] Then, at block 304, the server 108 receives the first state from the terminal 102, which is a state related to a page of the application running on the terminal. The server 108 can communicate with the application on the terminal 102 to pass information, so that the server 108 can receive the state information uploaded by the terminal 102.
[0075] Next, at block 306, the server 108 determines the target transition command for transitioning the first state to the second state based on the first state and the target execution sequence. After obtaining the first state, the server 108 can further determine the target transition command in combination with the determined target execution sequence.
[0076] The server 108 can find the first state in the target execution sequence, and then further determine the operation sequence to be executed after the first state from the target execution sequence. Additionally, the server can further determine the second state after the first state. The operation sequence is a series of user operations, which can be one or more of click operation, input operation or swipe operation.
[0077] Finally, at block 308, the server 108 sends the target transition command to the terminal 102 to implement the test of the application. After obtaining the target transition command available for the terminal, the server 108 sends it to the terminal 102 to execute the target execution sequence in the target transition command.
[0078] In some embodiments, the server 108 can further receive a second state from the terminal 102. If the second state indicates a virtual state for the network request, the network response from the virtual state to a third state can be determined according to the target execution sequence. For the network request, the state transition directed graph can set a network response therefor. For example, a "network response x" which is a network response data returned to a network request can be defined as a triple (s-x, request, response) indicating a request initiated in the s-x state of a page and returning a response; a "network timeout response" which is a special network response can also be defined as a triple (s-x, request, response of timeout) indicating a request initiated in the s-x state and returning a response of timeout.
[0079] In some embodiments, if the transition from the second state to the fourth state is implemented by a network message, the network message is sent to the terminal. For example, an "IM message x" indicating that an IM message is received in a state can be defined as a binary tuple (s-x, message).
[0080] By this method, the automatic transformation of states is implemented by using the target transition instructions generated by the state transition directed graph, the efficiency of the debugging and testing process of the application is improved, the speed of the development of the application is accelerated, and the user experience is improved.
[0081] The above describes an example method 300 for testing an application according to some embodiments of the disclosure in connection with FIG. 3. The following describes an example of a state transition directed graph for testing an application according to some embodiments of the disclosure in connection with FIG. 4.
[0082] In the example 400, the state transition directed graph is composed of an operation sequence 402, an initial state 404, an operation sequence 406, a state 408, an operation sequence 410, a network response timeout 412, a network request 414, a network response 416, a state 418, an IM message 420, a state 422, a network response 424, a state 426, a network response 428, and a state 430.
[0083] In some embodiments, when the testing of the application is performed, the application is first opened, and when the application is opened, the initial state 404 is entered by default. The "initial state" is a special state, which is a state of a page that can be directly opened by a uniform resource locator, and is one of the entrances of the entire graph. Its attribute is a uniform resource locator (URL), which can be defined as a unary tuple s-s(URL).
[0084] "State x" is a state in a mobile application. A state can be defined as a tuple of a page URL and a series of parameters. Each variable in the tuple represents an attribute of a state and can be defined as sx(URL, X1, X2, ..., Xn), where X1, X2, ..., Xn represent different parameters.
[0085] Additionally, users can customize the default state when the application opens during testing, for example, setting the default state to state 408. The above is merely a description of an example of this disclosure and is not intended to limit this disclosure.
[0086] In the directed graph of state transitions, if operation sequence 402 is executed in the initial state 404, the system returns to the initial state 404. If operation sequence 406 is executed in the initial state, the system proceeds to the next state 408. If operation sequence 410 is executed in state 408, a network request 414 can be generated, which is then treated as a virtual state. A "network request" is a virtual state representing the state that initiated the request; it is not a terminal state. However, depending on the response, it can transition to different states, so it can be defined as a virtual state, represented as a tuple consisting of the initiating state and the network request. Different network responses can then be generated for network request 414. If network response 428 is generated, the system proceeds to state 430; if network response 424 is generated, the system proceeds to state 426. If network response timeout 412 is generated, the system returns to state 408. If network response 416 is generated, the system proceeds to state 418. If an IM message 420 is further received at this point, the system proceeds to state 422.
[0087] Taking a smartphone as an example, and a chat application running on the smartphone as an example, when the chat application is opened on the smartphone, application status 408 corresponds to a page containing multiple chat boxes.
[0088] In state 408, operation sequence 410 is executed, generating network request 414. This is a network request for new information after receiving a swipe-down action in multiple chat boxes; it is a virtual state. Once the network request in the virtual state of network request 414 is sent to the server, the server returns a network response 416 for that request. In one example, network response 416 indicates success, and the application can transition from network request 414 to state 418 based on the page identifier in the application's page and a set of parameters.
[0089] When the network response 416 to the network request 414 is successful, the state 418 further determines whether there is an IM message 420 to the application. When it is determined that there is an IM message 420 to the application, the state 418 is converted to a state 422 and a corresponding new message mark is displayed on the application.
[0090] When the network response to the network request 414 fails, the server sends information of the network response timeout 412 to the network request 414 to the application.
[0091] The state 426 and the state 430 are states after the network response 424 and the network response 428 to the network request 414. The state 414 is a state corresponding to the page of the consultation after clicking the information page in the state 408. In another example, the state 430 is a state corresponding to the page of the video after clicking the video page in the state 408.
[0092] The above describes an example of a state transition directed graph for testing an application according to some embodiments of the present disclosure in combination with FIG. 4. The following describes an example of a system framework for testing an application according to some embodiments of the present disclosure in combination with FIG. 5.
[0093] In the example 500, the system framework is composed of a terminal 502, an application 504, a state driving engine 506, a server 508, a simulation service 510, a state driving service 512, an automated use case management service 514, a state graph management service (creation, execution, generation) 516, and a user 518.
[0094] The application 504 is used to execute commands on the terminal. For example, enter the initial state through a uniform resource locator, and can execute an operation sequence conversion instruction (s-x, (A1, A2,..., An)), which indicates that the operation (A1, A2,..., An) is executed on the state s-x, and then reaches the next state. The application also reports the state, and after switching the state, reports the new state to the state driving engine 506.
[0095] The state driving engine 506 is an engine located inside the terminal. The state transition directed graph is executed in the developed application 504 through the state driving engine 506. For example, when a command to enter the initial state is received, which includes a uniform resource locator, the corresponding page is opened in the terminal. When a sequence of operation transition instruction (s-x, (A1, A2,..., An)) is received, the sequence of operations (A1, A2,..., An) is executed in the application in the s-x state. The state driving engine 506 can also passively accept switching reports. When a network request or an IM message is received, the mobile application switches to a new state, at which time the state driving engine 506 identifies the current state and reports the current state.
[0096] The state graph management service 516 is used to create the state transition directed graph. The execution sequence is generated by processing the state transition graph and is delivered to the state driving engine 506 to drive execution in the mobile application. The state driving engine 506 can also process the state transition directed graph to generate multiple execution sequences and send them to the automated use case management service 514.
[0097] The state driving service 512 delivers the execution sequence of the state transition directed graph to the state driving engine 506 to execute operations in the terminal; it can also maintain the state transition directed graph in the current execution to prepare for further state switching. In addition, the state driving service 512 can also deliver return result data and IM message data to the simulation service 510 to drive the terminal application to switch states with simulation results. The simulation service 510 is used to return simulation results, such as network responses, to drive the terminal application to switch states. The simulation service 510 can also deliver IM messages to drive the terminal to switch states.
[0098] The automated use case management service 514 manages the test cases generated through the state transition graph and executes the test cases generated through the state transition graph.
[0099] Based on the previous example 400, the state transition directed graph is created by the user before developing the test for the application, and each state corresponds to a different page state of the application. After the state graph management service 516 creates the state transition directed graph, it is delivered to the state driving service 512 and stored. Alternatively, when the user modifies the state transition directed graph, the state transition directed graph stored in the state driving service 512 is also updated accordingly.
[0100] In addition, the state graph management service 516 can also generate execution sequences during testing. The execution sequences are then used to generate execution use cases and are sent to the automated use case management service 514. The execution use cases are then sent to the state driving service 512 for automatic execution. For example, the execution sequence table is constructed based on the example 4.
[0101] Table 1: Execution sequence table
[0102] In the testing phase, the above execution sequence can be sent to the state-driven service 512 through the automated case management service 514 to achieve the execution of the execution sequence through the interaction with the state-driven engine 506.
[0103] For example, for sequence 1, enter the initial state 404. For sequence 2, perform the operation sequence 402 at the initial state 404 to enter the initial state 404. For sequence 9, starting from the initial state 404, perform the operation sequence 406 to enter the state 408; perform the operation sequence 410 at the state 408 to enter the state of initiating a network request to initiate a network request. Then, according to the network response 428 returned by the network, enter the state 430.
[0104] The above describes an example of a schematic diagram of a system framework for testing an application according to some embodiments of the present disclosure in conjunction with FIG. 5. The following describes a schematic block diagram of an apparatus 600 for testing an application according to some embodiments of the present disclosure in conjunction with FIG. 6.
[0105] As shown in FIG. 6, the apparatus 600 includes a first state sending module 602 configured to send a first state of an application running on a terminal to a server, the first state being a state related to a page of the application; a target conversion command receiving module 604 configured to receive a target conversion command from the server based on the sending of the first state, the target conversion command being determined based on a state transition directed graph for the application, the state transition directed graph including a set of states related to the pages of the application and a set of operation sequences for implementing state transitions; and a second state generating module 606 configured to generate a second state of the application based on the first state and the target conversion command to implement the testing of the application.
[0106] In some embodiments, the target conversion command includes a target operation sequence from the set of operation sequences, and the second state generating module 606 includes: a page determining module configured to determine a page corresponding to the first state; a target operation sequence executing module configured to execute the target operation sequence for the page; and a second state generating module configured to generate the second state in response to the target operation sequence having been executed.
[0107] In some embodiments, the second state generating module includes: a set of parameter generating module configured to generate a set of parameters of the page in response to the target operation sequence having been executed; and a second state generating module configured to generate the second state based on a page identifier of the page and the set of parameters.
[0108] In some embodiments, the second state generation module comprises: a second set of parameters and network request generation module configured to generate the second set of parameters and the network request of the page in response to the target operation sequence having been performed; and a second state generation module configured to generate the second state based on the page identifier, the set of parameters and the network request of the page, the second state being a dummy state indicating the network request.
[0109] In some embodiments, the second state generation module further comprises: a second state sending module configured to send the second state including the network request to the server; and a network response receiving module configured to receive a network response to the network request from the server.
[0110] In some embodiments, the page identifier is a uniform resource locator.
[0111] In some embodiments, the second state generation module further comprises: a second state sending module configured to send the second state of the application to the server; and a network message receiving module configured to receive a network message from the server based on the sending of the second state.
[0112] In some embodiments, the apparatus 600 further comprises: a target state determination module configured to determine a target state of the application to be tested; and a target state sending module configured to send the target state to the server; and the target transition command is determined based on the first state, the target state and the state transition directed graph.
[0113] In some embodiments, the target operation sequence comprises at least one of: a click operation, an input operation or a swipe operation.
[0114] The schematic block diagram of the apparatus 600 for testing an application according to some embodiments of the present disclosure is described above in connection with FIG. 6. The schematic block diagram of the apparatus 700 for testing an application according to embodiments of the present disclosure is described below in connection with FIG. 7.
[0115] As shown in FIG. 7, the apparatus 700 comprises a target execution sequence determination module 702 configured to determine a target execution sequence related to a state transition directed graph, the state transition directed graph comprising a set of states related to a page of an application and a set of operation sequences for implementing state transitions; a first state receiving module 704 configured to receive a first state from a terminal, the first state being a state related to a page of an application running on the terminal; a target transition command determination module 706 configured to determine a target transition command for transitioning the first state to a second state based on the first state and the target execution sequence; and a target transition command sending module 708 configured to send the target transition command to the terminal to implement testing of the application.
[0116] In some embodiments, the target transition command determination module 706 comprises: a second state determination module configured to determine a second state based on the target execution sequence and the first state; and a target transition command determination module configured to determine a target transition command for transitioning from the first state to the second state based on the target execution sequence.
[0117] In some embodiments, the second state determination module comprises: a next state determination module adjacent to the first state configured to determine a next state adjacent to the first state in the target execution sequence based on the target execution sequence and the first state; and a second state determination module configured to determine the next state as the second state.
[0118] In some embodiments, the target execution sequence determination module 702 comprises: a target state receiving module configured to receive a target state to be tested by the application from the terminal; and a target execution sequence determination module configured to determine a target execution sequence for achieving the target state based on the target state and the state transition directed graph.
[0119] In some embodiments, the target execution sequence determination module 702 comprises: a plurality of execution sequence generation modules configured to generate a plurality of execution sequences based on the state transition directed graph; and a target execution sequence selection module configured to select one of the plurality of execution sequences as the target execution sequence.
[0120] In some embodiments, the apparatus 700 further comprises: a second state receiving module configured to receive a second state from the terminal; a network response determination module configured to determine a network response from the virtual state to a third state based on the target execution sequence in response to the second state indicating a virtual state requested for the network; and a network response sending module configured to send the network response to the terminal.
[0121] In some embodiments, the apparatus 700 further comprises: a network message sending module configured to send a network message to the terminal in response to the transition from the second state to a fourth state being achieved by the network message.
[0122] FIG. 8 shows a schematic block diagram of an example device 800 that can be used to implement embodiments of the present disclosure. The terminal 102 and / or the server 108 in FIG. 1 can be implemented with the device 800. As shown, the device 800 includes a central processing unit (CPU) 801, which can perform various suitable actions and processes according to computer program instructions stored in a read-only memory (ROM) 802 or computer program instructions loaded from a storage unit 808 into a random access memory (RAM) 803. Various programs and data required by the device 800 for operation can also be stored within the RAM 803. The CPU 801, the ROM 802, and the RAM 803 are connected to each other by a bus 804. An input / output (I / O) interface 805 is also connected to the bus 804.
[0123] A plurality of components in the device 800 are connected to the I / O interface 805, including an input unit 806, such as a keyboard, a mouse, etc., an output unit 807, such as various types of displays, speakers, etc., a storage unit 808, such as a magnetic disk, an optical disk, etc., and a communication unit 809, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 809 allows the device 800 to exchange information / data with other devices through a computer network, such as the Internet, and / or various telecommunication networks.
[0124] The various processes and processes described above, such as the example method 200, the example method 300, the example 400, and the example 500, can be performed by the processing unit 801. For example, in some embodiments, the example method 200, the example method 300, the example 400, and the example 500 can be implemented as a computer software program, which is tangibly embodied in a machine-readable medium, such as the storage unit 808. In some embodiments, part or all of the computer program can be loaded and / or installed on the device 800 via the ROM 802 and / or the communication unit 809. When the computer program is loaded into the RAM 803 and executed by the CPU 801, one or more actions of the example method 200, the example method 300, the example 400, and the example 500 described above can be performed.
[0125] The present disclosure can be a method, apparatus, system, and / or computer program product. The computer program product can include a computer readable storage medium (or media) having computer readable program instructions thereon for performing various aspects of the present disclosure.
[0126] Computer readable storage media can be tangible storage media which can retain and store instructions for use by an instruction execution device. Computer readable storage media can be, for example, but is not limited to, an electronic storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination of the foregoing. More specific examples (a non-exhaustive list) of computer readable storage media include the following: a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), a static random access memory (SRAM), a portable compact disc read-only memory (CD-ROM), a digital versatile disk (DVD), a memory stick, a floppy disk, a mechanically encoded device such as punch-cards or raised structures in a groove having instructions recorded thereon, and any suitable combination of the foregoing. A computer readable storage medium, as used herein, is not to be construed as being transitory signals per se, such as radio waves or other freely propagating electromagnetic waves, electromagnetic waves propagating through a waveguide or other transmission media (e.g., light pulses passing through a fiber-optic cable), or electrical signals transmitted through a wire.
[0127] Computer readable program instructions described herein can be downloaded to respective computing / processing devices from a computer readable storage medium or to an external computer or external storage device via a network, for example, the Internet, a local area network, a wide area network and / or a wireless network. The network can comprise copper transmission cables, optical transmission fibers, wireless transmission, routers, firewalls, switches, gateway computers and / or edge servers. A network adapter card or network interface in each computing / processing device receives computer readable program instructions from the network and forwards the computer readable program instructions for storage in a computer readable storage medium within the respective computing / processing device.
[0128] Computer readable program instructions for carrying out operations of the present disclosure can be assembler instructions, instruction-set-architecture (ISA) instructions, machine instructions, machine dependent instructions, microcode, firmware instructions, state-setting data, or either source code or object code written in any combination of one or more programming languages, including an object oriented programming language such as Smalltalk, C++ or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The computer readable program instructions can execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the latter scenario, the remote computer can be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or the connection can be made to an external computer (for example, through the Internet using an Internet Service Provider). In some embodiments, electronic circuitry including, for example, programmable logic circuitry, field-programmable gate array (FPGA), or programmable logic array (PLA) can execute the computer readable program instructions by utilizing state information of the computer readable program instructions to personalize the electronic circuitry, in order to perform aspects of the present disclosure.
[0129] The computer readable program instructions can also be loaded onto a computer, other programmable data processing apparatus, or other device to cause a series of operational steps to be performed on the computer, other programmable apparatus or other device to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide processes for implementing the functions / acts specified in the flowchart and / or block diagram block or blocks.
[0130] These computer readable program instructions can be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions / acts specified in the flowchart and / or block diagram block or blocks. These computer readable program instructions can also be stored in a computer readable storage medium that can include random access memory (RAM), read only memory (ROM), electrically erasable programmable read only memory (EEPROM), flash memory or other data storage device. When the computer readable program instructions are loaded into the computer and other programmable data processing apparatus, a series of operational steps are implemented that provide processes such that the computer or other programmable apparatus provide processes for implementing the functions / acts specified in the flowchart and / or block diagram block or blocks.
[0131] The computer readable program instructions can also be loaded onto a computer, other programmable data processing apparatus, or other device to cause a series of operational steps to be performed on the computer, other programmable data processing apparatus or other device to produce a computer implemented process such that the instructions which execute on the computer, other programmable data processing apparatus, or other device implement the functions / acts specified in the flowchart and / or block diagram block or blocks.
[0132] The flow diagrams and the block diagrams in the drawings are presented to illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flow diagrams and the block diagrams can represent a module, segment, or portion of instructions, which comprises one or more executable instructions for implementing the specified logic functions. In some alternative implementations, the functions noted in the blocks can occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks can sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and / or flow diagrams, and combinations thereof, can be implemented by special purpose hardware-based systems that perform the specified functions or acts, or combinations of special purpose hardware and
[0133] Embodiments of the present disclosure have been described above, and the description is intended to be illustrative of the embodiments and not restrictive. Many modifications and variations of the described embodiments are possible and are within the scope of the disclosure. The selection of terms is intended to best describe the principles of the embodiments, practical application, or technical improvements over the technology found in the market, or to enable others skilled in the art to understand the embodiments disclosed herein.
Claims
1. A method for testing an application, comprising: sending, to a server, a first state of an application running on a terminal, the first state being a state related to a page of the application; receiving, from the server, a target transition command based on the sending of the first state, the target transition command being determined based on a state transition directed graph for the application, the state transition directed graph comprising a set of states related to pages of the application and a set of operation sequences for implementing state transitions; and generating, based on the first state and the target transition command, a second state of the application to implement testing of the application.
2. The method of claim 1, wherein the target transition command comprises a target operation sequence from the set of operation sequences, and generating, based on the first state and the target transition command, a second state of the application to implement testing of the application comprises: determining the page corresponding to the first state; executing the target operation sequence for the page; and generating the second state in response to the target operation sequence having been executed.
3. The method of claim 2, wherein generating the second state in response to the target operation sequence having been executed comprises: generating a set of parameters for the page in response to the target operation sequence having been executed; and generating the second state based on a page identification of the page and the set of parameters.
4. The method of claim 3, wherein generating the second state based on a page identification of the page and the set of parameters comprises: generating a second set of parameters and a network request for the page in response to the target operation sequence having been executed; and generating the second state based on the page identification of the page, the set of parameters, and the network request, the second state being a dummy state indicating a network request.
5. The method of claim 4, further comprising: sending, to the server, the second state comprising the network request; and receiving, from the server, a network response for the network request.
6. The method of claim 4, wherein the page identification is a uniform resource locator.
7. The method of claim 3, further comprising: sending, to a server, the second state of the application; and receiving, based on the sending of the second state, a network message from the server.
8. The method of claim 1, further comprising: determining a target state for which the application is to be tested; and sending, to the server, the target state; and wherein the target transition command is determined based on the first state, the target state, and the state transition directed graph.
9. The method of claim 2, wherein the target operation sequence comprises at least one of: a click operation, an input operation, or a swipe operation.
10. A method for testing an application, comprising: determining a target execution sequence related to a state transition directed graph, the state transition directed graph comprising a set of states related to pages of an application and a set of operation sequences for implementing state transitions; and implementing the target execution sequence based on the state transition directed graph. receiving a first state from a terminal, the first state being a state related to a page of the application running on the terminal; determining a target transition command for transitioning the first state to a second state based on the first state and a target execution sequence; and sending the target transition command to the terminal to implement a test of the application.
11. The method of claim 10, wherein determining a target transition command for transitioning the first state to a second state based on the first state and a target execution sequence comprises: determining the second state based on the target execution sequence and the first state; and determining the target transition command for transitioning from the first state to the second state based on the target execution sequence.
12. The method of claim 11, wherein determining the second state based on the target execution sequence and the first state comprises: determining a next state adjacent to the first state in the target execution sequence based on the target execution sequence and the first state; and determining the next state as the second state.
13. The method of claim 10, wherein determining a target execution sequence related to a state transition directed graph comprises: receiving a target state of the application to be tested from the terminal; and determining the target execution sequence for implementing the target state based on the target state and the state transition directed graph.
14. The method of claim 10, wherein determining a target execution sequence related to a state transition directed graph comprises: generating a plurality of execution sequences based on the state transition directed graph; and selecting one of the plurality of execution sequences as the target execution sequence.
15. The method of claim 10, further comprising: receiving the second state from the terminal; determining a network response from the virtual state to a third state based on the target execution sequence in response to the second state indicating a virtual state for a network request; and sending the network response to the terminal.
16. The method of claim 15, further comprising: sending a network message to the terminal in response to the transition of the second state to a fourth state being implemented by the network message.
17. An apparatus for testing an application, comprising: a first state sending module configured to send a first state of an application running on a terminal to a server, the first state being a state related to a page of the application; a target transition command receiving module configured to receive a target transition command from the server based on the sending of the first state, the target transition command being determined based on a state transition directed graph for the application, the state transition directed graph comprising a set of states related to pages of the application and a set of operation sequences for implementing state transitions; and a second state generating module configured to generate a second state of the application based on the first state and the target transition command to implement a test of the application.
18. An apparatus for testing an application, comprising: a target execution sequence determination module configured to determine a target execution sequence related to a state transition directed graph, the state transition directed graph comprising a set of states related to pages of the application and a set of operation sequences for implementing state transitions; a first state receiving module configured to receive a first state from a terminal, the first state being a state related to a page of an application running on the terminal; a target transition command determination module configured to determine a target transition command for transitioning the first state to a second state based on the first state and the target execution sequence; and a target transition command sending module configured to send the target transition command to the terminal to implement testing of the application. 19.An electronic device, comprising: at least one processor; and a memory device storing at least one program, which, when executed by the at least one processor, causes the at least one processor to implement the method according to any one of claims 1-16. 20.A computer-readable storage medium having stored thereon a computer program, which, when executed by a processor, implements the method according to any one of claims 1-16. 21.A computer program product comprising a computer program, which, when executed by a processor, implements the method according to any one of claims 1-16.
Citation Information
Patent Citations
Application program testing method and device
CN111694756A
Page test method and device, electronic equipment and storage medium
CN115098362A
Application program testing method and device, computer equipment and storage medium
CN115269365A
Page state display method and device based on front-end Mock technology, equipment and medium
CN116627837A