WO2014169565A1 - Terminal testing method and device - Google Patents

Terminal testing method and device Download PDF

Info

Publication number
WO2014169565A1
WO2014169565A1 PCT/CN2013/083573 CN2013083573W WO2014169565A1 WO 2014169565 A1 WO2014169565 A1 WO 2014169565A1 CN 2013083573 W CN2013083573 W CN 2013083573W WO 2014169565 A1 WO2014169565 A1 WO 2014169565A1
Authority
WO
WIPO (PCT)
Prior art keywords
terminal
script file
operation event
comparison
information
Prior art date
Application number
PCT/CN2013/083573
Other languages
French (fr)
Chinese (zh)
Inventor
朱晋
Original Assignee
中兴通讯股份有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 中兴通讯股份有限公司 filed Critical 中兴通讯股份有限公司
Publication of WO2014169565A1 publication Critical patent/WO2014169565A1/en

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3684Test management for test design, e.g. generating new test cases

Definitions

  • the present invention relates to the field of terminal testing, and in particular, to a terminal testing method and apparatus.
  • an operating system of an intelligent terminal such as an embedded operating system such as an Android operating system or a Windows operating system
  • portable terminals such as smart phones and tablet computers.
  • Android operating system As an example, all Android smartphone manufacturers and operators are also the most important to test the Android system in order to guarantee the quality of the products to users.
  • PC personal computer
  • the following scenarios may exist: Only the smart terminal does not provide or cannot provide the PC.
  • the above-mentioned automated test tool cannot be used without the PC. Therefore, the above-mentioned automatic test solution application scenario has certain Limitation issues.
  • an effective solution has not yet been proposed.
  • the application scenario of the test solution of the terminal has limitations, and the like.
  • the embodiment of the present invention provides a test method and device for the terminal to solve at least the foregoing problem.
  • a method for testing a terminal including: acquiring, by a terminal, operation event information of a user on the terminal, and generating a script file according to the operation event information; and receiving, by the terminal, a first operation instruction And executing the script file; the terminal generates a test report according to execution information of the script file, and outputs the test report.
  • the terminal acquires the operation event information of the user to the terminal, including: monitoring a current operation event of the terminal; and saving the monitored current operation event according to a trigger sequence of the operation event.
  • the terminal acquires the operation event information of the user to the terminal, the method includes: the terminal receiving the second operation instruction, and setting a comparison point; wherein the comparison point is used to provide a comparison object in the process of executing the script file,
  • the comparison object includes: an object corresponding to the comparison point in the execution of the script file and the object in the process of acquiring the operation event information.
  • the terminal executing the script file further includes: the terminal parsing the script file to obtain the comparison point; the terminal comparing the comparison object according to the compared comparison point, and Save the comparison results.
  • the method includes: stopping, by the terminal, when the number of times the script file is executed reaches the preset threshold.
  • the operation event information includes at least one of the following: a type of the operation event corresponding to the operation event information, an application identifier corresponding to the operation event, a trigger time of the operation event, and a touch of the operation event Coordinate information.
  • the terminal executing the script file includes: the terminal parsing the script file to obtain the application identifier and/or the trigger time; and the terminal according to the parsed application identifier and/or The triggering time performs an action corresponding to the operation event information.
  • a test apparatus for a terminal which is applied to a terminal, and includes: an acquisition module, configured to acquire operation event information of a user on the terminal; and a first generation module, configured to The operation event information generates a script file; the execution module is configured to receive the first operation instruction and execute the script file; and the second generation module is configured to generate a test report according to the execution situation information of the script file and output the test report.
  • the acquiring module includes: a monitoring unit configured to monitor a current operating event of the terminal; and a saving unit configured to save the monitored current operating event according to a triggering sequence of the operating event.
  • the obtaining module includes: a setting unit, configured to receive a second operation instruction, and set a comparison point; wherein the comparison point is used to provide a comparison object during execution of the script file, and the comparison object includes: Executing an object corresponding to the comparison point in the script file process and the object in the process of acquiring the operation event information.
  • the terminal obtains the operation event information, generates a script file, executes the script file, and generates a technical solution of the test report according to the execution situation information, and solves the test of the terminal in the related art.
  • the application scenario of the solution has limitations and the like, so that the test of the terminal can be realized only when the PC is not needed, that is, only by using the above terminal.
  • FIG. 1 is a flow chart of a test method for a terminal according to an embodiment of the present invention
  • FIG. 2 is a block diagram showing a structure of a test device for a terminal according to an embodiment of the present invention
  • FIG. 3 is a block diagram of a terminal according to a preferred embodiment of the present invention.
  • FIG. 4 is a schematic structural diagram of a testing apparatus of a terminal according to another preferred embodiment of the present invention.
  • FIG. 1 is a flowchart of a method for testing a terminal according to an embodiment of the present invention. As shown in FIG. 1, the method includes: Step S102: A terminal acquires operation event information of a user, and generates a script file according to the operation event information. The processing step may be implemented by: monitoring a current operation event of the terminal.
  • This step can be implemented by establishing a service (Service) or a thread (Thread).
  • the specific form can be expressed as follows:
  • the monitoring program is always running in the background of the terminal, and the input device file under the terminal is monitored in a loop manner.
  • the event acquisition method in Android EventHub getevent the original event information is obtained in real time.
  • the obtained event is reported to the upper layer, and the upper layer can obtain the current top-level package name while receiving the event, thereby corresponding the event and the package name, and then save the operation, and the current operation event to be monitored is performed according to the trigger sequence of the operation event. save.
  • a comparison point may also be set: the terminal receives the second operation instruction, and sets a comparison point; wherein the comparison point is used in the process of executing the script file.
  • the comparison object comprising: the comparison point pair in the process of executing the script file The object to be processed and the object in the process of acquiring the operation event information, that is, in the process of executing the script file, comparing the object corresponding to the comparison point with the object in the process of acquiring the operation event information.
  • the above process can be implemented as the following implementation forms: Start the test tool on the Android smart terminal device, enter the initialization phase to collect and analyze the terminal device information, including the LCD screen resolution of the device. Rate, virtual keyboard information, physical button information, device operating system version information, etc., after completion, you can enter the recording process or playback execution flow. Selecting to perform the recording process, the tool starts the listener in the background by establishing the service service or the thread Thread on the terminal, and the listener monitors the underlying event information of the smart terminal, and obtains the current operation event reported by the intelligent terminal, such as tapping the screen, sliding the screen, and volume.
  • the comparison point can select the comparison of the pictures on the screen, the comparison of the names of the controls on the screen, the contrast of the text contained on the screen, and the comparison of the names of the application packages at the top of the smart terminal.
  • Step S104 The terminal receives the first operation instruction, and executes the script file.
  • the processing step may be implemented by, but not limited to, the following: the terminal parses the script file to obtain the comparison point; and pushes the parsed operation event information to the bottom layer of the terminal. , the action terminal corresponding to the above operation event information is executed. If the comparison point is set in the process of obtaining the above operation event information, the comparison point may be parsed from the above script file, thereby comparing the comparison object according to the comparison point, and saving the comparison result.
  • the terminal may execute the script file according to the preset threshold, that is, stop execution when the number of times the script file is executed reaches the preset threshold.
  • the above processing process can be expressed as the following implementation forms: After the operation event recording of the terminal device is completed, the script that saves the operation event can be selected to be played back, and other operation events can be continuously recorded. Select playback (ie execute) the script, you can set the number of playback times and rules during playback. When playing back, read the saved script, parse the event information and the comparison point information, and then start a Service on the terminal. The service or Thread thread is used to manage the sequence and time of events to be played back.
  • the playback service program will continuously push the event information to the bottom layer of the smart terminal according to the time triggered by the parsed event, and after the bottom layer of the Android receives the pushed event information, It is considered that the user operation generates such an event response request, and the intelligent terminal performs an action corresponding to the event, thereby achieving the purpose of playback.
  • starting a Service service or a Thread thread on the terminal to manage the sequence and time of the event to be played back can be expressed in the following form:
  • the playback program is always running in the background of the terminal, and the information of the recorded event is obtained by reading the script, and then The time is determined by the loop method, and the corresponding time point is executed.
  • the top-level package name ie, the application identifier
  • the push operation is performed, and the event is pushed to the corresponding terminal bottom layer.
  • the playback operation is implemented. If they are not the same, delay waiting and then pushing. If the timeout period is not the same, the playback will fail.
  • the playback service program will make a corresponding comparison: For image comparison, you need to first screenshot the current comparison screen, and then use the image comparison algorithm for comparison; text comparison compares the text content is consistent Compared with the current application package name, the current package name is compared with the package name in the recording script, and the comparison result is recorded. After all the events are played back, the script finishes playing, and then the playback success or failure is judged according to the comparison result. Finally, the playback service program is closed.
  • the foregoing operation event information includes at least one of the following: the type of the operation event corresponding to the operation event information, the application identifier of the application corresponding to the operation event (for example, an application name), the trigger time of the operation event, and the touch coordinate of the operation event. information.
  • step S104 can be implemented by the following process: The terminal parses the script file; and the terminal performs an action corresponding to the operation event information according to the parsed application identifier and/or the trigger time.
  • Step S106 The terminal generates a test report according to the execution situation information of the script file and outputs the test report.
  • the test report may be output after executing a script file, or after all the scripts selected for playback are completed, the execution status of all the scripts is output according to the result of each script to form a test report, so as to view the execution. result.
  • a test device for the terminal is also provided, and the device is applied to the terminal, and is used to implement the foregoing embodiment and the preferred embodiment. The description has been omitted, and the following is related to the device.
  • the module is explained.
  • the term "module" may implement a combination of software and/or hardware of a predetermined function.
  • the device includes: The obtaining module 20 is connected to the first generating module 22, and is configured to acquire operation event information of the user to the terminal.
  • the first generating module 22 is connected to the executing module 22, and is configured to generate a script file according to the operation event information.
  • the second generation module 26 is configured to receive the first operation instruction and execute the script file.
  • the second generation module 26 is configured to generate a test report according to the execution information of the script file and output the test report.
  • the obtaining module 20 includes, but is not limited to, the following processing unit:
  • the monitoring unit 200 is connected to the saving unit 202, and is configured to monitor a current operating event of the terminal; specifically, by establishing a service Service or Thread Thread implementation.
  • the saving unit 202 is configured to save the monitored current operation events according to the trigger sequence of the operation events.
  • FIG. 3 In a preferred embodiment of the present embodiment, as shown in FIG.
  • the obtaining module 20 may further include the following processing unit: a setting unit 204, configured to receive a second operation instruction, and set a comparison point; wherein the comparison point is used for
  • the comparison object is provided during the execution of the script file, and the comparison object includes: an object corresponding to the comparison point and the object in the process of acquiring the operation event information in the process of executing the script file.
  • the device includes: a terminal initialization module 40, a terminal recording module 42, a terminal playback execution module 44, and a terminal result determination output module 46.
  • the terminal initialization module 40 is configured to initialize the tools in the terminal, including an interface of a user interface (UI), obtaining an LCD screen resolution of the device, virtual keyboard information, physical key information, and operating system version information. .
  • UI user interface
  • the terminal recording module 42 may be executed, or the terminal playback execution module 44 may be directly executed to play back the previously recorded script.
  • the terminal recording module 42 is responsible for starting the monitoring program, recording the mobile phone event setting comparison point and finally saving the script, and closing the listening program after the recording is completed. After the initialization of the terminal initialization module 40 is completed, the terminal recording module 42 may be selected to be executed.
  • the terminal playback execution module 44 is responsible for starting the playback service program, opening and parsing the saved script, playing back the event and performing contrast comparison judgment, and closing the playback service program after the execution is completed.
  • the terminal playback execution module 44 can be directly executed after the terminal initialization module 40 is initialized.
  • the terminal result judgment output module 46 is configured to output a report according to the result information outputted by the result of the playback execution of the terminal playback execution module 44. As shown in FIG.
  • Step S502 Start a tool application, perform initialization, including interface UI display, acquire device LCD screen resolution, virtual keyboard information, physical key information, device operating system version information, and the like. operating.
  • Step S504 starting the terminal recording module, starting recording, starting the listening program to run in the background, the tool starts a listening program in the background by establishing a service service or a thread Thread on the terminal, and the listening program monitors the underlying event information of the intelligent terminal to obtain user operations.
  • the current operation event information reported by the intelligent terminal end such as tapping the screen, sliding the screen, adjusting the volume up and down, pressing the virtual button, etc. These events include the type of the event, the time of the event response, and the touch coordinates of the event.
  • Step S506 a comparison point can be set on the terminal device during the recording process, and is used for judging during playback.
  • the comparison point can select the image comparison on the screen, the comparison of the control names on the screen, the text comparison on the screen, and the current intelligent terminal. The comparison of the name of the application package at the top. Here, the comparison point of the settings is selected.
  • the corresponding comparison point information is saved to the terminal device for comparison during playback, such as comparison of picture resources, text information and the like.
  • step S508 it is judged whether to end the recording, if it is not finished, the recording is continued, and if the recording is finished, the interception of the smart terminal event information is stopped, and the recording is completed.
  • step S510 when the recording is completed, the currently intercepted event and the comparison point are saved into a script file according to the time sequence triggered by the event.
  • the UI interface Stored in the built-in or external storage of the mobile phone, where the UI interface can provide settings such as saving the script name.
  • Step S512 selecting a script to be played back, where one or more pieces can be selected, and a playback rule can be provided, such as setting a single loop playback, setting all loop playback, the number of playback executions, and the like.
  • the recording may not be selected, and the process may be directly performed in step S512 to select a previously recorded script.
  • Step S514 performing a playback execution action according to the selection and setting of S512, starting a playback service program, which may be a Service service or a Thread thread, used to manage the sequence and time of the event to be played back, and the program reads the content of the script. Parsing, according to the type of the event, the event triggering time continuously pushes the event information to the bottom layer of the intelligent terminal, so that the intelligent terminal thinks that it receives such an event response request, and the intelligent terminal performs the action corresponding to the event, thereby achieving the playback. the goal of. Step S516, where the judgment is made according to the comparison point set in the script.
  • the tool intercepts the screen image of the current device and compares the image saved during the recording, and if it is a text comparison, obtains the control specified in the script of the current device. Text information, and then compare, if it is the package name comparison, get the package name at the top of the current device and then compare.
  • Step S518, the playback service program determines whether the execution of the playback ends, and if the end is not finished, the execution continues. If the playback ends, the background playback service program is closed to proceed to S520. Step S520, judging the output for the final result. After all the scripts are executed according to the set playback, all the script execution situation information is output according to the comparison result of the comparison point, and a report is generated.
  • the report here may be txt/xml/html/xls, etc. Form. Convenient to view execution results.
  • This embodiment does not require a PC, does not need to install a driver, does not use a USB cable connection, activates a listening service and a playback service program on the terminal device to complete the monitoring and playback events, and achieves recording and playback through monitoring and pushing events.
  • the purpose of this technology innovation is that only one device terminal can run all the above processes, which improves the efficiency of Android automated testing and makes the automated testing more flexible. For example, the field test conditions are usually difficult and there is no PC computer. In the environment, the present invention can be used for recording and playback testing on the terminal device.
  • This technical solution can also be applied in the Android software industry, and can perform repeated functions, for example, it is convenient for the user to repeatedly dial 100 on the smart terminal.
  • the second call send 100 text messages and other operations.
  • software is also provided for performing the technical solutions described in the above embodiments and preferred embodiments.
  • a storage medium is provided, the software being stored, including but not limited to: an optical disk, a floppy disk, a hard disk, a rewritable memory, and the like.
  • the computing device may be implemented by program code executable by the computing device, such that they may be stored in the storage device by the computing device and, in some cases, may be different from the order herein.
  • the steps shown or described are performed, or they are separately fabricated into individual integrated circuit modules, or a plurality of modules or steps are fabricated as a single integrated circuit module.
  • the invention is not limited to any specific combination of hardware and software.
  • the above are only the preferred embodiments of the present invention, and are not intended to limit the present invention, and various modifications and changes can be made to the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and scope of the present invention are intended to be included within the scope of the present invention.
  • the above technical solution provided by the present invention can be applied to a terminal in a test process, using a terminal to acquire operation event information, generate a script file, execute the script file, and generate a test report according to the execution information, and solve the technical solution.
  • the application scenario of the test solution of the terminal has limitations, and the like, so that the test of the terminal can be implemented only when the PC is not needed, that is, only by using the terminal.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

Provided are a terminal testing method and device, the method comprising: a terminal acquires the user operation events information about the terminal, and generates a script file according to the operation events information; the terminal receives a first operation instruction to execute the script file; and the terminal generates and outputs a test report according to the execution information of the script file. The technical solution of the present invention resolves such problems as limitations of application scenarios of terminal testing in the relevant art, thus achieving a terminal test by simply using a terminal without a PC.

Description

终端的测试方法及装置 技术领域 本发明涉及终端测试领域, 尤其是涉及一种终端的测试方法及装置。 背景技术 目前, 智能终端的操作系统, 例如安卓 (Android)操作系统、 Windows操作系统 等嵌入式操作系统, 被广泛应用于智能手机、 平板电脑等便携式终端中。 以安卓操作 系统为例,各个 Android智能手机厂商和运营商为了保证给用户的产品质量,对 Android 系统的测试也是重中之重。 出现了很多针对 Android平台的自动化测试工具和应用。 在目前这些工具中大多数在个人计算机(Personal Computer,简称为 PC)上运行的, 需要先安装好手机驱动程序,通过 PC侧和设备代理 (Agent) 进行通讯,然后控制设备 完成各种指令响应。 但是, 需要在基站现场进行测试时, 可能会存在以下场景: 只有智能终端没有或 不能提供 PC, 在没有 PC的条件下, 无法使用上述自动化测试工具, 因此, 上述自动 化测试方案应用场景存在一定的局限性问题。 针对相关技术中的上述问题, 目前尚未提出有效的解决方案。 发明内容 针对相关技术中, 终端的测试方案的应用场景存在局限性等问题, 本发明实施例 提供了一种终端的测试方法及装置, 以至少解决上述问题。 根据本发明的一个实施例, 提供了一种终端的测试方法, 包括: 终端获取用户对 所述终端的操作事件信息, 并根据所述操作事件信息生成脚本文件; 所述终端接收第 一操作指令, 执行所述脚本文件; 所述终端根据所述脚本文件的执行情况信息生成测 试报告并输出。 优选地, 终端获取用户对所述终端的操作事件信息, 包括: 监测所述终端的当前 操作事件; 将监测到的所述当前操作事件按照操作事件的触发顺序进行保存。 优选地, 终端获取用户对所述终端的操作事件信息, 包括: 所述终端接收第二操 作指令, 设置对比点; 其中, 所述对比点用于在执行所述脚本文件过程中提供对比对 象, 该对比对象包括: 在执行所述脚本文件过程中所述对比点对应的对象和获取所述 操作事件信息过程中的所述对象。 优选地, 所述终端执行所述脚本文件, 还包括: 所述终端解析所述脚本文件, 得 到所述对比点; 所述终端根据解析得到的所述对比点对所述对比对象进行对比, 并保 存对比结果。 优选地, 所述终端根据所述脚本文件的执行情况信息生成测试报告之前, 包括: 所述终端在执行所述脚本文件的次数到达所述预设阈值时停止执行。 优选地, 所述操作事件信息包括以下至少之一: 所述操作事件信息所对应操作事 件的种类、 所述操作事件所对应的应用标识、 所述操作事件的触发时间、 所述操作事 件的触摸坐标信息。 优选地, 所述终端执行所述脚本文件, 包括: 所述终端解析所述脚本文件, 得到 所述应用标识和 /或所述触发时间;所述终端按照解析得到的所述应用标识和 /或所述触 发时间执行所述操作事件信息对应的动作。 根据本发明的另一个实施例, 提供了一种终端的测试装置, 应用于终端, 包括: 获取模块, 设置为获取用户对所述终端的操作事件信息; 第一生成模块, 设置为根据 所述操作事件信息生成脚本文件; 执行模块, 设置为接收第一操作指令, 执行所述脚 本文件; 第二生成模块, 设置为根据所述脚本文件的执行情况信息生成测试报告并输 出。 优选地, 所述获取模块包括: 监测单元, 设置为监测所述终端的当前操作事件; 保存单元, 设置为将监测到的所述当前操作事件按照操作事件的触发顺序进行保存。 优选地, 所述获取模块包括: 设置单元, 设置为接收第二操作指令, 设置对比点; 其中, 所述对比点用于在执行所述脚本文件过程中提供对比对象, 该对比对象包括: 在执行所述脚本文件过程中所述对比点对应的对象和获取所述操作事件信息过程中的 所述对象。 通过本发明实施例, 采用终端获取操作事件信息, 并生成脚本文件, 执行该脚本 文件并根据执行情况信息生成测试报告的技术方案, 解决了相关技术中, 终端的测试 方案的应用场景存在局限性等问题, 从而在不需要 PC 的情况下, 即仅需要凭借上述 终端, 便可以实现对终端的测试。 附图说明 此处所说明的附图用来提供对本发明的进一步理解, 构成本申请的一部分, 本发 明的示意性实施例及其说明用于解释本发明, 并不构成对本发明的不当限定。 在附图 中- 图 1为根据本发明实施例的终端的测试方法的流程图; 图 2为根据本发明实施例的终端的测试装置的结构框图; 图 3为根据本发明优选实施例的终端的测试装置的结构框图; 图 4为根据本发明另一优选实施例的终端的测试装置的结构示意图; 图 5为根据本发明另一优选实施例的终端的测试装置的工作流程示意图。 具体实施方式 下文中将参考附图并结合实施例来详细说明本发明。 需要说明的是, 在不冲突的 情况下, 本申请中的实施例及实施例中的特征可以相互组合。 图 1为根据本发明实施例的终端的测试方法的流程图。如图 1所示, 该方法包括: 步骤 S102, 终端获取用户对该终端的操作事件信息, 并根据该操作事件信息生成 脚本文件; 该处理步骤可以通过以下方式实现: 监测上述终端的当前操作事件, 该步骤可以 通过建立服务 (Service) 或线程 (Thread) 方式实现, 具体可以表现为以下形式: 监 测程序始终在终端的后台运行,通过循环的方式对终端底层的输入设备文件进行监控, 可以参考 Android EventHub getevent中的事件获取方式, 实时获取原始事件信息。将获 取的事件上报给上层, 上层在接收到事件的同时可以获取当前顶层包名, 从而将事件 和包名相对应,然后进行保存操作, 即将监测到的当前操作事件按照操作事件的触发顺 序进行保存。 可选地, 为了有针对性的对终端中的特定对象进行测试, 还可以设置对 比点: 终端接收第二操作指令, 设置对比点; 其中, 该对比点用于在执行所述脚本文 件过程中提供对比对象, 该对比对象包括: 在执行所述脚本文件过程中上述对比点对 应的对象和获取所述操作事件信息过程中的上述对象, 即, 在执行上述脚本文件过程 中,对上述对比点所对应的对象和获取上述操作事件信息过程中的上述对象进行对比。 以安装有安卓操作系统的智能终端为例,上述处理过程可以表现为以下实现形式: 在 Android智能终端设备上启动测试工具,进入初始化阶段对终端设备信息进行采 集和分析,包含设备的 LCD屏幕分辨率、 虚拟键盘信息、 各个物理按键信息、 设备操 作系统版本信息等信息,完成以后,可以进行进入录制流程或者回放执行流程。 选择执行录制流程, 工具在终端上建立服务 Service或线程 Thread的方式在后台 启动监听程序,监听程序监听智能终端底层事件信息,获得智能终端底层上报的当前操 作事件,比如点击屏幕、滑动屏幕、音量上下调节、虚拟键按键点击等操作,这些事件中 包含了事件的种类、 事件响应的时间、 事件的触摸坐标等详细信息; 并且在录制过程 中在终端设备上可以设置对比点,用于在回放的时候进行判断,对比点可以选择屏幕上 图片对比、 屏幕上的控件名称对比、 屏幕上包含的文字对比、 智能终端当前最上方应 用包名称的对比等。 选择停止录制后, 停止截取底层操作事件, 将所有截取的事件按 顺序触发的前后顺序进行保存。 保存为脚本存储到智能终端上, 设置对比点的信息也 会保存到录制的脚本当中, 监听程序关闭。 录制流程的特点在于在终端侧就完成了对 终端底层事件的监听、 解析、 分析和保存工作, 不需要发送给 PC侧来解析保存,提高 了效率,节省了操作步骤和时间。 步骤 S104, 终端接收第一操作指令, 执行上述脚本文件; 该处理步骤可以通过但不限于以下方式实现: 终端解析上述脚本文件, 得到上述 对比点; 将解析得到的操作事件信息推送到终端的底层, 执行上述操作事件信息对应 的动作终端。 如果在获取上述操作事件信息的过程中设置了对比点, 则还可以从上述 脚本文件中解析得到对比点, 从而根据对比点对上述对比对象进行对比, 并保存对比 结果。 在脚本文件的执行过程中, 终端可以根据预设阈值执行上述脚本文件, 即, 在 执行上述脚本文件的次数到达上述预设阈值时停止执行。 上述处理过程可以表现为以下实现形式: 终端设备的操作事件录制完成以后, 可以选择回放保存有操作事件的脚本, 也可 以继续录制其他的操作事件。 选择回放 (即执行) 该脚本, 在回放的时候可以设置回 放的次数和规则, 回放时候先读取保存的脚本,将其中的事件信息和对比点信息内容进 行解析,然后在终端上启动一个 Service服务或者 Thread线程用来管理要回放的事件顺 序和时间, 不需要像 PC侧工具是通过建立连接以后 Socket套接字发送命令的方式来 控制手机的回放动作, 在终端设备上启动一个回放服务程序,这个回放服务程序会根据 解析的事件触发的时间不断的将事件信息推送到智能终端底层, Android底层收到推送 的事件信息后, 会认为是用户操作产生这样的事件响应请求, 智能终端就会执行对应 事件的动作, 从而达到回放的目的。其中, 在终端上启动一个 Service服务或者 Thread 线程用来管理要回放的事件顺序和时间, 可以表现为以下形式: 回放程序始终在终端 的后台运行,通过读取脚本获取到录制事件的信息,然后通过循环的方式判断时间,执行 到对应的时间点,先判断最上层包名(即应用标识)是否和事件中的包名信息相同,如果 相同则进行推送操作, 将事件推送到对应的终端底层的输入设备文件中,实现回放操 作。如果不相同则进行延迟等待再进行推送,如果达到超时时间还不相同,则这次回放失 败。如果设置事件中不包含包名信息, 则在回放时候,不判断包名,根据时间点来推送事 件信息, 完成回放操作。 在回放过程中, 遇到设置的对比点时, 回放服务程序就会做相应的对比: 对于图 片对比, 需要先截图当前对比屏幕, 然后利用图片对比算法进行对比; 文字对比则比 较文字内容是否一致; 对比当前应用包名, 则会获取当前的包名和录制脚本中的包名 进行对比, 记录下对比结果, 所有事件都回放完成以后, 该脚本完成回放, 然后根据 对比结果判断回放的成功还是失败, 最后关闭回放服务程序。 正如上面所述, 上述操作事件信息包括以下至少之一: 操作事件信息所对应操作 事件的种类、操作事件所对应应用的应用标识(例如应用名称)、操作事件的触发时间、 操作事件的触摸坐标信息。基于此, 步骤 S104可以通过以下处理过程实现: 终端解析 所述脚本文件; 终端按照所述解析得到的上述应用标识和 /或上述触发时间执行所述操 作事件信息对应的动作。 步骤 S106, 终端根据上述脚本文件的执行情况信息生成测试报告并输出。 在该处理步骤中, 可以在执行完一个脚本文件后便输出测试报告, 也可以等到所 有选择回放的脚本执行完成以后, 根据每条脚本的结果输出所有脚本的执行情况形成 测试报告, 以便查看执行结果。 在本实施例中还提供了一种终端的测试装置, 该装置应用于终端, 用于实现上述 实施例及优选实施方式, 已经进行过说明的不再赘述, 下面对该装置中涉及到的模块 进行说明。 如以下所使用的, 术语"模块"可以实现预定功能的软件和 /或硬件的组合。 尽管以下实施例所描述的装置较佳地以软件来实现, 但是硬件, 或者软件和硬件的组 合的实现也是可能并被构想的。 图 2为根据本发明实施例的终端的测试装置的结构框 图。 如图 2所示, 该装置包括: 获取模块 20,连接至第一生成模块 22, 设置为获取用户对上述终端的操作事件信 息; 第一生成模块 22,连接至执行模块 22, 设置为根据上述操作事件信息生成脚本文 件; 执行模块 24, 连接至第二生成模块 26, 设置为接收第一操作指令, 执行上述脚本 文件; 第二生成模块 26, 设置为根据上述脚本文件的执行情况信息生成测试报告并输 出。 通过上述各个模块实现的功能, 在不需要 PC的情况下, 即仅需要凭借上述终端, 便可以实现对终端的测试。 需要说明的是, 上述各个模块是可以通过硬件来实现的。 例如: 一种处理器, 包 括上述各个模块, 或者, 上述各个模块分别位于一个处理器中。 在本实施例中, 如图 3所示, 获取模块 20包括但不限于以下处理单元: 监测单元 200, 连接至保存单元 202, 设置为监测上述终端的当前操作事件; 具体 可以通过建立服务 Service或线程 Thread方式实现。 保存单元 202, 设置为将监测到的上述当前操作事件按照操作事件的触发顺序进 行保存。 在本实施例的一个优选实施方式中, 如图 3所示, 获取模块 20还可以包括以下处 理单元: 设置单元 204, 设置为接收第二操作指令, 设置对比点; 其中, 该对比点用 于在执行上述脚本文件过程中提供对比对象, 该对比对象包括: 在执行所述脚本文件 过程中对比点对应的对象和获取所述操作事件信息过程中的上述对象。 为了更好地理解上述实施例及其优选实施例, 以下结合一个优选实施例 (以安卓 操作系统为例) 和相关附图详细说明。 本实施例的目的在于,克服现有 Android自动化测试方案必须要在 PC端安装手机 驱动然后与手机通过 USB建立连接才能测试的不足, 提出一种仅需要一台智能终端, 就可以实现自动录制和回放、 自动进行判断结果的方案。 图 4为根据本发明另一优选实施例的终端的测试装置的结构示意图。如图 4所示, 该装置包括: 终端初始化模块 40、 终端录制模块 42、 终端回放执行模块 44、 终端结 果判断输出模块 46。 终端初始化模块 40, 设置为终端中工具的初始化,包括界面用户界面 (User Interface, 简称为 UI)显示、 获取设备 LCD屏幕分辨率、 虚拟键盘信息、 各个物理按 键信息、 设备操作系统版本信息等操作。 初始化完成以后可以执行终端录制模块 42, 也可以直接执行终端回放执行模块 44回放以前录制的脚本。 终端录制模块 42, 负责启动监听程序,录制手机事件设置对比点最后保存脚本,完 成录制以后关闭监听程序。 在终端初始化模块 40初始化完成以后,可以选择执行终端 录制模块 42。 终端回放执行模块 44, 负责启动回放服务程序,打开并解析保存的脚本,回放事件 并进行对比点对比判断,完成执行以后关闭回放服务程序。 可以在终端初始化模块 40 初始化完成以后直接执行终端回放执行模块 44。 终端结果判断输出模块 46, 设置为根据终端回放执行模块 44回放执行的结果输 出执行的结果信息,生成报告。 如图 5所示, 上述装置的工作流程如下: 步骤 S502, 启动工具应用,进行初始化,包括界面 UI显示、 获取设备 LCD屏幕分 辨率、 虚拟键盘信息、 各个物理按键信息、 设备操作系统版本信息等操作。 步骤 S504,启动终端录制模块,开始录制,启动监听程序在后台运行, 工具通过在终 端上建立服务 Service或线程 Thread的方式在后台启动一个监听程序,监听程序监听智 能终端底层事件信息,获得用户操作智能终时端底层上报的当前操作事件信息,比如点 击屏幕、 滑动屏幕、 音量上下调节、 虚拟键按键点击等操作,这些事件中包含了事件的 种类、 事件响应的时间、 事件的触摸坐标等详细信息。 步骤 S506,录制过程中在终端设备上可以设置对比点,用于在回放的时候进行判断, 对比点可以选择屏幕上图片对比、 屏幕上的控件名称对比、 屏幕上包含的文字对比、 智能终端当前最上方应用包名称的对比等.这里选择设置的对比点,录制过程中会将相 应的对比点信息保存到终端设备上方便回放的时候进行对比,比如对比的图片资源,文 字信息等内容。 步骤 S508, 是在判断是否结束录制,如果没有结束就继续监听录制,如果结束录制, 就停止截获智能终端事件信息,完成录制。 步骤 S510,完成录制时,把当前截获的事件和对比点按事件触发的时间顺序保存成 脚本文件.存储在手机内置或者外置存储上,这里 UI 界面可以提供保存脚本名称等设 置。 最后关闭后台监听程序。 步骤 S512, 选择要回放执行的脚本,这里可以选择一条或者多条,可以提供回放规 则,比如设置单条循环回放, 设置全部循环回放,回放执行的次数等。在 S11初始化完成 以后可以不选择进行录制,可以直接进入步骤 S512选择以前录制的脚本进行执行。 步骤 S514, 根据 S512的选择和设置进行回放执行动作, 启动一个回放服务程序, 这个程序可以是 Service服务或者 Thread线程,用来管理控制要回放的事件顺序和时间, 程序会读取脚本的内容,进行解析,根据事件的类型,事件的触发的时间不断的将事件信 息推送到智能终端底层,让智能终端认为是收到这样的事件响应请求, 智能终端就会执 行对应事件的动作,从而达到回放的目的。 步骤 S516,这里根据脚本中设置的对比点进行判断,如果是屏幕对比则工具会截取 当前设备的屏幕图片和录制时候保存的图片进行对比,如果是文字对比则获取当前设 备的脚本中指定的控件文字信息,然后进行对比,如果是包名对比,则获取当前设备最上 方的包名然后进行对比。 步骤 S518, 回放服务程序判断执行回放是否结束,没有结束则继续执行,如果回放 结束则关闭后台回放服务程序进入 S520。 步骤 S520, 为最后结果判断输出,所有脚本都根据设置回放执行完毕以后,根据对 比点的对比结果,输出所有的脚本执行情况信息,生成报告,这里的报告可以是 txt/ xml/html/xls等形式.方便查看执行结果。 本实施例不需要 PC机,不需要安装驱动,不要使用 USB线连接,通过在终端设备上 启动一种监听服务和回放服务程序的来完成监听和回放事件,通过监听和推送事件达 到录制和回放的目的,通过这种技术创新,使得仅需要一台设备终端就可以运行上述所 有的过程,提升了 Android自动化测试效率和让自动化测试更加灵活.例如通常外场测试 条件比较艰苦没有 PC电脑,在这样的环境下就可以使用本发明在终端设备进行录制回 放测试,这种技术方案也可以应用在 Android软件行业中,可以进行功能重复操作,例如 让用户很方便的可以在智能终端上进行重复拨打 100次电话,发送 100条短信等操作。 在另外一个实施例中, 还提供了一种软件, 该软件用于执行上述实施例及优选实 施方式中描述的技术方案。 在另外一个实施例中, 还提供了一种存储介质, 该存储介质中存储有上述软件, 该存储介质包括但不限于: 光盘、 软盘、 硬盘、 可擦写存储器等。 显然, 本领域的技术人员应该明白, 上述的本发明的各模块或各步骤可以用通用 的计算装置来实现, 它们可以集中在单个的计算装置上, 或者分布在多个计算装置所 组成的网络上, 可选地, 它们可以用计算装置可执行的程序代码来实现, 从而, 可以 将它们存储在存储装置中由计算装置来执行, 并且在某些情况下, 可以以不同于此处 的顺序执行所示出或描述的步骤, 或者将它们分别制作成各个集成电路模块, 或者将 它们中的多个模块或步骤制作成单个集成电路模块来实现。 这样, 本发明不限制于任 何特定的硬件和软件结合。 以上仅为本发明的优选实施例而已, 并不用于限制本发明, 对于本领域的技术人 员来说, 本发明可以有各种更改和变化。 凡在本发明的精神和原则之内, 所作的任何 修改、 等同替换、 改进等, 均应包含在本发明的保护范围之内。 工业实用性 本发明提供的上述技术方案, 可以应用于终端的测试过程中, 采用终端获取操作 事件信息, 并生成脚本文件, 执行该脚本文件并根据执行情况信息生成测试报告的技 术方案, 解决了相关技术中, 终端的测试方案的应用场景存在局限性等问题, 从而在 不需要 PC的情况下, 即仅需要凭借上述终端, 便可以实现对终端的测试。 TECHNICAL FIELD The present invention relates to the field of terminal testing, and in particular, to a terminal testing method and apparatus. BACKGROUND Currently, an operating system of an intelligent terminal, such as an embedded operating system such as an Android operating system or a Windows operating system, is widely used in portable terminals such as smart phones and tablet computers. Taking the Android operating system as an example, all Android smartphone manufacturers and operators are also the most important to test the Android system in order to guarantee the quality of the products to users. There have been many automated testing tools and applications for the Android platform. Most of these tools currently run on a personal computer (PC), you need to install the mobile phone driver first, communicate with the device agent (Agent) through the PC side, and then control the device to complete various command responses. . However, when testing at the base station site, the following scenarios may exist: Only the smart terminal does not provide or cannot provide the PC. The above-mentioned automated test tool cannot be used without the PC. Therefore, the above-mentioned automatic test solution application scenario has certain Limitation issues. In view of the above problems in the related art, an effective solution has not yet been proposed. SUMMARY OF THE INVENTION In the related art, the application scenario of the test solution of the terminal has limitations, and the like. The embodiment of the present invention provides a test method and device for the terminal to solve at least the foregoing problem. According to an embodiment of the present invention, a method for testing a terminal is provided, including: acquiring, by a terminal, operation event information of a user on the terminal, and generating a script file according to the operation event information; and receiving, by the terminal, a first operation instruction And executing the script file; the terminal generates a test report according to execution information of the script file, and outputs the test report. Preferably, the terminal acquires the operation event information of the user to the terminal, including: monitoring a current operation event of the terminal; and saving the monitored current operation event according to a trigger sequence of the operation event. Preferably, the terminal acquires the operation event information of the user to the terminal, the method includes: the terminal receiving the second operation instruction, and setting a comparison point; wherein the comparison point is used to provide a comparison object in the process of executing the script file, The comparison object includes: an object corresponding to the comparison point in the execution of the script file and the object in the process of acquiring the operation event information. Preferably, the terminal executing the script file further includes: the terminal parsing the script file to obtain the comparison point; the terminal comparing the comparison object according to the compared comparison point, and Save the comparison results. Preferably, before the terminal generates the test report according to the execution information of the script file, the method includes: stopping, by the terminal, when the number of times the script file is executed reaches the preset threshold. Preferably, the operation event information includes at least one of the following: a type of the operation event corresponding to the operation event information, an application identifier corresponding to the operation event, a trigger time of the operation event, and a touch of the operation event Coordinate information. Preferably, the terminal executing the script file includes: the terminal parsing the script file to obtain the application identifier and/or the trigger time; and the terminal according to the parsed application identifier and/or The triggering time performs an action corresponding to the operation event information. According to another embodiment of the present invention, a test apparatus for a terminal is provided, which is applied to a terminal, and includes: an acquisition module, configured to acquire operation event information of a user on the terminal; and a first generation module, configured to The operation event information generates a script file; the execution module is configured to receive the first operation instruction and execute the script file; and the second generation module is configured to generate a test report according to the execution situation information of the script file and output the test report. Preferably, the acquiring module includes: a monitoring unit configured to monitor a current operating event of the terminal; and a saving unit configured to save the monitored current operating event according to a triggering sequence of the operating event. Preferably, the obtaining module includes: a setting unit, configured to receive a second operation instruction, and set a comparison point; wherein the comparison point is used to provide a comparison object during execution of the script file, and the comparison object includes: Executing an object corresponding to the comparison point in the script file process and the object in the process of acquiring the operation event information. Through the embodiment of the present invention, the terminal obtains the operation event information, generates a script file, executes the script file, and generates a technical solution of the test report according to the execution situation information, and solves the test of the terminal in the related art. The application scenario of the solution has limitations and the like, so that the test of the terminal can be realized only when the PC is not needed, that is, only by using the above terminal. BRIEF DESCRIPTION OF THE DRAWINGS The accompanying drawings, which are set to illustrate,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, 1 is a flow chart of a test method for a terminal according to an embodiment of the present invention; FIG. 2 is a block diagram showing a structure of a test device for a terminal according to an embodiment of the present invention; FIG. 3 is a block diagram of a terminal according to a preferred embodiment of the present invention. FIG. 4 is a schematic structural diagram of a testing apparatus of a terminal according to another preferred embodiment of the present invention; FIG. 5 is a schematic diagram showing the working flow of a testing apparatus of a terminal according to another preferred embodiment of the present invention. BEST MODE FOR CARRYING OUT THE INVENTION Hereinafter, the present invention will be described in detail with reference to the accompanying drawings. It should be noted that the embodiments in the present application and the features in the embodiments may be combined with each other without conflict. FIG. 1 is a flowchart of a method for testing a terminal according to an embodiment of the present invention. As shown in FIG. 1, the method includes: Step S102: A terminal acquires operation event information of a user, and generates a script file according to the operation event information. The processing step may be implemented by: monitoring a current operation event of the terminal. This step can be implemented by establishing a service (Service) or a thread (Thread). The specific form can be expressed as follows: The monitoring program is always running in the background of the terminal, and the input device file under the terminal is monitored in a loop manner. The event acquisition method in Android EventHub getevent, the original event information is obtained in real time. The obtained event is reported to the upper layer, and the upper layer can obtain the current top-level package name while receiving the event, thereby corresponding the event and the package name, and then save the operation, and the current operation event to be monitored is performed according to the trigger sequence of the operation event. save. Optionally, in order to specifically test a specific object in the terminal, a comparison point may also be set: the terminal receives the second operation instruction, and sets a comparison point; wherein the comparison point is used in the process of executing the script file. Providing a comparison object, the comparison object comprising: the comparison point pair in the process of executing the script file The object to be processed and the object in the process of acquiring the operation event information, that is, in the process of executing the script file, comparing the object corresponding to the comparison point with the object in the process of acquiring the operation event information. Taking the smart terminal with the Android operating system as an example, the above process can be implemented as the following implementation forms: Start the test tool on the Android smart terminal device, enter the initialization phase to collect and analyze the terminal device information, including the LCD screen resolution of the device. Rate, virtual keyboard information, physical button information, device operating system version information, etc., after completion, you can enter the recording process or playback execution flow. Selecting to perform the recording process, the tool starts the listener in the background by establishing the service service or the thread Thread on the terminal, and the listener monitors the underlying event information of the smart terminal, and obtains the current operation event reported by the intelligent terminal, such as tapping the screen, sliding the screen, and volume. Up and down adjustment, virtual key button click and other operations, these events include the type of event, the time of the event response, the touch coordinates of the event, etc.; and the contrast point can be set on the terminal device during the recording process for playback When judging, the comparison point can select the comparison of the pictures on the screen, the comparison of the names of the controls on the screen, the contrast of the text contained on the screen, and the comparison of the names of the application packages at the top of the smart terminal. After selecting to stop recording, stop intercepting the underlying operation event and save all the intercepted events in the order before and after the sequence trigger. The save as a script is stored on the smart terminal, and the information for setting the comparison point is also saved to the recorded script, and the listener is closed. The recording process is characterized in that the terminal side is monitored, parsed, analyzed, and saved on the terminal side. It does not need to be sent to the PC side for parsing and saving, which improves efficiency and saves operation steps and time. Step S104: The terminal receives the first operation instruction, and executes the script file. The processing step may be implemented by, but not limited to, the following: the terminal parses the script file to obtain the comparison point; and pushes the parsed operation event information to the bottom layer of the terminal. , the action terminal corresponding to the above operation event information is executed. If the comparison point is set in the process of obtaining the above operation event information, the comparison point may be parsed from the above script file, thereby comparing the comparison object according to the comparison point, and saving the comparison result. During the execution of the script file, the terminal may execute the script file according to the preset threshold, that is, stop execution when the number of times the script file is executed reaches the preset threshold. The above processing process can be expressed as the following implementation forms: After the operation event recording of the terminal device is completed, the script that saves the operation event can be selected to be played back, and other operation events can be continuously recorded. Select playback (ie execute) the script, you can set the number of playback times and rules during playback. When playing back, read the saved script, parse the event information and the comparison point information, and then start a Service on the terminal. The service or Thread thread is used to manage the sequence and time of events to be played back. It is not necessary for the PC side tool to send commands through the Socket socket after the connection is established. Controlling the playback action of the mobile phone, starting a playback service program on the terminal device, the playback service program will continuously push the event information to the bottom layer of the smart terminal according to the time triggered by the parsed event, and after the bottom layer of the Android receives the pushed event information, It is considered that the user operation generates such an event response request, and the intelligent terminal performs an action corresponding to the event, thereby achieving the purpose of playback. Wherein, starting a Service service or a Thread thread on the terminal to manage the sequence and time of the event to be played back can be expressed in the following form: The playback program is always running in the background of the terminal, and the information of the recorded event is obtained by reading the script, and then The time is determined by the loop method, and the corresponding time point is executed. First, it is determined whether the top-level package name (ie, the application identifier) is the same as the package name information in the event. If the same, the push operation is performed, and the event is pushed to the corresponding terminal bottom layer. In the input device file, the playback operation is implemented. If they are not the same, delay waiting and then pushing. If the timeout period is not the same, the playback will fail. If the package name information is not included in the setting event, the package name is not judged during playback, and the event information is pushed according to the time point to complete the playback operation. During playback, when the set comparison point is encountered, the playback service program will make a corresponding comparison: For image comparison, you need to first screenshot the current comparison screen, and then use the image comparison algorithm for comparison; text comparison compares the text content is consistent Compared with the current application package name, the current package name is compared with the package name in the recording script, and the comparison result is recorded. After all the events are played back, the script finishes playing, and then the playback success or failure is judged according to the comparison result. Finally, the playback service program is closed. As described above, the foregoing operation event information includes at least one of the following: the type of the operation event corresponding to the operation event information, the application identifier of the application corresponding to the operation event (for example, an application name), the trigger time of the operation event, and the touch coordinate of the operation event. information. Based on this, step S104 can be implemented by the following process: The terminal parses the script file; and the terminal performs an action corresponding to the operation event information according to the parsed application identifier and/or the trigger time. Step S106: The terminal generates a test report according to the execution situation information of the script file and outputs the test report. In this processing step, the test report may be output after executing a script file, or after all the scripts selected for playback are completed, the execution status of all the scripts is output according to the result of each script to form a test report, so as to view the execution. result. In this embodiment, a test device for the terminal is also provided, and the device is applied to the terminal, and is used to implement the foregoing embodiment and the preferred embodiment. The description has been omitted, and the following is related to the device. The module is explained. As used hereinafter, the term "module" may implement a combination of software and/or hardware of a predetermined function. Although the apparatus described in the following embodiments is preferably implemented in software, hardware, or a combination of software and hardware, is also possible and conceivable. 2 is a block diagram showing the structure of a test apparatus for a terminal according to an embodiment of the present invention. As shown in Figure 2, the device includes: The obtaining module 20 is connected to the first generating module 22, and is configured to acquire operation event information of the user to the terminal. The first generating module 22 is connected to the executing module 22, and is configured to generate a script file according to the operation event information. The second generation module 26 is configured to receive the first operation instruction and execute the script file. The second generation module 26 is configured to generate a test report according to the execution information of the script file and output the test report. Through the functions implemented by the above modules, the test of the terminal can be realized only when the PC is not needed, that is, only by the above terminal. It should be noted that each of the above modules can be implemented by hardware. For example: a processor, including the above modules, or each of the above modules is located in one processor. In this embodiment, as shown in FIG. 3, the obtaining module 20 includes, but is not limited to, the following processing unit: The monitoring unit 200 is connected to the saving unit 202, and is configured to monitor a current operating event of the terminal; specifically, by establishing a service Service or Thread Thread implementation. The saving unit 202 is configured to save the monitored current operation events according to the trigger sequence of the operation events. In a preferred embodiment of the present embodiment, as shown in FIG. 3, the obtaining module 20 may further include the following processing unit: a setting unit 204, configured to receive a second operation instruction, and set a comparison point; wherein the comparison point is used for The comparison object is provided during the execution of the script file, and the comparison object includes: an object corresponding to the comparison point and the object in the process of acquiring the operation event information in the process of executing the script file. In order to better understand the above embodiments and their preferred embodiments, a preferred embodiment (taking the Android operating system as an example) and related drawings will be described in detail below. The purpose of this embodiment is to overcome the deficiencies that the existing Android automated test solution must install a mobile phone driver on the PC and then establish a connection with the mobile phone through the USB, and propose an automatic recording device that requires only one intelligent terminal. Playback and automatic calculation of the result. 4 is a schematic structural diagram of a testing apparatus of a terminal according to another preferred embodiment of the present invention. As shown in FIG. 4, the device includes: a terminal initialization module 40, a terminal recording module 42, a terminal playback execution module 44, and a terminal result determination output module 46. The terminal initialization module 40 is configured to initialize the tools in the terminal, including an interface of a user interface (UI), obtaining an LCD screen resolution of the device, virtual keyboard information, physical key information, and operating system version information. . After the initialization is completed, the terminal recording module 42 may be executed, or the terminal playback execution module 44 may be directly executed to play back the previously recorded script. The terminal recording module 42 is responsible for starting the monitoring program, recording the mobile phone event setting comparison point and finally saving the script, and closing the listening program after the recording is completed. After the initialization of the terminal initialization module 40 is completed, the terminal recording module 42 may be selected to be executed. The terminal playback execution module 44 is responsible for starting the playback service program, opening and parsing the saved script, playing back the event and performing contrast comparison judgment, and closing the playback service program after the execution is completed. The terminal playback execution module 44 can be directly executed after the terminal initialization module 40 is initialized. The terminal result judgment output module 46 is configured to output a report according to the result information outputted by the result of the playback execution of the terminal playback execution module 44. As shown in FIG. 5, the workflow of the foregoing apparatus is as follows: Step S502: Start a tool application, perform initialization, including interface UI display, acquire device LCD screen resolution, virtual keyboard information, physical key information, device operating system version information, and the like. operating. Step S504, starting the terminal recording module, starting recording, starting the listening program to run in the background, the tool starts a listening program in the background by establishing a service service or a thread Thread on the terminal, and the listening program monitors the underlying event information of the intelligent terminal to obtain user operations. The current operation event information reported by the intelligent terminal end, such as tapping the screen, sliding the screen, adjusting the volume up and down, pressing the virtual button, etc. These events include the type of the event, the time of the event response, and the touch coordinates of the event. information. Step S506, a comparison point can be set on the terminal device during the recording process, and is used for judging during playback. The comparison point can select the image comparison on the screen, the comparison of the control names on the screen, the text comparison on the screen, and the current intelligent terminal. The comparison of the name of the application package at the top. Here, the comparison point of the settings is selected. During the recording process, the corresponding comparison point information is saved to the terminal device for comparison during playback, such as comparison of picture resources, text information and the like. In step S508, it is judged whether to end the recording, if it is not finished, the recording is continued, and if the recording is finished, the interception of the smart terminal event information is stopped, and the recording is completed. In step S510, when the recording is completed, the currently intercepted event and the comparison point are saved into a script file according to the time sequence triggered by the event. Stored in the built-in or external storage of the mobile phone, where the UI interface can provide settings such as saving the script name. Finally, close the background listener. Step S512, selecting a script to be played back, where one or more pieces can be selected, and a playback rule can be provided, such as setting a single loop playback, setting all loop playback, the number of playback executions, and the like. After the initialization of S11 is completed, the recording may not be selected, and the process may be directly performed in step S512 to select a previously recorded script. Step S514, performing a playback execution action according to the selection and setting of S512, starting a playback service program, which may be a Service service or a Thread thread, used to manage the sequence and time of the event to be played back, and the program reads the content of the script. Parsing, according to the type of the event, the event triggering time continuously pushes the event information to the bottom layer of the intelligent terminal, so that the intelligent terminal thinks that it receives such an event response request, and the intelligent terminal performs the action corresponding to the event, thereby achieving the playback. the goal of. Step S516, where the judgment is made according to the comparison point set in the script. If the screen is contrasted, the tool intercepts the screen image of the current device and compares the image saved during the recording, and if it is a text comparison, obtains the control specified in the script of the current device. Text information, and then compare, if it is the package name comparison, get the package name at the top of the current device and then compare. Step S518, the playback service program determines whether the execution of the playback ends, and if the end is not finished, the execution continues. If the playback ends, the background playback service program is closed to proceed to S520. Step S520, judging the output for the final result. After all the scripts are executed according to the set playback, all the script execution situation information is output according to the comparison result of the comparison point, and a report is generated. The report here may be txt/xml/html/xls, etc. Form. Convenient to view execution results. This embodiment does not require a PC, does not need to install a driver, does not use a USB cable connection, activates a listening service and a playback service program on the terminal device to complete the monitoring and playback events, and achieves recording and playback through monitoring and pushing events. The purpose of this technology innovation is that only one device terminal can run all the above processes, which improves the efficiency of Android automated testing and makes the automated testing more flexible. For example, the field test conditions are usually difficult and there is no PC computer. In the environment, the present invention can be used for recording and playback testing on the terminal device. This technical solution can also be applied in the Android software industry, and can perform repeated functions, for example, it is convenient for the user to repeatedly dial 100 on the smart terminal. The second call, send 100 text messages and other operations. In another embodiment, software is also provided for performing the technical solutions described in the above embodiments and preferred embodiments. In another embodiment, a storage medium is provided, the software being stored, including but not limited to: an optical disk, a floppy disk, a hard disk, a rewritable memory, and the like. Obviously, those skilled in the art should understand that the above modules or steps of the present invention can be implemented by a general-purpose computing device, which can be concentrated on a single computing device or distributed over a network composed of multiple computing devices. Alternatively, they may be implemented by program code executable by the computing device, such that they may be stored in the storage device by the computing device and, in some cases, may be different from the order herein. The steps shown or described are performed, or they are separately fabricated into individual integrated circuit modules, or a plurality of modules or steps are fabricated as a single integrated circuit module. Thus, the invention is not limited to any specific combination of hardware and software. The above are only the preferred embodiments of the present invention, and are not intended to limit the present invention, and various modifications and changes can be made to the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and scope of the present invention are intended to be included within the scope of the present invention. INDUSTRIAL APPLICABILITY The above technical solution provided by the present invention can be applied to a terminal in a test process, using a terminal to acquire operation event information, generate a script file, execute the script file, and generate a test report according to the execution information, and solve the technical solution. In the related art, the application scenario of the test solution of the terminal has limitations, and the like, so that the test of the terminal can be implemented only when the PC is not needed, that is, only by using the terminal.

Claims

权 利 要 求 书 Claim
1. 一种终端的测试方法, 包括: 1. A test method for a terminal, comprising:
终端获取用户对所述终端的操作事件信息, 并根据所述操作事件信息生成 脚本文件;  The terminal acquires operation event information of the user on the terminal, and generates a script file according to the operation event information;
所述终端接收第一操作指令, 执行所述脚本文件;  Receiving, by the terminal, a first operation instruction, executing the script file;
所述终端根据所述脚本文件的执行情况信息生成测试报告并输出。  The terminal generates a test report according to the execution information of the script file and outputs the test report.
2. 根据权利要求 1所述的方法,其中,终端获取用户对所述终端的操作事件信息, 包括: 2. The method according to claim 1, wherein the terminal acquires operation event information of the user on the terminal, including:
监测所述终端的当前操作事件;  Monitoring a current operational event of the terminal;
将监测到的所述当前操作事件按照操作事件的触发顺序进行保存。  The monitored current operational events are saved in the order in which the operational events are triggered.
3. 根据权利要求 1所述的方法,其中,终端获取用户对所述终端的操作事件信息, 包括: The method according to claim 1, wherein the terminal acquires operation event information of the user on the terminal, including:
所述终端接收第二操作指令, 设置对比点; 其中, 所述对比点用于在执行 所述脚本文件过程中提供对比对象, 该对比对象包括: 在执行所述脚本文件过 程中所述对比点对应的对象和获取所述操作事件信息过程中的所述对象。  The terminal receives the second operation instruction, and sets a comparison point. The comparison point is used to provide a comparison object during the execution of the script file, where the comparison object includes: the comparison point in the process of executing the script file Corresponding object and the object in the process of acquiring the operation event information.
4. 根据权利要求 3所述的方法, 其中, 所述终端执行所述脚本文件, 还包括: 所述终端解析所述脚本文件, 得到所述对比点; The method of claim 3, wherein the executing the script file by the terminal further comprises: the terminal parsing the script file to obtain the comparison point;
所述终端根据所述对比点对所述对比对象进行对比, 并保存对比结果。  The terminal compares the compared objects according to the comparison point, and saves the comparison result.
5. 根据权利要求 1所述的方法, 其中, 所述终端根据所述脚本文件的执行情况信 息生成测试报告之前, 包括: The method according to claim 1, wherein before the terminal generates a test report according to the execution information of the script file, the method includes:
所述终端在执行所述脚本文件的次数到达所述预设阈值时停止执行。  The terminal stops execution when the number of times the script file is executed reaches the preset threshold.
6. 根据权利要求 1至 5任一项所述的方法, 其中, 所述操作事件信息包括以下至 少之一- 所述操作事件信息所对应操作事件的种类、 所述操作事件所对应的应用标 识、 所述操作事件的触发时间、 所述操作事件的触摸坐标信息。 The method according to any one of claims 1 to 5, wherein the operation event information comprises at least one of the following: a type of an operation event corresponding to the operation event information, and an application identifier corresponding to the operation event. The trigger time of the operation event and the touch coordinate information of the operation event.
7. 根据权利要求 6所述的方法, 其中, 所述终端执行所述脚本文件, 包括: 所述终端解析所述脚本文件, 得到所述应用标识和 /或所述触发时间; 所述终端按照解析得到的所述应用标识和 /或所述触发时间执行所述操作 事件信息对应的动作。 The method of claim 6, wherein the executing the script file by the terminal comprises: The terminal parses the script file to obtain the application identifier and/or the trigger time. The terminal performs an action corresponding to the operation event information according to the parsed application identifier and/or the trigger time.
8. 一种终端的测试装置, 应用于终端, 包括: 8. A terminal testing device, applied to a terminal, comprising:
获取模块, 设置为获取用户对所述终端的操作事件信息;  Obtaining a module, configured to obtain operation event information of the user on the terminal;
第一生成模块, 设置为根据所述操作事件信息生成脚本文件; 执行模块, 设置为接收第一操作指令, 执行所述脚本文件; 第二生成模块, 设置为根据所述脚本文件的执行情况信息生成测试报告并 输出。  a first generation module, configured to generate a script file according to the operation event information; an execution module, configured to receive the first operation instruction, execute the script file; and a second generation module, configured to execute information according to the execution of the script file Generate a test report and output it.
9. 根据权利要求 8所述的装置, 其中, 所述获取模块包括: The device according to claim 8, wherein the obtaining module comprises:
监测单元, 设置为监测所述终端的当前操作事件;  a monitoring unit, configured to monitor a current operational event of the terminal;
保存单元, 设置为将监测到的所述当前操作事件按照操作事件的触发顺序 进行保存。  The saving unit is configured to save the monitored current operation event according to the trigger sequence of the operation event.
10. 根据权利要求 8所述的装置, 其中, 所述获取模块包括: The device according to claim 8, wherein the obtaining module comprises:
设置单元, 设置为接收第二操作指令, 设置对比点; 其中, 所述对比点用 于在执行所述脚本文件过程中提供对比对象, 该对比对象包括: 在执行所述脚 本文件过程中所述对比点对应的对象和获取所述操作事件信息过程中的所述对  a setting unit, configured to receive a second operation instruction, and set a comparison point; wherein the comparison point is used to provide a comparison object during execution of the script file, where the comparison object comprises: Comparing the object corresponding to the point and the pair in the process of acquiring the operation event information
PCT/CN2013/083573 2013-08-21 2013-09-16 Terminal testing method and device WO2014169565A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201310368803.8A CN104424089A (en) 2013-08-21 2013-08-21 Terminal testing method and device
CN201310368803.8 2013-08-21

Publications (1)

Publication Number Publication Date
WO2014169565A1 true WO2014169565A1 (en) 2014-10-23

Family

ID=51730725

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2013/083573 WO2014169565A1 (en) 2013-08-21 2013-09-16 Terminal testing method and device

Country Status (2)

Country Link
CN (1) CN104424089A (en)
WO (1) WO2014169565A1 (en)

Cited By (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104699607A (en) * 2015-03-06 2015-06-10 惠州Tcl移动通信有限公司 Automation testing method and system for mobile terminal
CN107748718A (en) * 2017-10-11 2018-03-02 百富计算机技术(深圳)有限公司 Applied program testing method, device and server
CN108763087A (en) * 2018-05-31 2018-11-06 惠州市德赛西威汽车电子股份有限公司 A kind of script testing method, apparatus and system
CN109951863A (en) * 2019-03-05 2019-06-28 深圳市吉祥腾达科技有限公司 A kind of radio stability on-hook test method and system
CN110221983A (en) * 2019-06-19 2019-09-10 深圳市腾讯网域计算机网络有限公司 Test method, device, computer readable storage medium and computer equipment
CN110727578A (en) * 2019-08-30 2020-01-24 苏宁智能终端有限公司 Automatic testing method and device for intelligent terminal
CN111506496A (en) * 2020-03-11 2020-08-07 北京三快在线科技有限公司 Test data acquisition method and device, electronic equipment and storage medium
CN111597116A (en) * 2020-05-20 2020-08-28 浪潮软件集团有限公司 Mobile terminal UI automatic test method, system, storage medium and electronic equipment
CN111833044A (en) * 2020-06-19 2020-10-27 深圳市中创电测技术有限公司 Handheld terminal testing method, equipment, system and storage medium
CN112035375A (en) * 2020-09-17 2020-12-04 中国银行股份有限公司 socket interface automatic test system
CN114095197A (en) * 2020-12-29 2022-02-25 京东科技控股股份有限公司 Method, device, electronic equipment, system and storage medium for preventing network attack
CN114676046A (en) * 2022-03-09 2022-06-28 上海移芯通信科技有限公司 Management system and method for multiple test terminals
CN110727578B (en) * 2019-08-30 2024-05-31 苏宁智能终端有限公司 Automatic testing method and device for intelligent terminal

Families Citing this family (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106682910B (en) * 2015-11-04 2020-09-08 中国移动通信集团公司 Information processing method, system and related equipment
CN105824755B (en) * 2016-03-17 2019-03-15 厦门美图移动科技有限公司 A kind of automated testing method, device and mobile terminal
CN108664364B (en) * 2017-03-31 2023-05-09 腾讯科技(深圳)有限公司 Terminal testing method and device
CN108579094B (en) * 2018-05-11 2023-04-18 深圳市腾讯网络信息技术有限公司 User interface detection method, related device, system and storage medium
CN109408309B (en) * 2018-10-18 2019-12-06 北京海泰方圆科技股份有限公司 Multi-terminal testing method and device
CN110633192B (en) * 2019-08-28 2023-05-26 RealMe重庆移动通信有限公司 Test method, test device, terminal equipment and computer readable storage medium
CN111190777B (en) * 2019-12-20 2023-12-08 曙光信息产业(北京)有限公司 Disk I/O performance test method and device
CN112863084B (en) * 2021-01-13 2023-04-25 中国工商银行股份有限公司 Intelligent sales terminal, and testing method, device and system of intelligent sales terminal

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102141960A (en) * 2011-03-18 2011-08-03 广东欧珀移动通信有限公司 Automatic test method based on Android
CN102147756A (en) * 2010-02-05 2011-08-10 中国移动通信集团公司 Methods and systems for testing terminal
CN102419727A (en) * 2011-09-30 2012-04-18 宇龙计算机通信科技(深圳)有限公司 Automatic test method and device
CN102841845A (en) * 2012-07-30 2012-12-26 广东欧珀移动通信有限公司 Automatic testing method of Android device software

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101175284B (en) * 2006-11-01 2010-12-22 联想移动通信科技有限公司 Function testing method of portable electronic apparatus
CN101241466B (en) * 2007-02-08 2010-09-29 深圳迈瑞生物医疗电子股份有限公司 Embedded software test method and system
CN101221503A (en) * 2008-02-01 2008-07-16 中国建设银行股份有限公司 Software testing method and device
CN101957793B (en) * 2010-09-03 2013-02-13 中国科学院软件研究所 Android and android derivative system-oriented method for playing back software operation record

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102147756A (en) * 2010-02-05 2011-08-10 中国移动通信集团公司 Methods and systems for testing terminal
CN102141960A (en) * 2011-03-18 2011-08-03 广东欧珀移动通信有限公司 Automatic test method based on Android
CN102419727A (en) * 2011-09-30 2012-04-18 宇龙计算机通信科技(深圳)有限公司 Automatic test method and device
CN102841845A (en) * 2012-07-30 2012-12-26 广东欧珀移动通信有限公司 Automatic testing method of Android device software

Cited By (17)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104699607A (en) * 2015-03-06 2015-06-10 惠州Tcl移动通信有限公司 Automation testing method and system for mobile terminal
CN107748718A (en) * 2017-10-11 2018-03-02 百富计算机技术(深圳)有限公司 Applied program testing method, device and server
CN107748718B (en) * 2017-10-11 2020-12-18 百富计算机技术(深圳)有限公司 Application program testing method and device and server
CN108763087A (en) * 2018-05-31 2018-11-06 惠州市德赛西威汽车电子股份有限公司 A kind of script testing method, apparatus and system
CN109951863A (en) * 2019-03-05 2019-06-28 深圳市吉祥腾达科技有限公司 A kind of radio stability on-hook test method and system
CN110221983A (en) * 2019-06-19 2019-09-10 深圳市腾讯网域计算机网络有限公司 Test method, device, computer readable storage medium and computer equipment
CN110221983B (en) * 2019-06-19 2024-01-16 深圳市腾讯网域计算机网络有限公司 Test method, test device, computer readable storage medium and computer equipment
CN110727578A (en) * 2019-08-30 2020-01-24 苏宁智能终端有限公司 Automatic testing method and device for intelligent terminal
CN110727578B (en) * 2019-08-30 2024-05-31 苏宁智能终端有限公司 Automatic testing method and device for intelligent terminal
CN111506496A (en) * 2020-03-11 2020-08-07 北京三快在线科技有限公司 Test data acquisition method and device, electronic equipment and storage medium
CN111597116B (en) * 2020-05-20 2023-06-09 浪潮软件集团有限公司 Mobile terminal UI automatic test method, system, storage medium and electronic equipment
CN111597116A (en) * 2020-05-20 2020-08-28 浪潮软件集团有限公司 Mobile terminal UI automatic test method, system, storage medium and electronic equipment
CN111833044A (en) * 2020-06-19 2020-10-27 深圳市中创电测技术有限公司 Handheld terminal testing method, equipment, system and storage medium
CN112035375B (en) * 2020-09-17 2024-04-19 中国银行股份有限公司 Socket interface automatic test system
CN112035375A (en) * 2020-09-17 2020-12-04 中国银行股份有限公司 socket interface automatic test system
CN114095197A (en) * 2020-12-29 2022-02-25 京东科技控股股份有限公司 Method, device, electronic equipment, system and storage medium for preventing network attack
CN114676046A (en) * 2022-03-09 2022-06-28 上海移芯通信科技有限公司 Management system and method for multiple test terminals

Also Published As

Publication number Publication date
CN104424089A (en) 2015-03-18

Similar Documents

Publication Publication Date Title
WO2014169565A1 (en) Terminal testing method and device
US10726068B2 (en) App processing method and apparatus
WO2018076945A1 (en) Thread data processing method, device and terminal
CN108763086B (en) Script recording method, terminal and computer readable storage medium based on remote true machine
US20110191787A1 (en) System and method for providing sensor data from embedded device to software development environment
EP2517101A1 (en) A method, apparatuses and a system for compilation
US11363066B2 (en) Method and device for information processing, test terminal, test platform and storage medium
CN106126424B (en) A kind of visual automated testing method of script, device and mobile terminal
WO2018077041A1 (en) Method and apparatus for running application
US20120050336A1 (en) Touch-based remote control
Huang et al. Remote mobile test system: a mobile phone cloud for application testing
CN106027631B (en) Data transmission method and device
WO2017206476A1 (en) Method, device and apparatus for detecting cpu occupation
CN112328492A (en) Interaction control method and device between anchor and electronic equipment
WO2016070690A1 (en) Method, device and system for realizing communication between application and webpage on terminal device
CN111651232A (en) One-machine multi-control method, device and system and electronic equipment
CN107197088B (en) Screenshot method and device based on android mobile device
WO2016188101A1 (en) Service system test method and device
KR102106618B1 (en) System, terminal device, verification apparatus, method and computer-readable medium for testing application performance
CN107391354B (en) Method and system for automatically monitoring terminal performance and storage device
CN112788640B (en) Communication equipment testing method and device, storage medium and terminal
CN111026651B (en) Test method, device, storage medium and electronic equipment
Zhang et al. Towards a contextual and scalable automated-testing service for mobile apps
US9952902B1 (en) Determining a set of application resources
CN113821428A (en) Cloud testing method and device, electronic equipment and computer storage medium

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 13882290

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 13882290

Country of ref document: EP

Kind code of ref document: A1