Automatic test execution method and device, storage medium and electronic device
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-30
- Publication Date
- 2026-03-31
AI Technical Summary
[0005]本申请实施例提供了一种自动化测试的执行方法及装置、存储介质及电子装置,以至少解决相关技术中Linux系统仅支持ADB命令行工具中的极少几个工具,无法实现对部署有Linux系统的面板设备的自动化测试的问题
[0017]通过本申请,在目标对象对部署有预设系统的面板设备执行目标操作的情况下,通过预先注入在所述预设系统的软件开发工具包中的解析工具解析出所述目标操作对应的m条组合命令;其中,在所述解析工具未注入到所述软件开发工具包的情况下,所述解析工具是预设命令行工具中不允许在所述预设系统中运行的工具;其中,m是正整数;通过发送工具将根据所述m条组合命令确定的操作事件发送给所述面板设备;其中,所述发送工具是所述预设命令行工具中允许在所述预设系统中运行的工具;通过所述面板设备执行所述操作事件,以执行对所述面板设备的自动化测试。因此,采用上述技术方案,解决了相关技术中Linux系统仅支持ADB命令行工具中的极少几个工具,无法实现对部署有Linux系统的面板设备的自动化测试的问题;从而通过将预设命令行工具中不允许在预设系统中运行的解析工具注入到预设系统的软件开发工具包,使得注入后的该解析工具可以在预设系统中运行,进而实现了对部署有Linux系统的面板设备的自动化测试。
Smart Images

Figure CN121764779A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of smart home technology, and more specifically, to an automated testing execution method and apparatus, storage medium and electronic device. Background Technology
[0002] There are many automated testing methods for Android and iOS platforms, such as Appium, Airtest, and Fastbot, which are quite popular. However, these methods are only compatible with Android and iOS platforms. More specifically, while Android platforms can use the ADB (Android Debug Bridge) command-line tool for automated testing, Linux platforms only support a very limited number of tools from the Android ADB command-line tool, such as the sentevent tool, and do not support getevent events, monkey tools, or monkeyrunner tools from the ADB command-line tool. Consequently, a host machine cannot be found, or the handle of the current interface cannot be obtained, making automated testing impossible.
[0003] Regarding the issues that Linux systems (i.e., Linux platforms) only support a very limited number of tools in the ADB command-line tools, making it impossible to automate the testing of panel devices deployed with Linux systems, no effective solution has yet been proposed.
[0004] Therefore, it is necessary to improve the relevant technology to overcome the aforementioned defects. Summary of the Invention
[0005] This application provides an automated testing execution method and apparatus, storage medium and electronic device to at least solve the problem in the related art that the Linux system only supports a very small number of tools in the ADB command line tool, and cannot realize automated testing of panel devices deployed with the Linux system.
[0006] According to one aspect of the embodiments of this application, an automated testing execution method is provided, comprising: when a target object performs a target operation on a panel device with a preset system deployed thereon, parsing m combined commands corresponding to the target operation using a parsing tool pre-injected into the software development kit (SDK) of the preset system; wherein, if the parsing tool is not injected into the SSD, the parsing tool is a tool in a preset command-line tool that is not allowed to run in the preset system; wherein m is a positive integer; sending an operation event determined according to the m combined commands to the panel device using a sending tool; wherein the sending tool is a tool in the preset command-line tool that is allowed to run in the preset system; and executing the operation event through the panel device to perform automated testing on the panel device.
[0007] In an exemplary embodiment, the m combined commands corresponding to the target operation are parsed by a parsing tool pre-injected into the software development kit of the preset system. This includes: determining the operation coordinates of the target operation on the panel device based on the horizontal and vertical resolutions of the panel device; parsing the event flow information corresponding to the target operation based on the operation coordinates using the parsing tool; and extracting the m combined commands from the event flow information.
[0008] In an exemplary embodiment, determining the operation coordinates corresponding to the target operation on the panel device based on the horizontal and vertical resolutions of the panel device includes: determining the coordinate layout of the panel device using the horizontal and vertical resolutions of the panel device; if the target operation is a click operation, determining the click coordinates of the click operation determined according to the coordinate layout as the operation coordinates; if the target operation is a swipe operation, determining the start and end coordinates of the swipe operation determined according to the coordinate layout as the operation coordinates.
[0009] In an exemplary embodiment, sending an operation event determined based on the m combined commands to the panel device via a sending tool includes: performing a number system conversion on the m combined commands; determining the operation event using the number system-converted m combined commands; and sending the operation event to the panel device via the sending tool.
[0010] In an exemplary embodiment, executing the operation event through the panel device to perform automated testing of the panel device includes: determining the operation intent of the target operation through the panel device based on the operation event; performing a control operation on the target smart device corresponding to the operation intent through the panel device based on the operation intent; wherein, the multiple smart devices that have a binding relationship with the panel device include: the target smart device; and determining the test result of the automated testing of the panel device based on the feedback information of the target smart device.
[0011] In an exemplary embodiment, determining the operation intent of the target operation based on the operation event by the panel device includes: obtaining the coordinate size assigned by the panel device to the plurality of smart devices respectively; determining the target coordinate size that the operation event hits among the plurality of coordinate sizes; and determining the operation intent based on the target coordinate size.
[0012] In an exemplary embodiment, determining the test result of the automated test of the panel device based on the feedback information from the target smart device includes: upon receiving the feedback information from the target smart device, acquiring the logs of the panel device captured between a first time and a second time; wherein the first time is the time when the target object performs a target operation on the panel device with a preset system deployed, and the second time is the time when the feedback information from the target smart device is received; the logs include at least one of the following: application layer logs and system logs; if crash information exists in the logs, determining the test result of the automated test of the panel device as a test failure; if no crash information exists in the logs, determining the test result of the automated test of the panel device as a test success.
[0013] According to another aspect of the embodiments of this application, an automated testing execution device is also provided, comprising: a parsing module, configured to parse m combined commands corresponding to the target operation by means of a parsing tool pre-injected in the software development kit of the preset system when the target object performs a target operation on the panel device on which the preset system is deployed; wherein, if the parsing tool is not injected into the software development kit, the parsing tool is a tool in the preset command-line tools that is not allowed to run in the preset system; wherein, m is a positive integer; a sending module, configured to send an operation event determined according to the m combined commands to the panel device by means of a sending tool; wherein, the sending tool is a tool in the preset command-line tools that is allowed to run in the preset system; and an execution module, configured to execute the operation event through the panel device to perform automated testing on the panel device.
[0014] According to another aspect of the embodiments of this application, a computer-readable storage medium is also provided, wherein a computer program is stored in the computer program, and the computer program is configured to execute the above-described automated test execution method at runtime.
[0015] According to another aspect of the embodiments of this application, an electronic device is also provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the above-mentioned automated test execution method through the computer program.
[0016] According to another aspect of the embodiments of this application, a computer program product is also provided, including a computer program that, when executed by a processor, implements the above-described automated testing execution method.
[0017] This application addresses the problem in related technologies where Linux systems only support a limited number of tools in the ADB command-line toolkit, making automated testing of Linux-based panel devices impossible. By injecting a parsing tool (not allowed to run in the preset system) into the software development kit (SDK) of the preset system, m combined commands corresponding to the target operation are obtained. If the parsing tool is not injected into the SSD, it is a tool in the preset command-line tools that is not permitted to run in the preset system. Here, m is a positive integer. A sending tool, which is a tool in the preset command-line tools that is permitted to run in the preset system, is then used to send the operation event to the panel device. The panel device executes the operation event to perform automated testing of the panel device. Therefore, this technical solution solves the problem in related technologies where Linux systems only support a very limited number of tools in the ADB command-line tools, making automated testing of Linux-based panel devices impossible. By injecting a parsing tool (not permitted to run in the preset system) into the SSD of the preset system, the injected parsing tool can run in the preset system, thereby achieving automated testing of Linux-based panel devices. Attached Figure Description
[0018] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.
[0019] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0020] Figure 1 This is a schematic diagram of the hardware environment for an optional automated testing execution method according to an embodiment of this application;
[0021] Figure 2 This is a flowchart of an optional automated testing execution method according to an embodiment of this application;
[0022] Figure 3 This is another flowchart of an optional automated test execution method according to an embodiment of this application;
[0023] Figure 4 This is a schematic diagram of a DaVinci Resolve panel for an optional automated test execution method according to an embodiment of this application;
[0024] Figure 5 This is a schematic diagram of the event flow information of an optional automated test execution method according to an embodiment of this application;
[0025] Figure 6 This is a schematic diagram of the command format for an optional automated testing execution method according to an embodiment of this application;
[0026] Figure 7 This is a schematic diagram of the parameter conversion process of an optional automated testing execution method according to an embodiment of this application;
[0027] Figure 8 This is a structural block diagram of an optional automated testing execution device according to an embodiment of this application. Detailed Implementation
[0028] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.
[0029] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0030] According to one aspect of the embodiments of this application, an automated testing execution method is provided. This automated testing execution method is widely applicable to whole-house intelligent digital control application scenarios such as smart homes, smart home ecosystems, and intelligencehouse ecosystems. Optionally, in this embodiment, the above-mentioned automated testing execution method can be applied to, for example... Figure 1 The hardware environment shown consists of multiple terminal devices 102 and a server 104. For example... Figure 1 As shown, server 104 is connected to multiple terminal devices 102 via a network and can be used to provide services (such as application services) to terminals or clients installed on terminals. A database can be set up on the server or independently of the server to provide data storage services for server 104. Cloud computing and / or edge computing services can be configured on the server or independently of the server to provide data processing services for server 104.
[0031] The aforementioned network may include, but is not limited to, at least one of the following: wired network, wireless network. The aforementioned wired network may include, but is not limited to, at least one of the following: wide area network, metropolitan area network, local area network. The aforementioned wireless network may include, but is not limited to, at least one of the following: Wi-Fi (Wireless Fidelity), Bluetooth. The terminal device 102 may not be limited to PC, mobile phone, tablet computer, smart air conditioner, smart range hood, smart refrigerator, smart oven, smart stove, smart washing machine, smart water heater, smart washing equipment, smart dishwasher, smart projector, smart TV, smart clothes rack, smart curtains, smart audio-visual equipment, smart socket, smart speaker, smart speaker box, smart fresh air equipment, smart kitchen and bathroom equipment, smart bathroom equipment, smart robot vacuum cleaner, smart window cleaning robot, smart mopping robot, smart air purifier, smart steam oven, smart microwave oven, smart water heater, smart air purifier, smart water dispenser, smart door lock, etc.
[0032] This embodiment provides a method for executing automated tests, including but not limited to panel devices with pre-defined systems deployed on them. Figure 2 This is a flowchart of an automated testing execution method according to an embodiment of this application, the process including the following steps:
[0033] Step S202: When the target object performs a target operation on a panel device with a preset system, the m combined commands corresponding to the target operation are parsed by a parsing tool pre-injected into the software development kit of the preset system; wherein, if the parsing tool is not injected into the software development kit, the parsing tool is a tool in the preset command line tools that is not allowed to run in the preset system; wherein, m is a positive integer;
[0034] It should be noted that the default system is Linux, and the default command-line tool is ADB. The target operation includes at least one of the following: click operation, swipe operation.
[0035] Step S204: Send the operation events determined according to the m combined commands to the panel device through a sending tool; wherein, the sending tool is a tool among the preset command line tools that is allowed to run in the preset system;
[0036] Step S206: Execute the operation event through the panel device to perform automated testing of the panel device.
[0037] Through the above steps, when the target object performs a target operation on a panel device with a preset system, a parsing tool pre-injected into the software development kit (SDK) of the preset system parses out m combined commands corresponding to the target operation; wherein, if the parsing tool is not injected into the SSD, the parsing tool is a tool in the preset command-line tools that is not allowed to run in the preset system; wherein m is a positive integer; the operation event determined according to the m combined commands is sent to the panel device by a sending tool; wherein the sending tool is a tool in the preset command-line tools that is allowed to run in the preset system; the operation event is executed by the panel device to perform automated testing of the panel device. Therefore, by adopting the above technical solution, the problem in related technologies that Linux systems only support a very small number of tools in the ADB command-line tools, making it impossible to achieve automated testing of panel devices with Linux systems is solved; thus, by injecting a parsing tool that is not allowed to run in the preset system into the SSD of the preset system, the injected parsing tool can run in the preset system, thereby realizing automated testing of panel devices with Linux systems.
[0038] In an exemplary embodiment, the m combined commands corresponding to the target operation are parsed by a parsing tool pre-injected into the software development kit of the preset system. This includes: determining the operation coordinates of the target operation on the panel device based on the horizontal and vertical resolutions of the panel device; parsing the event flow information corresponding to the target operation based on the operation coordinates using the parsing tool; and extracting the m combined commands from the event flow information.
[0039] It is understood that the panel device can be a DaVinci Resolve panel or a DaVinci Resolve screen. The DaVinci Resolve screen's X-axis resolution (horizontal axis resolution) can be obtained using the command `fbset|grep geometry|awk'{printf$2}'`; the DaVinci Resolve screen's Y-axis resolution (vertical axis resolution) can be obtained using the command `fbset|grep geometry|awk'{printf$3}'`. The obtained horizontal and vertical axis resolutions are then combined to determine the operation coordinates of the target object's operation. The pre-injected parsing tools in the software development kit are then used to parse the event flow information of the target operation based on the operation coordinates, and m combined commands are extracted.
[0040] It should be noted that the event stream information consists of multiple combined commands, including the m combined commands.
[0041] Furthermore, determining the operation coordinates corresponding to the target operation on the panel device based on the horizontal and vertical resolutions of the panel device includes: determining the coordinate layout of the panel device using the horizontal and vertical resolutions of the panel device; if the target operation is a click operation, determining the click coordinates of the click operation determined according to the coordinate layout as the operation coordinates; if the target operation is a swipe operation, determining the start and end coordinates of the swipe operation determined according to the coordinate layout as the operation coordinates.
[0042] More specifically, when the target operation is a sliding operation, the operation coordinates, in addition to the starting coordinates and the ending coordinates, also include the coordinates of the sliding step size between the starting coordinates and the ending coordinates.
[0043] In an exemplary embodiment, sending an operation event determined based on the m combined commands to the panel device via a sending tool includes: performing a number system conversion on the m combined commands; determining the operation event using the number system-converted m combined commands; and sending the operation event to the panel device via the sending tool.
[0044] It should be noted that operation events include: click events corresponding to click operations and swipe events corresponding to swipe operations.
[0045] It should also be noted that for click events, m = 8; for swipe events, m = 13. The m combined commands extracted from the event stream information are represented in hexadecimal. These hexadecimal combined commands are converted into decimal combined commands, and the resulting m combined commands constitute the operation event, which can be sent to the panel device.
[0046] In an exemplary embodiment, executing the operation event through the panel device to perform automated testing of the panel device includes: determining the operation intent of the target operation through the panel device based on the operation event; performing a control operation on the target smart device corresponding to the operation intent through the panel device based on the operation intent; wherein, the multiple smart devices that have a binding relationship with the panel device include: the target smart device; and determining the test result of the automated testing of the panel device based on the feedback information of the target smart device.
[0047] Optionally, determining the operation intent of the target operation based on the operation event using the panel device includes: obtaining the coordinate sizes assigned by the panel device to the plurality of smart devices respectively; determining the target coordinate size that the operation event hits among the plurality of coordinate sizes; and determining the operation intent based on the target coordinate size.
[0048] Understandably, the identifiers of multiple smart devices that are paired with the panel device will be displayed on the panel device, and the target object can control these multiple smart devices by touching the panel device. The target coordinates of the operation event corresponding to the target operation performed by the target object, within the coordinates allocated to each of the multiple smart devices, can indicate the target object's operational intent.
[0049] Then, the panel device performs control operations on the target smart device corresponding to the operation intention according to the operation intention. For example, it can turn on the target smart device or instruct the target smart device to perform an operation that the target smart device can perform. This control operation can be achieved by sending a corresponding control command to the target device, and the target smart device will send back the execution result of the control command (i.e., feedback information) to the panel device.
[0050] In some optional embodiments, determining the test result of the automated test of the panel device based on the feedback information from the target smart device includes: upon receiving the feedback information from the target smart device, acquiring the logs of the panel device captured between a first time and a second time; wherein the first time is the time when the target object performs the target operation on the panel device with the preset system deployed, and the second time is the time when the feedback information from the target smart device is received; the logs include at least one of the following: application layer logs and system logs; if crash information exists in the logs, determining the test result of the automated test of the panel device as a test failure; if no crash information exists in the logs, determining the test result of the automated test of the panel device as a test success.
[0051] Optionally, logs may also include: logcat logs and UI layer logs.
[0052] Obviously, the embodiments described above are only some embodiments of this application, and not all embodiments. To better understand the above-described automated testing execution method, the process is explained below with reference to embodiments, but this is not intended to limit the technical solutions of the embodiments of this application. Specifically:
[0053] This application provides a method and apparatus for testing Flutter-Linux (DaVinci Linux panel) (equivalent to the automated testing execution method and apparatus in the above embodiments), used for automated testing of the DaVinci Linux platform panel, simulating user (i.e., target object) screen clicks (i.e., click operations) and screen swipes (i.e., swipe operations) events to perform repetitive automated testing, thereby checking whether the Linux system has bugs such as memory leaks and crashes. Specifically, this application starts with the sentevent event (equivalent to a sending tool), injecting the getevent event (equivalent to a parsing tool) into the uhome sdk (equivalent to a software development kit). The getevent event parses each step of the user operation, and then the sentevent event simulates each user operation and sends it to the device for processing, achieving Linux screen invalid monkey testing and ordered UI automated testing.
[0054] First, regarding unordered tests (which fall under automated testing):
[0055] A monkey test process for random screen coordinate clicks in an embodiment of this application is as follows: Figure 3 As shown, it includes:
[0056] Step 1.1: Obtain the X-axis resolution of the DaVinci Resolve screen using the command `fbset|grep geometry|awk'{printf$2}'`; obtain the Y-axis resolution of the DaVinci Resolve screen using the command `fbset|grep geometry|awk'{printf$3}'`. The DaVinci Resolve screen is shown below. Figure 4 As shown.
[0057] Step 1.2: Randomly generate (X,Y) coordinate points.
[0058] Step 1.3: Click on a randomly generated coordinate point (X,Y) on the screen (i.e., click coordinates), and send 8 combined commands through sentevent / dev / input / event1 to realize a click event.
[0059] Step 1.4: Send a click event with a 1-second delay.
[0060] Step 1.5: Implement click events using the While loop.
[0061] The specific implementation code for steps 1.1 to 1.5 above includes, but is not limited to:
[0062] monkey.sh
[0063] monkey.sh
[0064] LCD_X_MAX=`fbset|grep geometry|awk'{printf$2}'`
[0065] LCD_Y_MAX=`fbset|grep geometry|awk'{printf$3}'`
[0066]
[0067] It should be noted that the monkey execution command is: `adb shell monkey.sh`. This monkey test only supports randomly clicking coordinates and executing it N times to check system memory consumption and crashes.
[0068] Secondly, regarding ordered tests (which fall under automated testing):
[0069] The ordered test includes: pre-injecting getevent events into the uhome sdk of the Linux system, and then obtaining the screen event stream (equivalent to the event stream information in the above embodiment) through the getevent events.
[0070] It's important to note that Linux systems only support `sendevent` events, not `getevent` events. Therefore, it's necessary to inject `getevent` events (essentially a parsing tool) into the UHome SDK. The `getevent` source file is a library within the Google Android SDK, and injection methods include:
[0071] adb push\\localpath\\getevent / usr / bin / getevent
[0072] adb shell
[0073] chmod 755 / usr / bin / getevent
[0074] Optionally, the screen event stream can be obtained via the getevent event, including:
[0075] 1) getevent:
[0076] Once the DaVinci Resolve device (i.e., the panel device) is successfully connected to the computer via USB or Wi-Fi, enter the adb shell and type `getevent`. This will retrieve all the trigger event streams on the DaVinci Resolve screen (equivalent to the event stream information in the above embodiment). Output the basic information of all event devices; the screen event is event1.
[0077] Click events and swipe events are parsed from the event1 command, such as... Figure 5 As shown. Each event is a combination of multiple commands and is displayed in hexadecimal.
[0078] It should be noted that, in Figure 5 In the output format, it is: "Device name: event type event code event value". Related commands include: getevent -c 10 / / Outputs 10 messages and exits; getevent –l / / Displays type, code, and value with their corresponding constant names.
[0079] 2) sentevent:
[0080] Sendevent is used to send event commands, simulating event operations. The command format is as follows: Figure 6 As shown. In Figure 6 In this example, the output of the `getevent` command is different from the output of the `type`, `code`, and `value`, which are all in decimal.
[0081] 3) Click event:
[0082] Get 8 combined commands from the getevent click event and assemble them into a sendevent command. The getevent parameter is in hexadecimal, which needs to be converted to decimal when performing sendevent.
[0083] The implementation mechanisms include:
[0084] Step 1: After connecting the DaVinci Resolve device to the computer, use the getevent event to capture the click event and click at position (279, 175) on the screen. A click event is actually composed of a down event and an up event. The event stream obtained by getevent is as follows.
[0085] getevent click event:
[0086] / dev / input / event1:0001 014a 00000001
[0087] / dev / input / event1:0003 0035 0000011e
[0088] / dev / input / event1:0003 0036 000003e9
[0089] / dev / input / event1:0003 0030 00000017
[0090] / dev / input / event1:0003 0032 00000017
[0091] / dev / input / event1:0003 0039 00000000
[0092] / dev / input / event1:0000 0002 00000000
[0093] / dev / input / event1:0000 0000 00000000
[0094] / dev / input / event1:0003 0035 0000011e
[0095] / dev / input / event1:0003 0036 000003e9
[0096] / dev / input / event1:0003 0030 00000017
[0097] / dev / input / event1:0003 0032 00000017
[0098] / dev / input / event1:0003 0039 00000000 / dev / input / event1:0000 000200000000 / dev / input / event1:0000 0000 00000000 / dev / input / event1:0003 00350000011e / dev / input / event1:0003 0036 000003e9 / dev / input / event1:0003 003000000017 / dev / input / event1:0003 0032 00000017 / dev / input / event1:0003 003900000000 / dev / input / event1:0000 0002 00000000 / dev / input / event1:0000 000000000000 / dev / input / event1:0003 0035 0000011e / dev / input / event1:0003 0036000003e9 / dev / input / event1:0003 0030 00000017 / dev / input / event1:0003 003200000017 / dev / input / event1:0003 0039 00000000 / dev / input / event1:0000 000200000000 / dev / input / event1:0000 0000 00000000 / dev / input / event1:0003 00350000011e / dev / input / event1:0003 0036 000003e9 / dev / input / event1:0003 003000000017 / dev / input / event1:0003 0032 00000017 / dev / input / event1:0003 003900000000
[0099] / dev / input / event1:0000 0002 00000000
[0100] / dev / input / event1:0000 0000 00000000
[0101] / dev / input / event1:0001 014a 00000000
[0102] / dev / input / event1:0000 0000 00000000
[0103] Step 2: Extract the 8 combined commands and perform parameter conversion. The parameter conversion process is as follows: Figure 7 As shown.
[0104] Step 3: Use the sentevent command to send a click event to the device using the 8 combined commands after conversion. The device screen coordinates are (279, 175).
[0105] sendevent click event
[0106] #click(279,175)
[0107] sendevent / dev / input / event1 1 330 1 / / touch
[0108] sendevent / dev / input / event1 3 53 279 / / X coordinate point
[0109] sendevent / dev / input / event1 3 54 175 / / Y coordinate point
[0110] sendevent / dev / input / event1 3 57 0
[0111] sendevent / dev / input / event1 0 2 0
[0112] sendevent / dev / input / event1 0 0 0
[0113] sendevent / dev / input / event1 1 330 0 / / untouch
[0114] sendevent / dev / input / event1 0 0 0 / / it must have
[0115] Step 4: After clicking the screen once, there will be a 1-second delay.
[0116] sleep 1
[0117] 4) Slide event:
[0118] Retrieve 13 combined commands from the getevent sliding event and assemble them into a sendevent command. The getevent parameter is in hexadecimal, which needs to be converted to decimal when performing sendevent.
[0119] The implementation mechanisms include:
[0120] Step 1: After connecting the DaVinci Resolve device to the computer, use the getevent event to obtain the sliding event and draw a horizontal straight line on the screen starting at (700, 175) and ending at (279, 175). The sliding event consists of a down event, the starting point coordinates, the step point coordinates, the ending point coordinates, and an up event, etc. Getevent retrieves the event stream.
[0121] Step 2: Extract the combined commands of the 13 sliding events and convert the parameters.
[0122] Step 3: Use the sentevent command to send a sliding event to the device using the 13 combined commands after conversion, and draw a horizontal straight line on the screen starting at (700, 175) and ending at (279, 175).
[0123] sendevent swipe event
[0124] #swipe(700,175)(279,175)
[0125] sendevent / dev / input / event1 1 330 1 / / touch
[0126] sendevent / dev / input / event1 3 53 700 / / start from point x
[0127] sendevent / dev / input / event1 3 54 175 / / start from point y
[0128] sendevent / dev / input / event1 3 57 0
[0129] sendevent / dev / input / event1 0 2 0
[0130] sendevent / dev / input / event1 0 0 0
[0131] sendevent / dev / input / event1 3 53 279 / / end point x
[0132] sendevent / dev / input / event1 3 54 175 / / end point y
[0133] sendevent / dev / input / event1 3 57 0
[0134] sendevent / dev / input / event1 0 2 0
[0135] sendevent / dev / input / event1 0 0 0
[0136] sendevent / dev / input / event1 1 330 0 / / untouch
[0137] sendevent / dev / input / event1 0 0 0 / / it must have
[0138] Step 4: After clicking the screen once, there will be a 1-second delay.
[0139] sleep 1
[0140] It should be noted that getevent outputs in hexadecimal, while sentevent uses decimal; be sure to convert accordingly. The output of the getevent command varies depending on the device, but they are similar.
[0141] Finally, this application provides a Da Vinci panel scene example.
[0142] Da Vinci Panel Figure 4 As shown. The functional test cases executed on this DaVinci Resolve panel included: 1) Prerequisites: The DaVinci Resolve panel was configured using relevant software, and devices such as Zigbee lights, curtains, and smart switches in the scene were bound together. Automatic and manual scenes were also created. 2) Test steps: Each device was controlled individually on the DaVinci Resolve panel. 3) Test results: Each Zigbee device was successfully controlled, and the panel operated normally without crashing.
[0143] Furthermore, the automated implementation of da Vinci panel scene instances includes:
[0144] Step 3.1: Use the commands fbset|grep geometry|awk'{printf$2}' and fbset|grep geometry|awk'{printf$3}' to obtain the horizontal and vertical resolutions (1440, 720) of the DaVinci Resolve panel.
[0145] Step 3.2: Calculate the coordinate size allocated to each device on the screen.
[0146] Step 3.3: Use a nested for loop to retrieve the coordinates of each Zigbee sub-device and send them to the device via a click event (a combination of 8 sendevent commands). Since it takes time for the command to be executed on each device before the device responds and returns to the DaVinci Resolve panel, each operation is checked for 20 seconds. Control and execute operations on each Zigbee sub-device one by one.
[0147] Step 3.4: After completing the device operation on the first page, scroll down to the next page to continue the control operation. Use the sentevent command to send a sliding event to the device and draw a horizontal line on the screen starting at (700, 175) and ending at (279, 175).
[0148] Step 3.5: The script executes simultaneously to capture logcat logs, application layer logs, UI layer logs, and system logs.
[0149] Step 3.6: After the script finishes execution, check the logs for crash information. Specifically, the script is implemented as follows:
[0150]
[0151]
[0152]
[0153] In summary, the embodiments of this application realize unordered stress automated testing and ordered UI automated testing; improve the testing working method of Flutter-Linux (DaVinci Linux panel) platform, and achieve the technical effects of improving testing efficiency and quality, shortening the testing cycle, and saving costs.
[0154] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods according to the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods of the various embodiments of this application.
[0155] This embodiment also provides an automated testing execution device for implementing the above embodiments and preferred embodiments; details already described will not be repeated. As used below, the term "module" can refer to a combination of software and / or hardware that performs a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, hardware implementations, or a combination of software and hardware, are also possible and contemplated.
[0156] Figure 8 This is a structural block diagram of an optional automated testing execution device according to an embodiment of this application. The device includes:
[0157] The parsing module 82 is used to parse m combined commands corresponding to the target operation when the target object performs a target operation on a panel device with a preset system deployed thereon, by using a parsing tool pre-injected into the software development kit of the preset system; wherein, if the parsing tool is not injected into the software development kit, the parsing tool is a tool in the preset command line tools that is not allowed to run in the preset system; wherein m is a positive integer;
[0158] The target operation includes at least one of the following: a click operation and a swipe operation;
[0159] The sending module 84 is used to send the operation events determined according to the m combined commands to the panel device through a sending tool; wherein, the sending tool is a tool among the preset command line tools that is allowed to run in the preset system;
[0160] Execution module 86 is used to execute the operation event through the panel device to perform automated testing of the panel device.
[0161] Using the above-described apparatus, when a target object performs a target operation on a panel device with a preset system, a parsing tool pre-injected into the software development kit (SDK) of the preset system parses m combined commands corresponding to the target operation. Where the parsing tool is not injected into the SSD, it is a tool among the preset command-line tools that is not allowed to run in the preset system; where m is a positive integer. A sending tool, determined based on the m combined commands, sends the operation event to the panel device; where the sending tool is a tool among the preset command-line tools that is allowed to run in the preset system. The panel device executes the operation event to perform automated testing of the panel device. Therefore, this technical solution solves the problem in related technologies where Linux systems only support a very limited number of tools in the ADB command-line tools, making automated testing of panel devices with Linux systems impossible. By injecting a parsing tool, which is not allowed to run in the preset system, into the SSD of the preset system, the injected parsing tool can run in the preset system, thereby achieving automated testing of panel devices with Linux systems.
[0162] In an exemplary embodiment, the parsing module 82 is further configured to: determine the operation coordinates corresponding to the target operation on the panel device based on the horizontal and vertical resolutions of the panel device; parse the event stream information corresponding to the target operation based on the operation coordinates using the parsing tool; and extract the m combined commands from the event stream information.
[0163] In an exemplary embodiment, the parsing module 82 is further configured to: determine the coordinate layout of the panel device based on the horizontal and vertical resolutions of the panel device; if the target operation is a click operation, determine the click coordinates of the click operation determined according to the coordinate layout as the operation coordinates; if the target operation is a swipe operation, determine the start and end coordinates of the swipe operation determined according to the coordinate layout as the operation coordinates.
[0164] In an exemplary embodiment, the sending module 84 is further configured to: perform a number system conversion on the m combined commands; determine the operation event based on the number system converted m combined commands; and send the operation event to the panel device through the sending tool.
[0165] In an exemplary embodiment, the execution module 86 is further configured to: determine the operation intent of the target operation through the panel device based on the operation event; perform a control operation on the target smart device corresponding to the operation intent through the panel device based on the operation intent; wherein, the multiple smart devices that have a binding relationship with the panel device include: the target smart device; and determine the test result of the automated test of the panel device based on the feedback information of the target smart device.
[0166] In an exemplary embodiment, the execution module 86 is further configured to: obtain the coordinate sizes allocated by the panel device to the plurality of smart devices respectively; determine the target coordinate size in which the operation event hits among the plurality of coordinate sizes; and determine the operation intention through the target coordinate size.
[0167] In an exemplary embodiment, the execution module 86 is further configured to: upon receiving feedback information from the target smart device, acquire logs of the panel device captured between a first time and a second time; wherein the first time is the time when the target object performs a target operation on the panel device with a preset system deployed, and the second time is the time when the feedback information from the target smart device is received; the logs include at least one of the following: application layer logs and system logs; if crash information exists in the logs, determine that the test result of the automated test of the panel device is a test failure; if no crash information exists in the logs, determine that the test result of the automated test of the panel device is a test success.
[0168] Embodiments of this application also provide a computer-readable storage medium storing a computer program, wherein the computer program is configured to execute the steps in any of the above method embodiments when run.
[0169] Optionally, in this embodiment, the storage medium may be configured to store a computer program for performing the following steps:
[0170] S1, when the target object performs a target operation on a panel device with a preset system, the m combined commands corresponding to the target operation are parsed by a parsing tool pre-injected into the software development kit of the preset system; wherein, if the parsing tool is not injected into the software development kit, the parsing tool is a tool in the preset command line tools that is not allowed to run in the preset system; wherein, m is a positive integer;
[0171] S2, the operation events determined according to the m combined commands are sent to the panel device via a sending tool; wherein, the sending tool is a tool among the preset command line tools that is allowed to run in the preset system;
[0172] S3, execute the operation event through the panel device to perform automated testing of the panel device.
[0173] In one exemplary embodiment, the aforementioned computer-readable storage medium may include, but is not limited to, various media capable of storing computer programs, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard disk, magnetic disk, or optical disk.
[0174] Specific examples in this embodiment can be found in the examples described in the above embodiments and exemplary implementations, and will not be repeated here.
[0175] Embodiments of this application also provide an electronic device including a memory and a processor, wherein the memory stores a computer program and the processor is configured to run the computer program to perform the steps in any of the above method embodiments.
[0176] Optionally, in this embodiment, the processor can be configured to perform the following steps via a computer program:
[0177] S1, when the target object performs a target operation on a panel device with a preset system, the m combined commands corresponding to the target operation are parsed by a parsing tool pre-injected into the software development kit of the preset system; wherein, if the parsing tool is not injected into the software development kit, the parsing tool is a tool in the preset command line tools that is not allowed to run in the preset system; wherein, m is a positive integer;
[0178] S2, the operation events determined according to the m combined commands are sent to the panel device via a sending tool; wherein, the sending tool is a tool among the preset command line tools that is allowed to run in the preset system;
[0179] S3, execute the operation event through the panel device to perform automated testing of the panel device.
[0180] In one exemplary embodiment, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor and the input / output device is connected to the processor.
[0181] Embodiments of this application also provide a computer program product, which includes a computer program that, when executed by a processor, implements the steps in any of the above method embodiments.
[0182] Embodiments of this application also provide another computer program product, including a non-volatile computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps in any of the above method embodiments.
[0183] Embodiments of this application also provide a computer program that includes computer instructions stored in a computer-readable storage medium; a processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the steps in any of the above method embodiments.
[0184] Specific examples in this embodiment can be found in the examples described in the above embodiments and exemplary implementations, and will not be repeated here.
[0185] Obviously, those skilled in the art should understand that the modules or steps of this application described above can be implemented using general-purpose computing devices. They can be centralized on a single computing device or distributed across a network of multiple computing devices. They can be implemented using computer-executable program code, and thus can be stored in a storage device for execution by a computing device. In some cases, the steps shown or described can be performed in a different order than those presented here, or they can be fabricated as separate integrated circuit modules, or multiple modules or steps can be fabricated as a single integrated circuit module. Thus, this application is not limited to any particular combination of hardware and software.
[0186] The above description is only a preferred embodiment of this application. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of this application, and these improvements and modifications should also be considered within the scope of protection of this application.
Claims
1. A method of performing automated testing, the method comprising: The method comprises the following steps: In the case that a target object performs a target operation on a panel device deployed with a preset system, m combined commands corresponding to the target operation are parsed by a parsing tool pre-injected in a software development kit of the preset system; wherein, in the case that the parsing tool is not injected into the software development kit, the parsing tool is a tool in a preset command line tool which is not allowed to run in the preset system; wherein, m is a positive integer; An operation event determined according to the m combined commands is sent to the panel device by a sending tool; wherein, the sending tool is a tool in the preset command line tool which is allowed to run in the preset system; The operation event is executed by the panel device to perform an automated test on the panel device.
2. The method of claim 1, wherein, The m combined commands corresponding to the target operation are parsed by a parsing tool pre-injected in a software development kit of the preset system, which comprises the following steps: The operation coordinates corresponding to the target operation on the panel device are determined based on the horizontal axis resolution and the vertical axis resolution of the panel device; Event stream information corresponding to the target operation is parsed by the parsing tool based on the operation coordinates; The m combined commands are extracted from the event stream information.
3. The method of claim 2, wherein, The operation coordinates corresponding to the target operation on the panel device are determined based on the horizontal axis resolution and the vertical axis resolution of the panel device, which comprises the following steps: The coordinate layout of the panel device is determined by the horizontal axis resolution and the vertical axis resolution of the panel device; In the case that the target operation is a click operation, the click coordinates of the click operation determined according to the coordinate layout are determined as the operation coordinates; In the case that the target operation is a sliding operation, the start coordinates and the end coordinates of the sliding operation determined according to the coordinate layout are determined as the operation coordinates.
4. The method of claim 1, wherein, The operation event determined according to the m combined commands is sent to the panel device by a sending tool, which comprises the following steps: The m combined commands are converted into a certain number system; The operation event is determined by the m combined commands converted into the certain number system; The operation event is sent to the panel device by the sending tool.
5. The method of claim 1, wherein, The operation event is executed by the panel device to perform an automated test on the panel device, which comprises the following steps: The operation intention of the target operation is determined by the panel device according to the operation event; Control operations are performed on a target smart device corresponding to the operation intention by the panel device according to the operation intention; wherein, the plurality of smart devices in a binding relationship with the panel device comprises the target smart device; The test result of the automated test on the panel device is determined according to the feedback information of the target smart device.
6. The method of claim 5, wherein, The operation intention of the target operation is determined by the panel device according to the operation event, which comprises the following steps: The coordinate sizes respectively allocated by the panel device for the plurality of smart devices are acquired; The target coordinate size hit by the operation event among the plurality of coordinate sizes is determined; The operation intention is determined by the target coordinate size.
7. The method of claim 5, wherein, The test result of the automatic test on the panel device is determined according to the feedback information of the target intelligent device, and the test result includes: In the case that the feedback information of the target intelligent device is received, the log of the panel device captured between a first time and a second time is obtained; the first time is the time when the target object performs a target operation on the panel device deployed with a preset system, and the second time is the time when the feedback information of the target intelligent device is received; the log at least includes one of the following: application layer log, system log; In the case that the crash information exists in the log, the test result of the automatic test on the panel device is determined as test failure; In the case that the crash information does not exist in the log, the test result of the automatic test on the panel device is determined as test success.
8. An apparatus for performing automation testing, characterized by: Comprise: The analysis module is configured to, in the case that a target object performs a target operation on a panel device deployed with a preset system, analyze m combined commands corresponding to the target operation by an analysis tool pre-injected in a software development kit of the preset system; in the case that the analysis tool is not injected into the software development kit, the analysis tool is a tool in a preset command line tool that is not allowed to run in the preset system; wherein m is a positive integer; The sending module is configured to send an operation event determined according to the m combined commands to the panel device by a sending tool; wherein the sending tool is a tool in the preset command line tool that is allowed to run in the preset system; The execution module is configured to execute the operation event by the panel device to perform the automatic test on the panel device.
9. A computer readable storage medium, characterized in that, The computer-readable storage medium comprises a stored program, wherein the program executes the method of any one of claims 1 to 7 when running. 10.An electronic device comprising a memory and a processor, the electronic device characterized by, The memory stores a computer program, and the processor is configured to execute the method of any one of claims 1 to 7 by the computer program.