A test method, device, computer device, and storage medium
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- DOUYIN VISION CO LTD
- Filing Date
- 2022-03-24
- Publication Date
- 2026-08-07
AI Technical Summary
因此,现有的技术方案对测试人员的代码能力要求较高,且结合源码编写脚本的过程中,定位操作指令的操作位置存在一定的技术上的难点
[0049] This disclosure provides a testing method, apparatus, computer device, and storage medium. In this disclosure, a communication connection is first established between the Flutter application to be tested and the Flutter performance debugger. Then, a user's target gesture on the target interactive page of the Flutter application to be tested is intercepted, and the target gesture is sent to the Flutter performance debugger through the aforementioned communication connection. This allows the Flutter performance debugger to generate a target test script based on the target gesture, thereby improving the automation of target test script generation, reducing the coding skill requirements for testers, and improving the accuracy of the generated target test script, thus expanding the scope of application of this disclosure.
Smart Images

Figure CN114625663B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of computer technology, and more specifically, to a testing method, apparatus, computer equipment, and storage medium. Background Technology
[0002] With the development of mobile internet, the method of developing cross-system applications through the Flutter platform is becoming more and more popular.
[0003] However, when testing applications on the Flutter platform, testing is typically done by testers manually writing test scripts. Therefore, existing solutions require testers to have high coding skills, and locating the operation positions of commands while writing scripts based on the source code presents certain technical challenges. Summary of the Invention
[0004] This disclosure provides at least one testing method, apparatus, computer device, and storage medium.
[0005] In a first aspect, embodiments of this disclosure provide a testing method applied to a device running a Flutter application, comprising:
[0006] In response to a connection request from the Flutter performance debugger, a communication connection is established between the Flutter application to be tested and the Flutter performance debugger.
[0007] Intercept user gestures that target interactive pages of the Flutter application to be tested.
[0008] The target gesture is sent to the Flutter performance debugger via the communication connection, so that the Flutter performance debugger generates a target test script based on the target gesture.
[0009] In one optional implementation, intercepting the user's target gestures on the target interactive page of the Flutter application to be tested includes:
[0010] Detect user actions triggered on the target interactive page;
[0011] When the triggering operation is a preset gesture operation, it is determined that the target operation gesture has been detected, wherein the preset gesture operation type includes at least one of the following: click operation, swipe operation, page back operation, and text input operation.
[0012] In one optional implementation, the target gesture is a click gesture; before sending the target gesture to the Flutter performance debugger via the communication connection, the method further includes:
[0013] If the target gesture is a click on the target interactive page, the click operation information is determined; the click operation information is used to indicate the click location and / or the number of click locations.
[0014] The click operation information and the operation type of the click operation are sent to the Flutter performance debugging program through the communication connection.
[0015] In one optional implementation, the target gesture is a swipe gesture; before sending the target gesture to the Flutter performance debugger via the communication connection, the method further includes:
[0016] When the target gesture is the swipe gesture, the swipe gesture information is determined; the swipe gesture information is used to indicate the swipe gesture position and / or the swipe gesture speed.
[0017] The sliding operation information and the operation type of the sliding operation are sent to the Flutter performance debugging program through the communication connection.
[0018] In one optional implementation, the target gesture is a page back operation; before sending the target gesture to the Flutter performance debugger via the communication connection, the method further includes:
[0019] When the target operation gesture is the page back operation, determine the back operation information of the page back operation; the back operation information is used to indicate the identifier attribute information of the page back identifier triggered by the user on the target interactive page;
[0020] The rollback operation information and the operation type of the page rollback operation are sent to the Flutter performance debugging program through the communication connection.
[0021] In one optional implementation, the target gesture is a text input gesture; before sending the target gesture to the Flutter performance debugger via the communication connection, the method further includes:
[0022] When the target gesture is the text input gesture, the input operation information of the text input gesture is determined; the input operation information is used to indicate the text content entered by the user on the target interactive page and / or the text input position of the text input gesture.
[0023] The text operation information and the operation type of the text input operation are sent to the Flutter performance debugging program through the communication connection.
[0024] In one optional implementation, sending the target gesture to the Flutter performance debugger via the communication connection includes:
[0025] Invoke the debug extension application in the Flutter performance debugger;
[0026] Based on the aforementioned debugging extension application, the target operation gesture is sent to the Flutter performance debugging program through the communication connection.
[0027] Secondly, this disclosure also provides a testing method applied to a device running a Flutter performance debugging program, including:
[0028] Establish a communication connection between the Flutter performance debugger and the Flutter application to be tested;
[0029] Obtain the target operation gesture sent by the Flutter application under test through the communication connection, wherein the target operation gesture is the gesture operation intercepted by the Flutter application under test on the target interactive page;
[0030] A target test script is generated based on the gesture operation information corresponding to the target operation gesture, and the Flutter application to be tested is tested through the test cases indicated by the target test script; the gesture operation information is used to indicate the operation position and / or operation content of the target operation gesture on the target interactive page.
[0031] In one optional implementation, generating the target test script based on the gesture operation information corresponding to the target gesture includes:
[0032] The target script template is determined based on the gesture operation type of the target operation gesture;
[0033] The target test script is generated based on the target script template and the gesture operation information.
[0034] In one optional implementation, testing the Flutter application under test using the test cases indicated by the target test script includes:
[0035] The target test script is input into the driver of the Flutter performance debugger, so that the driver calls the Flutter application under test to run the target test script and obtain the script test results.
[0036] In one optional implementation, establishing a communication connection between the Flutter performance debugger and the Flutter application to be tested includes:
[0037] Detect the WebSocket connection requests sent by the Flutter application under test;
[0038] If the WebSocket connection request passes verification, a WebSocket communication connection is established between the WebSocket and the Flutter application to be tested.
[0039] Thirdly, this disclosure also provides a testing apparatus, set on a device running a Flutter application, including:
[0040] The connection unit is used to establish a communication connection between the Flutter application to be tested and the Flutter performance debugger in response to a connection request from the Flutter performance debugger.
[0041] The interception unit is used to intercept user gestures on the target interactive page of the Flutter application to be tested.
[0042] The sending unit is used to send the target operation gesture to the Flutter performance debugging program through the communication connection, so that the Flutter performance debugging program generates a target test script based on the target operation gesture.
[0043] Fourthly, embodiments of this disclosure also provide a testing apparatus, disposed on a device running a Flutter performance debugging program, comprising:
[0044] A setup unit is used to establish a communication connection between the Flutter performance debugging program and the Flutter application to be tested.
[0045] The acquisition unit is used to acquire the target operation gesture sent by the Flutter application under test through the communication connection, wherein the target operation gesture is the gesture operation intercepted by the Flutter application under test on the target interactive page;
[0046] The generation unit is used to generate a target test script based on the gesture operation information corresponding to the target operation gesture, and to test the Flutter application to be tested using the test cases indicated by the target test script; the gesture operation information is used to indicate the operation position and / or operation content of the target operation gesture on the target interactive page.
[0047] Fifthly, embodiments of this disclosure also provide a computer device, including: a processor, a memory, and a bus, wherein the memory stores machine-readable instructions executable by the processor, and when the computer device is running, the processor communicates with the memory via the bus, and when the machine-readable instructions are executed by the processor, the steps in any of the possible implementations of the first to second aspects described above are performed.
[0048] In a sixth aspect, embodiments of this disclosure also provide a computer-readable storage medium storing a computer program that, when executed by a processor, performs the steps in any of the possible implementations of the first to second aspects described above.
[0049] This disclosure provides a testing method, apparatus, computer device, and storage medium. In this disclosure, a communication connection is first established between the Flutter application to be tested and the Flutter performance debugger. Then, a user's target gesture on the target interactive page of the Flutter application to be tested is intercepted, and the target gesture is sent to the Flutter performance debugger through the aforementioned communication connection. This allows the Flutter performance debugger to generate a target test script based on the target gesture, thereby improving the automation of target test script generation, reducing the coding skill requirements for testers, and improving the accuracy of the generated target test script, thus expanding the scope of application of this disclosure.
[0050] To make the above-mentioned objects, features and advantages of this disclosure more apparent and understandable, preferred embodiments are described below in detail with reference to the accompanying drawings. Attached Figure Description
[0051] To more clearly illustrate the technical solutions of the embodiments of this disclosure, the accompanying drawings used in the embodiments will be briefly described below. These drawings are incorporated in and constitute a part of this specification. They illustrate embodiments conforming to this disclosure and, together with the specification, serve to explain the technical solutions of this disclosure. It should be understood that the following drawings only show some embodiments of this disclosure and should not be considered as limiting the scope. Those skilled in the art can obtain other related drawings based on these drawings without creative effort.
[0052] Figure 1 A flowchart of a testing method provided by an embodiment of this disclosure is shown;
[0053] Figure 2 This document illustrates a flowchart illustrating the interception of a user's target gesture on a target interactive page of a Flutter application under test, as provided in an embodiment of this disclosure.
[0054] Figure 3 A flowchart of another testing method provided by an embodiment of this disclosure is shown;
[0055] Figure 4 A schematic diagram of a testing apparatus provided in an embodiment of this disclosure is shown;
[0056] Figure 5 A schematic diagram of another testing apparatus provided in an embodiment of this disclosure is shown;
[0057] Figure 6 A schematic diagram of a computer device provided in an embodiment of this disclosure is shown;
[0058] Figure 7 A schematic diagram of another computer device provided in an embodiment of this disclosure is shown. Detailed Implementation
[0059] To make the objectives, technical solutions, and advantages of the embodiments of this disclosure clearer, the technical solutions of the embodiments of this disclosure will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this disclosure, and not all of them. The components of the embodiments of this disclosure described and shown in the accompanying drawings can generally be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of this disclosure provided in the accompanying drawings is not intended to limit the scope of the claimed disclosure, but merely represents selected embodiments of this disclosure. All other embodiments obtained by those skilled in the art based on the embodiments of this disclosure without inventive effort are within the scope of protection of this disclosure.
[0060] It should be noted that similar labels and letters in the following figures indicate similar items. Therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures.
[0061] In this document, the term "and / or" merely describes a relationship, indicating that three relationships can exist. For example, A and / or B can represent three cases: A alone, A and B simultaneously, and B alone. Furthermore, the term "at least one" in this document means any combination of at least two of any one or more elements. For example, including at least one of A, B, and C can mean including any one or more elements selected from the set consisting of A, B, and C.
[0062] Research has revealed that existing solutions for testing applications using the Flutter platform typically involve testers manually writing test scripts. Therefore, these solutions place high demands on testers' coding skills, and locating the execution positions of commands while writing scripts based on the source code presents significant technical challenges.
[0063] Based on the above research, this disclosure provides a testing method, apparatus, computer device, and storage medium. In the embodiments of this disclosure, a communication connection is first established between the Flutter application to be tested and the Flutter performance debugger. Then, a user's target operation gesture on the target interactive page of the Flutter application to be tested is intercepted, and the target operation gesture is sent to the Flutter performance debugger through the aforementioned communication connection. This allows the Flutter performance debugger to generate a target test script based on the target operation gesture, thereby improving the automation level of target test script generation, reducing the coding ability requirements for testers, and improving the accuracy of the generated target test script, thus expanding the scope of application of this disclosure.
[0064] To facilitate understanding of this embodiment, a testing method disclosed in this disclosure will first be described in detail. The testing method provided in this disclosure is generally executed by a computer device with a certain computing power. In some possible implementations, this testing method can be implemented by the processor calling computer-readable instructions stored in memory.
[0065] See Figure 1 The diagram shows a flowchart of a testing method provided in an embodiment of this disclosure, applied to a device running a Flutter application. The method includes steps S101 to S105, wherein:
[0066] S101: In response to the connection request from the Flutter performance debugger, establish a communication connection between the Flutter application to be tested and the Flutter performance debugger.
[0067] In this embodiment of the disclosure, the aforementioned Flutter performance debugger is a program used to generate target test scripts. Therefore, the Flutter application to be tested first needs to detect the connection request from the Flutter performance debugger to establish a communication connection with the Flutter performance debugger, thereby enabling data transmission with the Flutter performance debugger.
[0068] S103: Intercept user gestures on the target interactive page of the Flutter application to be tested.
[0069] In this embodiment of the disclosure, a user can perform interactive operations on a target interactive page of the Flutter application under test using a target gesture. For example, if the target gesture is a click operation, the click operation can be used to select page content on the target interactive page of the Flutter application under test. Alternatively, the target interactive page of the Flutter application under test can be a function page within the Flutter application itself.
[0070] Here, the target user gestures within the target interactive page can be intercepted by setting an interceptor in the Flutter application under test. Specifically, the interceptor can be set in the framework layer of the Flutter application under test, where the framework layer is used to run the Flutter application under test based on its runtime application.
[0071] In the embodiments of this disclosure, during the process of setting up the interceptor, an interceptor can be set up for each type of target operation gesture, or an interceptor that can be used to detect multiple types of target operation gestures at the same time can be set up. This disclosure does not specifically limit the type of interceptor.
[0072] After setting up an interceptor in the Flutter application to be tested, the interceptor can intercept the user's triggered actions on the target interactive page. It should be noted that the interceptor can identify the target operation gesture in the triggered action. After detecting the user's target operation gesture on the target interactive page, it can obtain the operation content of the target operation gesture.
[0073] S105: The target operation gesture is sent to the Flutter performance debugging program through the communication connection, so that the Flutter performance debugging program generates a target test script based on the target operation gesture.
[0074] In this embodiment of the disclosure, after intercepting the target gesture, the operation content of the target gesture can be obtained, and the target gesture and its corresponding operation content can be sent to the Flutter performance debugging program via a communication connection, so that the Flutter performance debugging program can generate a corresponding target test script based on the operation content of the target gesture. Here, the target test script can be used to instruct the Flutter application under test to automatically run the target gesture.
[0075] As described above, in this embodiment of the disclosure, a communication connection is first established between the Flutter application to be tested and the Flutter performance debugger. Then, the user's target operation gesture on the target interactive page of the Flutter application to be tested is intercepted, and the target operation gesture is sent to the Flutter performance debugger through the aforementioned communication connection. This allows the Flutter performance debugger to generate a target test script based on the target operation gesture, thereby improving the automation level of generating the target test script, reducing the coding ability requirements for testers, and improving the accuracy of the generated target test script, thus expanding the scope of application of this disclosure.
[0076] In one alternative implementation, such as Figure 2 As shown, step S103 above, which intercepts the user's target operation gestures on the target interactive page of the Flutter application to be tested, specifically includes the following process:
[0077] S1031: Detect the user's trigger operation on the target interactive page.
[0078] In this embodiment of the disclosure, users can interact with a target interactive page through trigger operations. Here, the aforementioned interceptor can intercept the user's trigger operations within the target interactive page and obtain the trigger content corresponding to each trigger operation.
[0079] S1032: When the triggering operation is a preset gesture operation, it is determined that the target operation gesture has been detected, wherein the preset gesture operation type includes at least one of the following: click operation, swipe operation, page back operation, and text input operation.
[0080] In this embodiment of the disclosure, a preset gesture operation can first be obtained, and the trigger content of the obtained trigger operation can be matched with the preset gesture operation. The trigger gesture that matches the trigger content and the preset gesture operation is determined as the target operation gesture.
[0081] Here, the aforementioned preset gesture types can be pre-set. Specifically, users can modify the preset gesture types that the interceptor can detect through modification instructions. The modification instructions can include at least one of the following: deleting a preset gesture type, adding a preset gesture type, or modifying a preset gesture type.
[0082] As described above, after detecting a user's trigger operation on the target interactive page, it can be determined whether the trigger operation is a preset operation gesture, thereby identifying the user's target operation gesture. This provides a technical basis for sending the target operation gesture to the Flutter performance debugging program via a communication connection.
[0083] In an optional implementation, when the target gesture is a click, before sending the target gesture to the Flutter performance debugger via the communication connection, the method further includes the following process:
[0084] (1) If the target operation gesture is a click operation on the target interactive page, determine the click operation information of the click operation; the click operation information is used to indicate the click position and / or the number of click positions;
[0085] (2) Send the click operation information and the operation type of the click operation to the Flutter performance debugging program through the communication connection.
[0086] In this embodiment of the disclosure, when the target operation gesture is a click operation, the operation content corresponding to the click operation, i.e., the click operation information, can be obtained. Here, the click operation can be divided into the following cases:
[0087] Scenario 1: Click operation.
[0088] In this embodiment of the disclosure, after detecting a user's click operation on the target interactive page, the number of times the user clicks the click location within a preset detection time can be obtained. If the number of clicks indicated by this quantity information is one, the click operation can be determined to be a single click. For example, the preset detection time can be set to 1 second. If the user clicks the click location once within 1 second, then the click operation can be determined to be a single click.
[0089] Scenario 2: Combo operation (e.g., double-click operation).
[0090] In this embodiment of the disclosure, after detecting a user's click operation on the target interactive page, the number of times the user clicks on the click location within a preset detection time can be obtained. If the number of clicks indicated by the number of clicks is multiple, the click operation can be determined to be a continuous click operation.
[0091] It should be understood that the above-mentioned click positions may have correction data. If the distance difference between the click positions corresponding to multiple click operations is less than the correction data, it can be considered that the click positions corresponding to these multiple click operations are the same.
[0092] For example, if the distance difference between the user's first and second clicks on the target interactive page is 1px, and the aforementioned correction data is 2px, then the distance difference between these two click locations is less than the correction data. In this case, it can be considered that the click locations corresponding to these two clicks are the same. Therefore, if the operation interval between these two clicks is less than the aforementioned preset detection time, it can be determined that a double-click operation has been detected.
[0093] Before sending the click operation information and operation type to the Flutter performance debugger via the communication connection, it is necessary to determine the click location and / or quantity information of the click operation. The click location can be represented in the form of (X, Y) coordinates. Then, the click operation information can be determined based on the coordinates of the click location and the quantity of clicks, and the click operation information and operation type can be sent to the Flutter performance debugger.
[0094] As described above, when the target operation gesture is a click operation on the target interactive page, the click operation information used to indicate the click operation and / or the number of click positions can be determined, so that the Flutter performance debugging program can generate the target test script corresponding to the click operation relatively accurately based on the click operation information.
[0095] In an optional implementation, when the target gesture is a swipe gesture, before sending the target gesture to the Flutter performance debugger via the communication connection, the method further includes the following process:
[0096] (1) When the target operation gesture is the sliding operation, determine the sliding operation information of the sliding operation; the sliding operation information is used to indicate the operation position of the sliding operation and / or the sliding speed of the sliding operation;
[0097] (2) Send the sliding operation information and the operation type of the sliding operation to the Flutter performance debugging program through the communication connection.
[0098] In this embodiment of the disclosure, when the target operation gesture is a swipe operation, the operation content corresponding to the swipe operation, i.e., the swipe operation information, can be obtained.
[0099] In practice, when a user's swipe operation is detected, the coordinates of at least some pixels corresponding to the swipe operation on the target interactive page can be obtained, and the operation position of the swipe operation can be determined based on the obtained pixel coordinates.
[0100] Additionally, the sliding time corresponding to the sliding operation can be obtained, and the sliding distance of the sliding operation can be determined based on the operation position of the sliding operation. Thus, the sliding speed corresponding to the sliding operation can be determined based on the sliding time and the sliding distance.
[0101] It should be understood that the aforementioned swiping speed is related to the user's browsing speed on the target interactive page, and the user can adjust the swiping speed to adapt to the browsing speed. Here, when the target interactive page is a long page, the user can browse the long page by swiping down. In this case, the faster the user browses the target interactive page, the faster the swiping speed can be.
[0102] After determining the operation position and sliding speed of the above sliding operation, the sliding operation information can be determined based on the operation position and sliding speed, and the sliding operation information and operation type can be sent to the Flutter performance debugging program through the communication connection.
[0103] As described above, when the target gesture is a swipe operation on the target interactive page, swipe operation information can be determined to indicate the operation position and / or swipe speed of the swipe operation. This allows the Flutter performance debugger to generate the target test script corresponding to the swipe operation relatively accurately based on the swipe operation information.
[0104] In an optional implementation, when the target gesture is a page back operation, before sending the target gesture to the Flutter performance debugger via the communication connection, the method further includes the following process:
[0105] (1) When the target operation gesture is the page back operation, determine the back operation information of the page back operation; the back operation information is used to indicate the identifier attribute information of the page back identifier triggered by the user on the target interactive page;
[0106] (2) Send the rollback operation information and the operation type of the page rollback operation to the Flutter performance debugging program through the communication connection.
[0107] In this embodiment of the disclosure, when the target operation gesture is a page back operation, the operation content corresponding to the page back operation, namely the back operation information, can be obtained.
[0108] In practice, the target interactive page contains at least one page back icon, which is used to instruct the user to return to the parent page of the target interactive page. When the page back icon is detected, it can be determined that the page back operation has been detected.
[0109] Next, we can obtain the identifier attribute information of the page back icon, thereby determining the back operation information of the page back operation. The identifier attribute information can be used to indicate the position information of the page back icon in the target interactive page, and / or the back page indicated by the page back icon.
[0110] After determining the fallback operation information for the aforementioned page fallback operation, the fallback operation information and the operation type of the page fallback operation can be sent to the aforementioned Flutter performance debugging program via a communication connection.
[0111] As described above, when the target gesture is a page back operation on the target interactive page, the back operation information of the page back operation can be determined, so that the Flutter performance debugger can generate the target test script corresponding to the page back operation relatively accurately based on the back operation information.
[0112] In an optional implementation, when the target gesture is a text input gesture, before sending the target gesture to the Flutter performance debugger via the communication connection, the method further includes the following process:
[0113] (1) When the target operation gesture is the text input operation, determine the input operation information of the text input operation; the input operation information is used to indicate the text content entered by the user on the target interactive page and / or the text input position of the text input operation;
[0114] (2) Send the text operation information and the operation type of the text input operation to the Flutter performance debugging program through the communication connection.
[0115] In this embodiment of the disclosure, when the target operation gesture is a text input operation, the operation content corresponding to the text input operation, i.e., the input operation information, can be obtained.
[0116] In practice, the target interactive page contains at least one text input location. After detecting the text input operation, the text input location corresponding to the text input operation can be determined, and the text content entered by the user at that text input location can be obtained.
[0117] After determining the input operation information for the aforementioned text input operation, the input operation information and the operation type of the text input operation can be sent to the aforementioned Flutter performance debugging program via a communication connection.
[0118] As described above, when the target gesture is a text input operation on the target interactive page, the input operation information of the text input operation can be determined so that the Flutter performance debugger can generate the target test script corresponding to the text input operation relatively accurately based on the input operation information.
[0119] In an optional implementation, step S105 above, which involves sending the target operation gesture to the Flutter performance debugging program via the communication connection, specifically includes the following process:
[0120] S1051: Invoke the debug extension application in the Flutter performance debugger.
[0121] In this embodiment of the disclosure, the Flutter performance debugging program includes a debugging extension application, wherein the debugging extension application can perform data transmission between the Flutter performance debugging program and the Flutter application to be tested based on a WebSocket communication connection, and the debugging extension application can be an extension application.
[0122] S1052: Based on the debugging extension application, the target operation gesture is sent to the Flutter performance debugging program through the communication connection.
[0123] In this embodiment of the disclosure, after the target operation gesture is determined, the debugging extension application in the Flutter performance debugger can be invoked so that the debugging extension application can send the target operation gesture in the Flutter application to be tested to the Flutter performance debugger based on the WebSocket communication connection.
[0124] As described above, by calling the debug extension application in the Flutter performance debugger, the target operation gestures in the Flutter application to be tested can be sent to the Flutter performance debugger, thereby realizing cross-platform communication between the Flutter performance debugger and the Flutter application.
[0125] See Figure 3 The diagram shows a flowchart of another testing method provided in this disclosure, applied to a device running a Flutter performance debugging program. The method includes steps S301 to S305, wherein:
[0126] S301: Establish a communication connection between the Flutter performance debugger and the Flutter application to be tested.
[0127] In this embodiment of the disclosure, the Flutter performance debugging program can send a connection request to the Flutter application under test. After the Flutter application under test accepts the connection request, a communication connection can be established between the Flutter performance debugging program and the Flutter application under test.
[0128] S303: Obtain the target operation gesture sent by the Flutter application under test through the communication connection, wherein the target operation gesture is the gesture operation intercepted by the Flutter application under test on the target interactive page.
[0129] In this embodiment of the disclosure, the target operation gesture sent by the Flutter application to be tested can be obtained based on the aforementioned communication connection, and the operation type and operation content corresponding to the target operation gesture can be obtained. Next, the gesture operation information corresponding to the target operation can be sent to the script generator, so that the script generator can generate a target test script based on the gesture operation information.
[0130] S305: Generate a target test script based on the gesture operation information corresponding to the target operation gesture, and test the Flutter application to be tested using the test cases indicated by the target test script; the gesture operation information is used to indicate the operation position and / or operation content of the target operation gesture on the target interactive page.
[0131] In this embodiment of the disclosure, after the script generator generates the target test script based on the gesture operation information corresponding to the target operation gesture, the target test script can be sent to the driver so that the driver can test the Flutter application to be tested based on the test cases indicated by the target test script. For example, the driver can be a Flutter driver.
[0132] In an optional implementation, step S303 above, which generates a target test script based on the gesture operation information corresponding to the target gesture, specifically includes the following process:
[0133] (1) Determine the target script template based on the gesture operation type of the target operation gesture;
[0134] (2) Generate the target test script based on the target script template and the gesture operation information.
[0135] In this embodiment of the disclosure, a corresponding target script template can be pre-set for the target operation gesture based on the gesture operation type. After obtaining the target operation gesture, the target script template corresponding to the target operation gesture can be determined based on the gesture operation type of the target operation gesture. Here, the gesture operation type corresponds to the aforementioned preset gesture operation type, that is, at least one of the aforementioned click operation, swipe operation, page back operation, and text input operation.
[0136] In practice, a mapping table can be established to represent the mapping relationship between the above-mentioned gesture operation types and target script templates. After obtaining the above-mentioned target operation gesture, the mapping table can be called, and the template identifier of the corresponding target script template can be found in the mapping table based on the gesture operation type of the target operation gesture. In order to call the corresponding target script template according to the template identifier, the search method of traversing all script templates to find the target script template is avoided, thus improving the speed of finding the target script template.
[0137] Furthermore, during the generation of the target test script, users can also adjust the generated target test script. For example, they can modify the execution instructions in the target test script, thereby changing the test cases indicated by the target test script. For instance, if the execution instruction in the target test script instructs the Flutter application under test to perform a double-click operation, then the execution instruction can be modified so that the modified execution instruction instructs the Flutter application under test to perform a single-click operation, thus improving the flexibility of generating target test scripts.
[0138] As described above, corresponding target operation templates can be set for target operation gestures of different gesture operation types, thereby improving the accuracy of target test script generation and increasing the efficiency of target test script generation.
[0139] In an optional implementation, step S303 above, which tests the Flutter application to be tested using the test cases indicated by the target test script, specifically includes the following process:
[0140] The target test script is input into the driver of the Flutter performance debugger, so that the driver calls the Flutter application under test to run the target test script and obtain the script test results.
[0141] In this embodiment of the disclosure, after obtaining the target test script, the target test script can be input into the driver of the Flutter performance debugger, and the driver can run the Flutter application to be tested based on the test cases in the target test script.
[0142] As described above, the driver program can call the Flutter application under test to run the target test script, thereby obtaining the script test results.
[0143] In an optional implementation, step S301 above, establishing a communication connection between the Flutter performance debugging program and the Flutter application to be tested, specifically includes the following process:
[0144] (1) Detect the WebSocket connection request sent by the Flutter application under test;
[0145] (2) If the WebSocket connection request is verified, a WebSocket communication connection is established between the WebSocket and the Flutter application to be tested.
[0146] In this embodiment of the disclosure, the Flutter performance debugging program includes a debugging extension application, wherein the debugging extension application can perform data transmission between the Flutter performance debugging program and the Flutter application to be tested based on a WebSocket communication connection, and the debugging extension application can be an extension application.
[0147] In this embodiment of the disclosure, the Flutter performance debugging program includes a debugging extension that, upon detecting a WebSocket connection request sent by the Flutter application under test, can verify the WebSocket connection request. Specifically, it can verify the device ID of the Flutter application under test. If the device ID of the Flutter application under test matches the whitelist, a WebSocket communication connection is established between the Flutter application under test and the device ID of the Flutter application under test.
[0148] As described above, once the WebSocket connection request is verified, a WebSocket communication connection can be established with the Flutter application under test, thereby improving the security of the communication connection.
[0149] In summary, in this embodiment, a communication connection is first established between the Flutter application to be tested and the Flutter performance debugger. Then, the target operation gesture of the user on the target interactive page of the Flutter application to be tested is intercepted, and the target operation gesture is sent to the Flutter performance debugger through the aforementioned communication connection. This allows the Flutter performance debugger to generate a target test script based on the target operation gesture, thereby improving the automation of generating the target test script, reducing the coding ability requirements of testers, and improving the accuracy of the generated target test script, thus expanding the scope of application of this disclosure.
[0150] Those skilled in the art will understand that, in the above-described method of the specific implementation, the order in which each step is written does not imply a strict execution order and does not constitute any limitation on the implementation process. The specific execution order of each step should be determined by its function and possible internal logic.
[0151] Based on the same inventive concept, this disclosure also provides a testing device corresponding to the testing method. Since the principle of the device in this disclosure for solving the problem is similar to the above-mentioned testing method in this disclosure, the implementation of the device can refer to the implementation of the method, and the repeated parts will not be described again.
[0152] Reference Figure 4 The diagram shown is a schematic of a testing device provided in an embodiment of this disclosure. The device is installed on a device running a Flutter application and includes: a connection unit 41, an interception unit 42, and a sending unit 43; wherein...
[0153] Connection unit 41 is used to establish a communication connection between the Flutter application to be tested and the Flutter performance debugger in response to a connection request from the Flutter performance debugger.
[0154] Interception unit 42 is used to intercept the user's target operation gestures on the target interactive page of the Flutter application to be tested;
[0155] The sending unit 43 is used to send the target operation gesture to the Flutter performance debugging program through the communication connection, so that the Flutter performance debugging program can generate a target test script based on the target operation gesture.
[0156] In this embodiment of the disclosure, a communication connection is first established between the Flutter application to be tested and the Flutter performance debugger. Then, the target operation gesture of the user on the target interactive page of the Flutter application to be tested is intercepted, and the target operation gesture is sent to the Flutter performance debugger through the aforementioned communication connection. This allows the Flutter performance debugger to generate a target test script based on the target operation gesture, thereby improving the automation of generating the target test script, reducing the coding ability requirements of testers, and improving the accuracy of the generated target test script, thus expanding the scope of application of this disclosure.
[0157] In one possible implementation, the interception unit 42 is further configured to:
[0158] Detect user actions triggered on the target interactive page;
[0159] When the triggering operation is a preset gesture operation, it is determined that the target operation gesture has been detected, wherein the preset gesture operation type includes at least one of the following: click operation, swipe operation, page back operation, and text input operation.
[0160] In one possible implementation, the target gesture is a click operation. Before sending the target gesture to the Flutter performance debugger via the communication connection, the device is further configured to:
[0161] If the target gesture is a click on the target interactive page, the click operation information is determined; the click operation information is used to indicate the click location and / or the number of click locations.
[0162] The click operation information and the operation type of the click operation are sent to the Flutter performance debugging program through the communication connection.
[0163] In one possible implementation, the target gesture is a swipe gesture. Before sending the target gesture to the Flutter performance debugger via the communication connection, the device is further configured to:
[0164] When the target gesture is the swipe gesture, the swipe gesture information is determined; the swipe gesture information is used to indicate the swipe gesture position and / or the swipe gesture speed.
[0165] The sliding operation information and the operation type of the sliding operation are sent to the Flutter performance debugging program through the communication connection.
[0166] In one possible implementation, the target gesture is a page back operation. Before sending the target gesture to the Flutter performance debugger via the communication connection, the device is further configured to:
[0167] When the target operation gesture is the page back operation, determine the back operation information of the page back operation; the back operation information is used to indicate the identifier attribute information of the page back identifier triggered by the user on the target interactive page;
[0168] The rollback operation information and the operation type of the page rollback operation are sent to the Flutter performance debugging program through the communication connection.
[0169] In one possible implementation, the target gesture is a text input operation; before sending the target gesture to the Flutter performance debugger via the communication connection, the device is further configured to:
[0170] When the target gesture is the text input gesture, the input operation information of the text input gesture is determined; the input operation information is used to indicate the text content entered by the user on the target interactive page and / or the text input position of the text input gesture.
[0171] The text operation information and the operation type of the text input operation are sent to the Flutter performance debugging program through the communication connection.
[0172] In one possible implementation, the transmitting unit 43 is further configured to:
[0173] Invoke the debug extension application in the Flutter performance debugger;
[0174] Based on the aforementioned debugging extension application, the target operation gesture is sent to the Flutter performance debugging program through the communication connection.
[0175] Reference Figure 5The diagram shown illustrates another testing apparatus provided in this embodiment of the present disclosure. It is installed on a device running a Flutter performance debugging program. The apparatus includes: a creation unit 51, an acquisition unit 52, and a generation unit 53; wherein...
[0176] Establishment unit 51 is used to establish a communication connection between the Flutter performance debugging program and the Flutter application to be tested;
[0177] The acquisition unit 52 is used to acquire the target operation gesture sent by the Flutter application under test through the communication connection, wherein the target operation gesture is the gesture operation intercepted by the Flutter application under test on the target interactive page;
[0178] The generation unit 53 is used to generate a target test script based on the gesture operation information corresponding to the target operation gesture, and to test the Flutter application to be tested through the test cases indicated by the target test script; the gesture operation information is used to indicate the operation position and / or operation content of the target operation gesture in the target interactive page.
[0179] In this embodiment of the disclosure, a communication connection is first established between the Flutter application to be tested and the Flutter performance debugger. Then, the target operation gesture sent by the Flutter application to be tested is obtained through the communication connection, so that the Flutter performance debugger generates a target test script based on the target operation gesture. This improves the automation of generating the target test script, reduces the coding ability requirements of testers, and improves the accuracy of the generated target test script, thereby expanding the scope of application of this disclosure.
[0180] In one possible implementation, the generating unit 53 is further configured to:
[0181] The target script template is determined based on the gesture operation type of the target operation gesture;
[0182] The target test script is generated based on the target script template and the gesture operation information.
[0183] In one possible implementation, the generating unit 53 is further configured to:
[0184] The target test script is input into the driver of the Flutter performance debugger, so that the driver calls the Flutter application under test to run the target test script and obtain the script test results.
[0185] In one possible implementation, the establishment unit 51 is further configured to:
[0186] Detect the WebSocket connection requests sent by the Flutter application under test;
[0187] If the WebSocket connection request passes verification, a WebSocket communication connection is established between the WebSocket and the Flutter application to be tested.
[0188] The description of the processing flow of each unit in the device and the interaction flow between each unit can be found in the relevant descriptions in the above method embodiments, and will not be detailed here.
[0189] Corresponding to Figure 1 In addition to the testing methods described herein, this disclosure also provides a computer device 600, such as... Figure 6 The diagram shown is a structural schematic of a computer device 600 provided in an embodiment of this disclosure, including:
[0190] The computer device 600 comprises a processor 61, a memory 62, and a bus 63. The memory 62 stores execution instructions and includes main memory 621 and external memory 622. Main memory 621, also called internal memory, temporarily stores computational data in the processor 61, as well as data exchanged with external memory such as a hard disk. The processor 61 exchanges data with external memory 622 through main memory 621. When the computer device 600 is running, the processor 61 communicates with the memory 62 through the bus 63, causing the processor 61 to execute the following instructions:
[0191] In response to a connection request from the Flutter performance debugger, a communication connection is established between the Flutter application to be tested and the Flutter performance debugger.
[0192] Intercept user gestures that target interactive pages of the Flutter application to be tested.
[0193] The target gesture is sent to the Flutter performance debugger via the communication connection, so that the Flutter performance debugger generates a target test script based on the target gesture.
[0194] Corresponding to Figure 3 In addition to the testing methods described herein, this disclosure also provides another computer device 700, such as... Figure 7 The diagram shown is a structural schematic of a computer device 700 provided in an embodiment of this disclosure, including:
[0195] The computer device 700 comprises a processor 71, a memory 72, and a bus 73. The memory 72 stores execution instructions and includes main memory 721 and external memory 722. The main memory 721, also called internal memory, temporarily stores the processing data in the processor 71, as well as data exchanged with external memory such as a hard disk. The processor 71 exchanges data with the external memory 722 through the main memory 721. When the computer device 700 is running, the processor 71 communicates with the memory 72 through the bus 73, causing the processor 71 to execute the following instructions:
[0196] Establish a communication connection between the Flutter performance debugger and the Flutter application to be tested;
[0197] Obtain the target operation gesture sent by the Flutter application under test through the communication connection, wherein the target operation gesture is the gesture operation intercepted by the Flutter application under test on the target interactive page;
[0198] A target test script is generated based on the gesture operation information corresponding to the target operation gesture, and the Flutter application to be tested is tested through the test cases indicated by the target test script; the gesture operation information is used to indicate the operation position and / or operation content of the target operation gesture on the target interactive page.
[0199] This disclosure also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, performs the steps of the testing method described in the above-described method embodiments. The storage medium may be a volatile or non-volatile computer-readable storage medium.
[0200] This disclosure also provides a computer program product carrying program code. The program code includes instructions that can be used to execute the steps of the testing method described in the above method embodiments. For details, please refer to the above method embodiments, which will not be repeated here.
[0201] The aforementioned computer program product can be implemented through hardware, software, or a combination thereof. In one optional embodiment, the computer program product is specifically embodied in a computer storage medium; in another optional embodiment, the computer program product is specifically embodied in a software product, such as a software development kit (SDK), etc.
[0202] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems and devices described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here. In the several embodiments provided in this disclosure, it should be understood that the disclosed systems, devices, and methods can be implemented in other ways. The device embodiments described above are merely illustrative. For example, the division of units is only a logical functional division; in actual implementation, there may be other division methods. Furthermore, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Another point is that the displayed or discussed mutual coupling or direct coupling or communication connection may be through some communication interfaces; the indirect coupling or communication connection of devices or units may be electrical, mechanical, or other forms.
[0203] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0204] In addition, the functional units in the various embodiments of this disclosure can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.
[0205] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a processor-executable, non-volatile, computer-readable storage medium. Based on this understanding, the technical solution of this disclosure, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this disclosure. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0206] Finally, it should be noted that the above-described embodiments are merely specific implementations of this disclosure, used to illustrate the technical solutions of this disclosure, and not to limit it. The protection scope of this disclosure is not limited thereto. Although this disclosure has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that any person skilled in the art can still modify or easily conceive of changes to the technical solutions described in the foregoing embodiments, or make equivalent substitutions for some of the technical features, within the scope of the technology disclosed in this disclosure. Such modifications, changes, or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this disclosure, and should all be covered within the protection scope of this disclosure. Therefore, the protection scope of this disclosure should be determined by the protection scope of the claims.
Claims
1. A testing method for testing a Flutter application under test, characterized in that, Applicable to devices running Flutter applications, including: In response to a connection request from the Flutter performance debugger, a communication connection is established between the Flutter application to be tested and the Flutter performance debugger; the Flutter performance debugger is used to generate a target test script; wherein, establishing the communication connection between the Flutter application to be tested and the Flutter performance debugger includes: verifying the device ID of the Flutter application to be tested, and establishing a WebSocket communication connection between the Flutter performance debugger and the Flutter application to be tested when the device ID of the Flutter application to be tested matches the whitelist; By calling the interceptor pre-set in the framework layer of the Flutter application under test, the target operation gesture of the user on the target interactive page of the Flutter application under test is intercepted, and the operation content of the target operation gesture is obtained; the framework layer is used to run the Flutter application under test based on the runtime of the Flutter application under test; The target operation gesture and its corresponding operation content are sent to the Flutter performance debugging program through the communication connection, so that the Flutter performance debugging program generates the target test script based on the target operation gesture and its corresponding operation content. The target test script is used to instruct the Flutter application to be tested to automatically run the target operation gesture. The Flutter performance debugger includes a debug extension application, which is configured to perform data transmission between the Flutter performance debugger and the Flutter application under test based on the WebSocket communication connection.
2. The method according to claim 1, characterized in that, The interception of user gestures on the target interactive page of the Flutter application under test includes: Detect user actions triggered on the target interactive page; When the triggering operation is a preset gesture operation, it is determined that the target operation gesture has been detected, wherein the preset gesture operation type includes at least one of the following: click operation, swipe operation, page back operation, and text input operation.
3. The method according to claim 1 or 2, characterized in that, The target gesture includes a click action; before sending the target gesture to the Flutter performance debugger via the communication connection, the method further includes: If the target gesture is a click on the target interactive page, the click operation information is determined; the click operation information is used to indicate the click location and / or the number of click locations. The click operation information and the operation type of the click operation are sent to the Flutter performance debugging program through the communication connection.
4. The method according to claim 1 or 2, characterized in that, The target gesture includes a swipe gesture; before sending the target gesture to the Flutter performance debugger via the communication connection, the method further includes: When the target gesture is the swipe gesture, the swipe gesture information is determined; the swipe gesture information is used to indicate the swipe gesture position and / or the swipe gesture speed. The sliding operation information and the operation type of the sliding operation are sent to the Flutter performance debugging program through the communication connection.
5. The method according to claim 1 or 2, characterized in that, The target gesture includes a page back operation; before sending the target gesture to the Flutter performance debugger via the communication connection, the method further includes: When the target gesture is the page back gesture, determine the back gesture information of the page back gesture; the back gesture information is used to indicate the identifier attribute information of the page back icon triggered by the user on the target interactive page; The rollback operation information and the operation type of the page rollback operation are sent to the Flutter performance debugging program through the communication connection.
6. The method according to claim 1 or 2, characterized in that, The target gesture includes text input; before sending the target gesture to the Flutter performance debugger via the communication connection, the method further includes: When the target gesture is the text input gesture, the input operation information of the text input gesture is determined; the input operation information is used to indicate the text content entered by the user on the target interactive page and / or the text input position of the text input gesture. The input operation information and the operation type of the text input operation are sent to the Flutter performance debugging program through the communication connection.
7. The method according to claim 1, characterized in that, Sending the target gesture to the Flutter performance debugging program via the communication connection includes: Invoke the debug extension application in the Flutter performance debugger; Based on the aforementioned debugging extension application, the target operation gesture is sent to the Flutter performance debugging program through the communication connection.
8. A testing method for testing a Flutter application under test, characterized in that, Applicable to devices running Flutter performance debuggers, including: Establish a communication connection between the Flutter performance debugger and the Flutter application to be tested; the Flutter performance debugger is used to generate the target test script; wherein, establishing a communication connection between the Flutter application to be tested and the Flutter performance debugger includes: verifying the device ID of the Flutter application to be tested, and establishing a WebSocket communication connection between the Flutter performance debugger and the Flutter application to be tested when the device ID of the Flutter application to be tested matches the whitelist; The target operation gesture and the operation content of the target operation gesture sent by the Flutter application under test through the communication connection are obtained. The target operation gesture is a gesture operation intercepted on the target interactive page by an interceptor pre-set in the framework layer of the Flutter application under test. The framework layer is used to run the Flutter application under test based on the running program of the Flutter application under test. The target test script is generated based on the gesture operation information corresponding to the target gesture. The target test script is used to instruct the Flutter application under test to automatically run the target gesture, and to test the Flutter application under test through the test cases indicated by the target test script. The gesture operation information is used to indicate the operation position and / or operation content of the target gesture on the target interactive page. The Flutter performance debugger includes a debug extension application, which is configured to perform data transmission between the Flutter performance debugger and the Flutter application under test based on the WebSocket communication connection.
9. The method according to claim 8, characterized in that, The step of generating a target test script based on the gesture operation information corresponding to the target gesture includes: The target script template is determined based on the gesture operation type of the target operation gesture; The target test script is generated based on the target script template and the gesture operation information.
10. The method according to claim 8, characterized in that, The testing of the Flutter application under test using the test cases indicated by the target test script includes: The target test script is input into the driver of the Flutter performance debugger, so that the driver calls the Flutter application under test to run the target test script and obtain the script test results.
11. The method according to claim 8, characterized in that, Establishing a communication connection between the Flutter performance debugger and the Flutter application to be tested includes: Detect the WebSocket connection requests sent by the Flutter application under test; If the WebSocket connection request passes verification, a WebSocket communication connection is established between the WebSocket and the Flutter application to be tested.
12. A testing apparatus for testing a Flutter application to be tested, characterized in that, Configured on devices running Flutter applications, including: A connection unit is configured to establish a communication connection between the Flutter application under test and the Flutter performance debugger in response to a connection request from the Flutter performance debugger; the Flutter performance debugger is configured to generate a target test script; wherein, establishing a communication connection between the Flutter application under test and the Flutter performance debugger includes: verifying the device ID of the Flutter application under test, and establishing a WebSocket communication connection between the Flutter performance debugger and the Flutter application under test when the device ID of the Flutter application under test matches the whitelist; An interception unit is pre-configured in the framework layer of the Flutter application under test, and is used to intercept the user's target operation gestures on the target interactive page of the Flutter application under test; the framework layer is used to run the Flutter application under test based on the application's runtime program. A sending unit is configured to send the target operation gesture and the operation content of the target operation gesture to the Flutter performance debugging program through the communication connection, so that the Flutter performance debugging program generates the target test script based on the target operation gesture and the corresponding operation content. The target test script is used to instruct the Flutter application to be tested to automatically run the target operation gesture. The Flutter performance debugger includes a debug extension application, which is configured to perform data transmission between the Flutter performance debugger and the Flutter application under test based on the WebSocket communication connection.
13. A testing apparatus for testing a Flutter application to be tested, characterized in that, The settings are configured on devices running the Flutter performance debugger, including: A setup unit is used to establish a communication connection between the Flutter performance debugger and the Flutter application to be tested; the Flutter performance debugger is used to generate a target test script; wherein, establishing a communication connection between the Flutter application to be tested and the Flutter performance debugger includes: verifying the device ID of the Flutter application to be tested, and establishing a WebSocket communication connection between the Flutter performance debugger and the Flutter application to be tested when the device ID of the Flutter application to be tested matches the whitelist; The acquisition unit is used to acquire the target operation gesture sent by the Flutter application under test through the communication connection and the operation content of the target operation gesture, wherein the target operation gesture is a gesture operation intercepted on the target interactive page by an interceptor pre-set in the framework layer of the Flutter application under test, and the framework layer is used to run the Flutter application under test based on the running program of the Flutter application under test; The generation unit is used to generate a target test script based on the gesture operation information corresponding to the target gesture. The target test script is used to instruct the Flutter application under test to automatically run the target gesture and to test the Flutter application under test through the test cases indicated by the target test script. The gesture operation information is used to indicate the operation position and / or operation content of the target gesture on the target interactive page. The Flutter performance debugger includes a debug extension application, which is configured to perform data transmission between the Flutter performance debugger and the Flutter application under test based on the WebSocket communication connection.
14. A computer device, characterized in that, include: The computer device includes a processor, a memory, and a bus. The memory stores machine-readable instructions executable by the processor. When the computer device is running, the processor communicates with the memory via the bus. When the machine-readable instructions are executed by the processor, the steps of the test method as described in any one of claims 1 to 11 are performed.
15. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, performs the steps of the test method as described in any one of claims 1 to 11.
Citation Information
Patent Citations
System and method for achieving UI automatic test of intelligent terminal
CN106021099A
Gesture testing method and device, computer equipment and a storage medium
CN107783867A