WO2019218464A1 - Application program testing method and apparatus, and mobile terminal and medium - Google Patents

Application program testing method and apparatus, and mobile terminal and medium Download PDF

Info

Publication number
WO2019218464A1
WO2019218464A1 PCT/CN2018/097116 CN2018097116W WO2019218464A1 WO 2019218464 A1 WO2019218464 A1 WO 2019218464A1 CN 2018097116 W CN2018097116 W CN 2018097116W WO 2019218464 A1 WO2019218464 A1 WO 2019218464A1
Authority
WO
WIPO (PCT)
Prior art keywords
test
application
instruction
script
interface control
Prior art date
Application number
PCT/CN2018/097116
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 WO2019218464A1 publication Critical patent/WO2019218464A1/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
    • 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/3688Test management for test execution, e.g. scheduling of test suites

Definitions

  • the present application belongs to the field of data processing technologies, and in particular, to an application testing method, apparatus, mobile terminal, and medium.
  • the existing application testing methods are to connect the mobile terminal to the computer end, and use the computer to control the mobile terminal to implement testing of the application. Testing is necessary because it must be connected to the computer, making testing of the application extremely vulnerable to factors such as site and equipment, making testing inconvenient and inefficient.
  • the embodiment of the present application provides an application testing method and a mobile terminal, so as to solve the problem that the application can be tested only by using the computer end in the prior art, so that the application testing efficiency is low.
  • a first aspect of an embodiment of the present application provides an application testing method, including:
  • the mobile terminal extracts the first test script of the recorded operation behavior of the user operation application according to the received recording playback instruction
  • Finding an interface control included in the application and controlling, according to the first number of tests, the interface control to execute a task corresponding to the first test instruction, to test the application.
  • a second aspect of the embodiments of the present application provides an application testing apparatus, including:
  • a recording and playback module configured for the mobile terminal to extract, according to the received recording and playback instruction, the first test script of the recorded operation behavior of the user operation application;
  • a first script parsing module configured to acquire a first test number corresponding to the first test script, and parse the first test script to determine a first test instruction included in the first test script
  • a first test module configured to find an interface control included in the application, and control, according to the first number of tests, the interface control to execute a task corresponding to the first test instruction, to the application carry out testing.
  • a third aspect of the embodiments of the present application provides a mobile terminal, including a memory, a processor, and the computer storing computer readable instructions executable on the processor, where the processor executes the computer The following steps are implemented when reading the instruction:
  • the mobile terminal extracts the first test script of the recorded operation behavior of the user operation application according to the received recording playback instruction
  • Finding an interface control included in the application and controlling, according to the first number of tests, the interface control to execute a task corresponding to the first test instruction, to test the application.
  • a fourth aspect of the embodiments of the present application provides a computer readable storage medium storing computer readable instructions, wherein the computer readable instructions are implemented by at least one processor The following steps:
  • the mobile terminal extracts the first test script of the recorded operation behavior of the user operation application according to the received recording playback instruction
  • Finding an interface control included in the application and controlling, according to the first number of tests, the interface control to execute a task corresponding to the first test instruction, to test the application.
  • the embodiment of the present application has the beneficial effects of pre-recording the user's operation behavior on the application program by the mobile terminal and generating a corresponding test script, and then directly testing the application program based on the recorded test script, thereby
  • the embodiment of the present application does not need to rely on any other device, but directly uses the mobile terminal itself to complete the test of the application program, frees the limitations of the test site and the device, and can only perform the targeted test script for the user's needs. Build and test, which greatly improves the efficiency of testing the application, making the testing of the application simple and efficient.
  • FIG. 1 is a schematic flowchart showing an implementation process of an application testing method according to Embodiment 1 of the present application
  • FIG. 2 is a schematic flowchart of an implementation process of an application testing method provided by Embodiment 2 of the present application;
  • FIG. 3 is a schematic flowchart of an implementation process of an application testing method provided in Embodiment 3 of the present application;
  • FIG. 4 is a schematic structural diagram of an application testing apparatus according to Embodiment 4 of the present application.
  • FIG. 5 is a schematic diagram of a mobile terminal provided in Embodiment 5 of the present application.
  • the application test of the mobile terminal is divided into two parts: recording the operation behavior of the user operating the application before the test, And playback of the user's operational behavior during testing.
  • the recording of the operation behavior of the user operating the application refers to the user performing the operation of the application, such as playing, fast forwarding, rewinding, pausing, and stopping the video playing application, and
  • the operation behavior is recorded and a corresponding test script is generated, so that the user's operation behavior can be repeated according to the test script during the subsequent playback, and the application is tested.
  • the playback of the user's operation behavior during the test refers to testing the application based on the recorded test script. Since the test script records the user's operation behavior on the application, the user's operation behavior will be tested at this time. A playback, so that the user's operation behavior on the application can be repeated during the test to complete the test required by the user, as detailed below:
  • FIG. 1 is a flowchart showing an implementation of an application testing method according to Embodiment 1 of the present application, which is described in detail as follows:
  • the mobile terminal extracts, according to the received recording and playback instruction, a first test script of the recorded user operation operation behavior of the application.
  • the mobile terminal after the mobile terminal itself completes the recording of the operation behavior of the user operating the application, the mobile terminal locally stores the recorded test script. If the user needs to test the application, only the mobile device needs to be moved. The corresponding playback playback command can be entered in the terminal to start the playback test of the application.
  • the embodiment of the present application needs to install a corresponding testing tool in the mobile terminal in advance to construct a corresponding testing framework in the mobile terminal, such as an installation package or a software development kit. (Software Development Kit, SDK, etc., to install test tools such as Monkeyrunner or Uiautomator to mobile terminals.
  • a corresponding testing tool such as an installation package or a software development kit.
  • software development Kit Software Development Kit, SDK, etc.
  • test tools such as Monkeyrunner or Uiautomator to mobile terminals.
  • the number of tests refers to the number of times the test script is repeatedly executed in this test. Because when testing an application, a single test may not be able to determine whether there is a defect in the application. For example, the stability of the application requires multiple tests to obtain a more reliable result. Therefore, in this application, in the embodiment, the test script is required to set a corresponding number of tests to ensure effective testing of the application.
  • the number of tests can be set by the user, or the preset default value can be used. For example, the preset default value can be set to 2 times. If the user does not set the number of tests, the default value is directly used.
  • a test command is an instruction included in a test script that controls the execution of a functional task by an interface control in an application.
  • test command needs to be parsed from the test script.
  • the corresponding test instructions between the test instructions are also determined to ensure that the functions are performed during the test.
  • the execution order of the tasks such as the video playback application first performs video playback and then performs video fast forward, and the execution sequence corresponds to the order in which the user operates the application behavior when the test script is recorded.
  • the embodiment of the present application When parsing the test instruction that needs to be executed, the embodiment of the present application also searches for the interface control included in the application, determines all the interface controls included in the application, and determines the interface required for the test instruction. The control, and then the control interface control performs the task of the corresponding test instruction. For example, when the test instruction includes the task of performing the play/pause function, the embodiment of the present application controls the corresponding play/pause button control and performs the play/pause function task. . Among them, the corresponding number of tests will be determined according to the number of tests. For example, if the number of tests is 10, the test control corresponding to the test command will be completed after the interface control is found out, and then the test corresponding to the test script is completed first, and then Repeat 9 tests after the completion of the test.
  • the findObject() method can be used to find the interface control included in the application according to the attributes of the element, such as text, hint, and contentDescription.
  • the abdshell command can be encapsulated to drive the instrumentation API to implement the analysis of the test script and the control of the interface control by using the test instructions to implement the recording test script parsing and the execution of the test instructions, and complete the testing of the application.
  • the Uiautomator can be called to parse the test instruction to determine the function task to be performed, and the function task is injected into the mobile terminal, so that the interface control can complete the application test according to the functional task.
  • the embodiment of the present application pre-records the user's operation behavior on the application program by using the mobile terminal itself, and generates a corresponding test script, and then directly tests the application program based on the recorded test script, so that the embodiment of the present application does not need to rely on any other device. Instead, the application itself can be tested directly using the mobile terminal itself, free from the limitations of test sites and devices, and can be targeted and generated only for the user's needs, thus greatly improving the The testing efficiency of the application makes the testing of the application simple and efficient.
  • the mobile terminal before the playback test of the embodiment of the present application, the mobile terminal further records the first test script of the application operation behavior of the user.
  • the operation behavior of the user operation application is first recorded to generate a test script, and the user is implemented based on the generated test script.
  • the playback of the operation behavior is implemented to test the application. Therefore, before the first embodiment of the present application, the embodiment of the present application records the operation behavior of the user application, which is as follows:
  • S201 Receive a script recording instruction input by a user, and determine an interface control included in the application.
  • the mobile terminal After receiving the footstep recording command input by the user in the test tool, the mobile terminal starts the mode of the footstep recording.
  • all the interface controls included in the application are first determined, such as using the Uiautomator as a test tool as described above.
  • the response data corresponding to the interface control refers to the data generated when the interface control responds to the user's operation behavior, and the time of the corresponding user operation behavior, such as the user video playback application performs a fast forward operation of 1.5 times during the video playback.
  • the fast forward button control will respond to the 1.5x fast forward operation, and the response data corresponding to the fast forward button control is 1.5 times the fast forward magnification and the time when the user fast forwards the operation.
  • the interface control When the user operates the application, the interface control responds to the user's operation behavior, thereby realizing the response of each function of the application to the user operation, such as the user playing the play/pause button during recording in the video playback application.
  • the corresponding play/pause button control performs a play/pause function task. Therefore, at this time, the response data of the interface control is recorded, and it is possible to know when the application performs some functions during the user's operation, so that Subsequent accurate playback of user actions.
  • S203 Receive a recording stop instruction input by the user, and generate a first test script based on the response data corresponding to the recorded interface control.
  • test script is based on subsequent playback tests.
  • a test script is generated according to the response data to record the user's operation on the application.
  • the playback of these operation behaviors is realized one by one, and the application is tested.
  • the method further includes: the mobile terminal sends the test script to the server, and the test script is standardized by the server. To download calls when testing with other mobile terminal applications.
  • the user's mobile terminal may be different, and the hardware configuration may also be different.
  • the size and resolution of the display screen are different, and some related to the hardware configuration may be involved in recording the response data.
  • Data such as when moving a picture, records the pixel distance of the picture movement when the user operates.
  • the test script generated by the actual user operation is directly tested on other mobile terminals, the test may have a greater impact. This makes it impossible for other mobile terminals to perform application testing. Therefore, in order to ensure normal testing of each mobile terminal, the obtained test script is unified in the embodiment of the present application, so that other mobile terminals can directly use the recorded test script, such as converting the pixel distance of the above picture. In order to compare the percentage distance of the display screen, regardless of the display screen size and resolution of other mobile terminals, the normal movement of the picture during the test can be guaranteed.
  • the method before receiving the recording playback instruction for performing the playback test, the method further includes: adjusting the first test number and the first test instruction according to the received test parameter input instruction of the user input.
  • the user is provided with the function of modifying the number of tests to meet the actual needs of different users, in view of the fact that the number of tests of the default setting may not meet the requirements of the user.
  • the test script in the first embodiment of the present application records the operation behavior of the user application, the setting of some parameter values may not be very accurate when the user manually operates, such as in a video playback application.
  • the method of sliding to the right sets the fast forward magnification.
  • the user's setting of the fast forward magnification is difficult to accurately quantify.
  • the actual set parameter value and the ideal value often have a certain difference. Therefore, in order to achieve accurate setting of these parameter values,
  • the user is provided with a modification function of the test instruction to achieve precise control of the test.
  • the following includes:
  • the AccessibilityService is used to perform event monitoring on the input of the user operation instruction.
  • the method before the mobile terminal extracts the first test script of the user's application operation behavior recorded by the mobile terminal according to the received recording playback instruction, the method further includes:
  • the method further includes:
  • script selection instruction is not a recording playback instruction, select a second test script pointed to by the script selection instruction from the preset test script set.
  • S106 Find an interface control included in the application, and based on the second test number, control the interface control to execute a task corresponding to the second test instruction to test the application.
  • the test script obtained by recording the operation of the user application is directly read, but in actual cases, the user may need the mobile terminal to directly run the preset test script recorded by the non-mobile terminal for testing. . Therefore, in the embodiment of the present application, the function of performing the application test for running the non-recorded test script is provided to meet the actual needs of the user.
  • the user only needs to save the test script recorded by the non-mobile terminal in advance.
  • the mobile terminal stores all the stored non-recorded test scripts as a test script set. At this time, the user only needs to input the corresponding step selection instruction when inputting the recording playback instruction, thereby realizing the test script set. Select the required test script to conduct a return visit test.
  • the user can pre-write the test script on the computer side by using the Uiautomator test tool. After determining the test task, the corresponding test instruction is written for each interface control, and the corresponding execution order is set. Get the required test script, and then set the number of tests corresponding to the test script, thus completing the preparation of the test script. After the test script is obtained, it is stored to the mobile terminal, so that the mobile terminal can directly test the application independently according to the stored test script.
  • the method further includes:
  • the response data of the application in the test includes the response time of the application to each test instruction in the test and the response result, such as the response time of the application to the fast forward instruction in the video playing application, and the response result is Success or failure, whether the application crashes during the response, etc.
  • the response data of the application in the test includes the response time of the application to each test instruction in the test and the response result, such as the response time of the application to the fast forward instruction in the video playing application, and the response result is Success or failure, whether the application crashes during the response, etc.
  • only the user can record the operation behavior of the application during the recording process, and therefore only the response data of the test instructions corresponding to the operation behaviors can be analyzed, and some applications related to the operation behavior are obtained.
  • the performance indicators of the program as well as some common performance indicators that are directly related to the operating behavior. For example, for the video playback application, the user only plays, pauses, fast forwards, and rewinds while recording.
  • the embodiment only has performance indicators related to these operations, such as whether the response time of play, pause, fast forward, and fast reverse is normal, whether the corresponding function is normally responded, and the performance indicators that are directly related to the operation behavior, such as multiple In the subtest, whether the application crashes, whether the processor resource occupancy is too high, etc., analyzes and obtains the corresponding performance indicator data.
  • the embodiment of the present application first determines the response data corresponding to each test instruction, and reads the corresponding standard value of the test result set in advance for comparison, and then obtains the final performance indicator data.
  • the application is tested by pre-recording the user's operation behavior on the application and generating a corresponding test script, and then the application is directly tested based on the recorded test script, so that the embodiment of the present application does not need to rely on any other device. It is possible to directly test the application using the mobile terminal itself, get rid of the limitations of the test site and the device, and can only generate and test the targeted test script for the user's needs, thereby greatly improving the application.
  • the testing efficiency of the program makes the testing of the application simple and efficient.
  • the user provides functions such as parameter modification, preset test script running and performance index analysis, which makes the user's testing of the application more intelligent and convenient, and further improves the testing efficiency of the application.
  • FIG. 4 is a structural block diagram of an application testing device provided by an embodiment of the present application. For the convenience of description, only parts related to the embodiment of the present application are shown.
  • the application testing device illustrated in FIG. 4 may be the execution body of the application testing method provided in the foregoing first embodiment.
  • the application testing device includes:
  • the recording and playback module 41 is configured to extract, according to the received recording and playback instruction, the first test script of the operation behavior of the user operation application recorded by the application testing device.
  • the first script parsing module 41 is configured to obtain a first test number corresponding to the first test script, and parse the first test script to determine a first test instruction included in the first test script.
  • the first test module 42 is configured to find an interface control included in the application, and control, according to the first number of tests, the interface control to perform a task corresponding to the first test instruction, to the application The program is tested.
  • the application testing device further includes:
  • a script recording module configured to perform recording of the first test script on an application operation behavior of the user.
  • Script recording module including:
  • a control determining module configured to receive a script recording instruction input by the user, and determine the interface control included in the application.
  • the response recording module is configured to record response data corresponding to the interface control during the response of the application to the operation instruction input by the user.
  • a script generating module configured to receive a recording stop instruction input by the user, and generate the first test script based on the response data corresponding to the recorded interface control.
  • response recording module includes:
  • the monitoring module is configured to perform event monitoring on the input of the operation instruction of the user by using the AccessibilityService if the operating system of the mobile terminal is an Android system.
  • the data obtaining module is configured to obtain the response data of the interface control by the interface control based on the getSource() method of the AccessibilityEvent.
  • the application testing device further includes:
  • the script selection module is configured to: if the script selection instruction is not the recording playback instruction, select a second test script pointed to by the script selection instruction from a preset test script set.
  • the second script parsing module is configured to obtain a second test number corresponding to the second test script, and parse the second test script to determine a second test instruction included in the second test script.
  • a second test module configured to: find the interface control included in the application, and control, according to the second number of tests, the interface control to perform a task corresponding to the second test instruction, to The application is tested.
  • the application testing device further includes:
  • the performance analysis module is configured to analyze the response data of the application in the test to obtain performance indicator data of the application.
  • first, second, and the like are used in the text to describe various elements in the embodiments of the present application, these elements should not be limited by these terms. These terms are only used to distinguish one element from another.
  • the first contact can be named a second contact, and similarly, the second contact can be named the first contact without departing from the scope of the various described embodiments. Both the first contact and the second contact are contacts, but they are not the same contact.
  • FIG. 5 is a schematic diagram of a mobile terminal according to an embodiment of the present application.
  • the mobile terminal 5 of this embodiment includes a processor 50, a memory 51 in which computer readable instructions 52 executable on the processor 50 are stored.
  • the processor 50 when executing the computer readable instructions 52, implements the steps in the various application test method embodiments described above, such as steps 101 through 103 shown in FIG.
  • the processor 50 executes the computer readable instructions 52, the functions of the modules/units in the various apparatus embodiments described above are implemented, such as the functions of the modules 41 to 43 shown in FIG.
  • the mobile terminal 5 can be a computing device such as a desktop computer, a notebook, a palmtop computer, and a cloud server.
  • the mobile terminal may include, but is not limited to, a processor 50, a memory 51. It will be understood by those skilled in the art that FIG. 5 is merely an example of the mobile terminal 5, does not constitute a limitation of the mobile terminal 5, may include more or less components than the illustration, or combine some components, or different components.
  • the mobile terminal may further include an input sending device, a network access device, a bus, and the like.
  • the so-called processor 50 can be a central processing unit (Central Processing Unit, CPU), can also be other general purpose processors, digital signal processors (DSP), application specific integrated circuits (Application Specific Integrated Circuit (ASIC), Field-Programmable Gate Array (FPGA) or other programmable logic device, discrete gate or transistor logic device, discrete hardware components, etc.
  • the general purpose processor may be a microprocessor or the processor or any conventional processor or the like.
  • the memory 51 may be an internal storage unit of the mobile terminal 5, such as a hard disk or a memory of the mobile terminal 5.
  • the memory 51 may also be an external storage device of the mobile terminal 5, such as a plug-in hard disk equipped on the mobile terminal 5, a smart memory card (SMC), and a secure digital (SD). Card, flash card, etc. Further, the memory 51 may also include both an internal storage unit of the mobile terminal 5 and an external storage device.
  • the memory 51 is configured to store the computer readable instructions and other programs and data required by the mobile terminal.
  • the memory 51 can also be used to temporarily store data that has been sent or is about to be transmitted.
  • each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
  • the above integrated unit can be implemented in the form of hardware or in the form of a software functional unit.
  • the integrated modules/units if implemented in the form of software functional units and sold or used as separate products, may be stored in a computer readable storage medium.
  • the present application implements all or part of the processes in the foregoing embodiments, and may also be implemented by computer readable instructions, which may be stored in a computer readable storage medium.
  • the computer readable instructions when executed by a processor, may implement the steps of the various method embodiments described above.
  • the computer readable instructions comprise computer readable instruction code, which may be in the form of source code, an object code form, an executable file or some intermediate form or the like.
  • the computer readable medium may include any entity or device capable of carrying the computer readable instruction code, a recording medium, a USB flash drive, a removable hard disk, a magnetic disk, an optical disk, a computer memory, a read only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), electrical carrier signals, telecommunications signals, and software distribution media. It should be noted that the content contained in the computer readable medium may be appropriately increased or decreased according to the requirements of legislation and patent practice in a jurisdiction, for example, in some jurisdictions, according to legislation and patent practice, computer readable media Does not include electrical carrier signals and telecommunication signals.

Abstract

Provided are an application program testing method and apparatus, and a mobile terminal and a medium, wherein same are applicable in the technical field of data processing. The method comprises: a mobile terminal extracting, according to a received recording playback instruction, a first test script of a user's application program operation behavior recorded by the mobile terminal; acquiring the first number of tests corresponding to the first test script, and parsing the first test script to determine a first test instruction included in the first test script; and searching for an interface control included in an application program, and based on the first number of tests, controlling the interface control so that same executes a task corresponding to the first test instruction so as to test the application program. The testing of an application program can be completed by directly using a mobile terminal itself, thus getting rid of the limitations of factors, such as test sites and devices, and greatly improving the application program testing efficiency. Therefore, the testing of the application program becomes simple and efficient.

Description

一种应用程序测试方法、装置、移动终端及介质Application testing method, device, mobile terminal and medium
本申请要求于2018年05月16日提交中国专利局、申请号为201810466917.9、发明名称为“一种应用程序测试方法及移动终端”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims priority to Chinese Patent Application No. 201810466917.9, entitled "Application Test Method and Mobile Terminal", filed on May 16, 2018, the entire contents of which is incorporated herein by reference. In the application.
技术领域Technical field
本申请属于数据处理技术领域,尤其涉及一种应用程序测试方法、装置、移动终端及介质。The present application belongs to the field of data processing technologies, and in particular, to an application testing method, apparatus, mobile terminal, and medium.
背景技术Background technique
现有的应用程序测试方法都是将移动终端与电脑端连接,利用电脑端来对移动终端进行控制,以实现对应用程序的测试。由于必须与电脑端进行连接才能进行测试,从而使得对应用程序的测试极其容易受到场地和设备等因素的限制,测试不方便效率低下。The existing application testing methods are to connect the mobile terminal to the computer end, and use the computer to control the mobile terminal to implement testing of the application. Testing is necessary because it must be connected to the computer, making testing of the application extremely vulnerable to factors such as site and equipment, making testing inconvenient and inefficient.
技术问题technical problem
有鉴于此,本申请实施例提供了一种应用程序测试方法及移动终端,以解决现有技术中仅能使用电脑端实现对应用程序进行测试,使得对应用程序测试效率低下的问题。In view of this, the embodiment of the present application provides an application testing method and a mobile terminal, so as to solve the problem that the application can be tested only by using the computer end in the prior art, so that the application testing efficiency is low.
技术解决方案Technical solution
本申请实施例的第一方面提供了一种应用程序测试方法,包括:A first aspect of an embodiment of the present application provides an application testing method, including:
移动终端根据接收到的录制回放指令,对其录制的用户操作应用程序的操作行为的第一测试脚本进行提取;The mobile terminal extracts the first test script of the recorded operation behavior of the user operation application according to the received recording playback instruction;
获取所述第一测试脚本对应的第一测试次数,并对所述第一测试脚本进行解析,确定出所述第一测试脚本中包含的第一测试指令;Obtaining a first test number corresponding to the first test script, and parsing the first test script to determine a first test instruction included in the first test script;
查找出所述应用程序所包含的界面控件,并基于所述第一测试次数,控制所述界面控件执行所述第一测试指令对应的任务,以对所述应用程序进行测试。Finding an interface control included in the application, and controlling, according to the first number of tests, the interface control to execute a task corresponding to the first test instruction, to test the application.
本申请实施例的第二方面提供了一种应用程序测试装置,包括:A second aspect of the embodiments of the present application provides an application testing apparatus, including:
录制回放模块,用于移动终端根据接收到的录制回放指令,对其录制的用户操作应用程序的操作行为的第一测试脚本进行提取;a recording and playback module, configured for the mobile terminal to extract, according to the received recording and playback instruction, the first test script of the recorded operation behavior of the user operation application;
第一脚本解析模块,用于获取所述第一测试脚本对应的第一测试次数,并对所述第一测试脚本进行解析,确定出所述第一测试脚本中包含的第一测试指令;a first script parsing module, configured to acquire a first test number corresponding to the first test script, and parse the first test script to determine a first test instruction included in the first test script;
第一测试模块,用于查找出所述应用程序所包含的界面控件,并基于所述第一测试次数,控制所述界面控件执行所述第一测试指令对应的任务,以对所述应用程序进行测试。a first test module, configured to find an interface control included in the application, and control, according to the first number of tests, the interface control to execute a task corresponding to the first test instruction, to the application carry out testing.
本申请实施例的第三方面提供了一种移动终端,包括存储器、处理器,所述存储器上存储有可在所述处理器上运行的计算机可读指令,所述处理器执行所述计算机可读指令时实现如下步骤:A third aspect of the embodiments of the present application provides a mobile terminal, including a memory, a processor, and the computer storing computer readable instructions executable on the processor, where the processor executes the computer The following steps are implemented when reading the instruction:
移动终端根据接收到的录制回放指令,对其录制的用户操作应用程序的操作行为的第一测试脚本进行提取;The mobile terminal extracts the first test script of the recorded operation behavior of the user operation application according to the received recording playback instruction;
获取所述第一测试脚本对应的第一测试次数,并对所述第一测试脚本进行解析,确定出所述第一测试脚本中包含的第一测试指令;Obtaining a first test number corresponding to the first test script, and parsing the first test script to determine a first test instruction included in the first test script;
查找出所述应用程序所包含的界面控件,并基于所述第一测试次数,控制所述界面控件执行所述第一测试指令对应的任务,以对所述应用程序进行测试。Finding an interface control included in the application, and controlling, according to the first number of tests, the interface control to execute a task corresponding to the first test instruction, to test the application.
本申请实施例的第四方面提供了一种计算机可读存储介质,所述计算机可读存储介质存储有计算机可读指令,其特征在于,所述计算机可读指令被至少一个处理器执行时实现如下步骤:A fourth aspect of the embodiments of the present application provides a computer readable storage medium storing computer readable instructions, wherein the computer readable instructions are implemented by at least one processor The following steps:
移动终端根据接收到的录制回放指令,对其录制的用户操作应用程序的操作行为的第一测试脚本进行提取;The mobile terminal extracts the first test script of the recorded operation behavior of the user operation application according to the received recording playback instruction;
获取所述第一测试脚本对应的第一测试次数,并对所述第一测试脚本进行解析,确定出所述第一测试脚本中包含的第一测试指令;Obtaining a first test number corresponding to the first test script, and parsing the first test script to determine a first test instruction included in the first test script;
查找出所述应用程序所包含的界面控件,并基于所述第一测试次数,控制所述界面控件执行所述第一测试指令对应的任务,以对所述应用程序进行测试。Finding an interface control included in the application, and controlling, according to the first number of tests, the interface control to execute a task corresponding to the first test instruction, to test the application.
有益效果Beneficial effect
本申请实施例与现有技术相比存在的有益效果是:通过移动终端预先录制用户对应用程序的操作行为并生成对应的测试脚本,再基于录制的测试脚本直接对应用程序进行测试,从而使得本申请实施例无需依赖任何其他设备,而是直接使用移动终端本身就可以完成对应用程序的测试,摆脱了测试场地和设备等因素的限制,且可以仅针对用户的需求来进行针对性测试脚本生成与测试,从而极大地提升了对应用程序的测试效率,使得应用程序的测试变得简单高效。Compared with the prior art, the embodiment of the present application has the beneficial effects of pre-recording the user's operation behavior on the application program by the mobile terminal and generating a corresponding test script, and then directly testing the application program based on the recorded test script, thereby The embodiment of the present application does not need to rely on any other device, but directly uses the mobile terminal itself to complete the test of the application program, frees the limitations of the test site and the device, and can only perform the targeted test script for the user's needs. Build and test, which greatly improves the efficiency of testing the application, making the testing of the application simple and efficient.
附图说明DRAWINGS
为了更清楚地说明本申请实施例中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings used in the embodiments or the prior art description will be briefly described below. Obviously, the drawings in the following description are only the present application. For some embodiments, other drawings may be obtained from those of ordinary skill in the art in light of the inventive workability.
图1是本申请实施例一提供的应用程序测试方法的实现流程示意图;1 is a schematic flowchart showing an implementation process of an application testing method according to Embodiment 1 of the present application;
图2是本申请实施例二提供的应用程序测试方法的实现流程示意图;2 is a schematic flowchart of an implementation process of an application testing method provided by Embodiment 2 of the present application;
图3是本申请实施例三提供的应用程序测试方法的实现流程示意图;3 is a schematic flowchart of an implementation process of an application testing method provided in Embodiment 3 of the present application;
图4是本申请实施例四提供的应用程序测试装置的结构示意图;4 is a schematic structural diagram of an application testing apparatus according to Embodiment 4 of the present application;
图5是本申请实施例五提供的移动终端的示意图。FIG. 5 is a schematic diagram of a mobile terminal provided in Embodiment 5 of the present application.
本发明的实施方式Embodiments of the invention
以下描述中,为了说明而不是为了限定,提出了诸如特定系统结构、技术之类的具体细节,以便透彻理解本申请实施例。然而,本领域的技术人员应当清楚,在没有这些具体细节的其它实施例中也可以实现本申请。在其它情况中,省略对众所周知的系统、装置、电路以及方法的详细说明,以免不必要的细节妨碍本申请的描述。In the following description, for purposes of illustration and description However, it will be apparent to those skilled in the art that the present invention may be practiced in other embodiments without these specific details. In other instances, detailed descriptions of well-known systems, devices, circuits, and methods are omitted so as not to obscure the description of the application.
为了说明本申请所述的技术方案,下面通过具体实施例来进行说明。In order to explain the technical solutions described in the present application, the following description will be made by way of specific embodiments.
为了便于读者理解,此处先对本申请技术方案进行简要介绍说明:在本申请技术方案中,对移动终端的应用程序测试分为两个部分:测试前对用户操作应用程序的操作行为的录制,以及测试时对用户的操作行为的回放。For the convenience of the reader, the technical solution of the present application is briefly described herein. In the technical solution of the present application, the application test of the mobile terminal is divided into two parts: recording the operation behavior of the user operating the application before the test, And playback of the user's operational behavior during testing.
其中,对用户操作应用程序的操作行为的录制,是指用户在进行应用程序的操作时,如对视频播放应用程序进行播放、快进、快退、暂停以及停止等功能的操作时,对用户的操作行为进行记录并生成对应的测试脚本,以使得后续回放时能根据该测试脚本重复出用户的操作行为,完成对应用程序的测试。测试时对用户操作行为的回放,是指基于录制的测试脚本来对应用程序进行测试,由于测试脚本中记录了用户对应用程序的操作行为,因此,此时测试时会将用户的操作行为一一回放,使得测试时能重复用户对应用程序的操作行为,以完成对用户所需的测试,详述如下:The recording of the operation behavior of the user operating the application refers to the user performing the operation of the application, such as playing, fast forwarding, rewinding, pausing, and stopping the video playing application, and The operation behavior is recorded and a corresponding test script is generated, so that the user's operation behavior can be repeated according to the test script during the subsequent playback, and the application is tested. The playback of the user's operation behavior during the test refers to testing the application based on the recorded test script. Since the test script records the user's operation behavior on the application, the user's operation behavior will be tested at this time. A playback, so that the user's operation behavior on the application can be repeated during the test to complete the test required by the user, as detailed below:
图1示出了本申请实施例一提供的应用程序测试方法的实现流程图,详述如下:FIG. 1 is a flowchart showing an implementation of an application testing method according to Embodiment 1 of the present application, which is described in detail as follows:
S101,移动终端根据接收到的录制回放指令,对其录制的用户操作应用程序的操作行为的第一测试脚本进行提取。S101. The mobile terminal extracts, according to the received recording and playback instruction, a first test script of the recorded user operation operation behavior of the application.
本申请实施例中,在利用移动终端本身完成对用户操作应用程序的操作行为的录制后,移动终端本地会存储录制得到的测试脚本,此时若用户需要对应用程序进行测试,只需要在移动终端中输入相应的录制回放指令,即可开始对应用程序的回放测试。In the embodiment of the present application, after the mobile terminal itself completes the recording of the operation behavior of the user operating the application, the mobile terminal locally stores the recorded test script. If the user needs to test the application, only the mobile device needs to be moved. The corresponding playback playback command can be entered in the terminal to start the playback test of the application.
为了实现对用户操作行为的录制及回放测试,本申请实施例需要预先在移动终端中安装好相应的测试工具,以在移动终端中结构出相应的测试框架,如以安装包或者软件开发工具包(Software Development Kit,SDK)等形式,将Monkeyrunner或者Uiautomator等测试工具安装至移动终端。在测试工具安装完成后,用户通过在测试工具中输入录制回放指令,并由测试工具读取测试脚本,提取被测试的应用程序,再依照测试脚本对应用程序进行测试即可。In order to implement the recording and playback test of the user's operation behavior, the embodiment of the present application needs to install a corresponding testing tool in the mobile terminal in advance to construct a corresponding testing framework in the mobile terminal, such as an installation package or a software development kit. (Software Development Kit, SDK, etc., to install test tools such as Monkeyrunner or Uiautomator to mobile terminals. After the test tool is installed, the user can input the recorded playback command in the test tool, and the test tool reads the test script, extracts the tested application, and then tests the application according to the test script.
S102,获取第一测试脚本对应的第一测试次数,并对第一测试脚本进行解析,确定出第一测试脚本中包含的第一测试指令。S102. Acquire a first test number corresponding to the first test script, and parse the first test script to determine a first test instruction included in the first test script.
其中,测试次数是指此次测试重复执行测试脚本的次数。由于在对应用程序进行测试时,单次测试可能无法很好地确定出应用程序中是否存在缺陷,如应用程序的稳定性需要多次测试才能得出一个较为可靠的结果,因此,在本申请实施例中需要对测试脚本设置对应的测试次数,以保证对应用程序的有效测试。其中,测试次数可由用户自行设定,也可使用预先设置的默认值,如可以设置预设默认值为2次,若用户没有对测试次数进行设置,则直接使用该默认值。测试指令,是指测试脚本中包含的用于控制应用程序中界面控件执行功能任务的指令。在对应用程序进行控制以实现对应用程序的自动测试时,为了使应用程序能自动执行所需的测试任务,需要控制对应的界面控件执行功能任务,如需要视频播放应用程序执行视频播放/暂停等测试任务时,需要控制对应的播放/暂停按钮控件执行播放/暂停功能任务,因此,为了保证后续对应用程序的自动测试,需要从测试脚本中解析出所包含的测试指令。Among them, the number of tests refers to the number of times the test script is repeatedly executed in this test. Because when testing an application, a single test may not be able to determine whether there is a defect in the application. For example, the stability of the application requires multiple tests to obtain a more reliable result. Therefore, in this application, In the embodiment, the test script is required to set a corresponding number of tests to ensure effective testing of the application. The number of tests can be set by the user, or the preset default value can be used. For example, the preset default value can be set to 2 times. If the user does not set the number of tests, the default value is directly used. A test command is an instruction included in a test script that controls the execution of a functional task by an interface control in an application. When the application is controlled to implement automatic testing of the application, in order to enable the application to automatically perform the required test tasks, it is necessary to control the corresponding interface control to perform functional tasks, such as requiring the video playback application to perform video playback/pause. When testing a task, it is necessary to control the corresponding play/pause button control to execute the play/pause function task. Therefore, in order to ensure subsequent automatic testing of the application, the included test command needs to be parsed from the test script.
应当说明的,在测试脚本中测试指令之间是有着对应的执行顺序的,在解析测试指令时,同时也确定出了各个测试指令之间对应的测试指令,以保证在进行测试时对各个功能任务的执行顺序,如视频播放应用程序先进行视频播放再进行视频快进,该执行顺序与测试脚本录制时用户对应用程序的操作行为的先后顺序相对应。It should be noted that there is a corresponding execution order between the test instructions in the test script. When parsing the test instructions, the corresponding test instructions between the test instructions are also determined to ensure that the functions are performed during the test. The execution order of the tasks, such as the video playback application first performs video playback and then performs video fast forward, and the execution sequence corresponds to the order in which the user operates the application behavior when the test script is recorded.
S103,查找出应用程序所包含的界面控件,并基于第一测试次数,控制界面控件执行第一测试指令对应的任务,以对应用程序进行测试。S103. Find an interface control included in the application, and based on the first test number, control the interface control to execute a task corresponding to the first test instruction to test the application.
在解析出所需执行的测试指令时,本申请实施例还会对应用程序中包含的界面控件进行查找,确定出应用程序中包含的所有界面控件,并确定出测试指令所需使用到的界面控件,再控制界面控件执行对应的测试指令的任务,如测试指令中包含执行播放/暂停功能任务时,本申请实施例会控制查找出的对应的播放/暂停按钮控件,并执行播放/暂停功能任务。其中,还会根据测试次数来确定对应的测试次数,如假设测试次数为10时,会在界面控件查找出来之后按照解析出的测试指令控制界面控件先完成一次测试脚本对应的测试,再在此次完成后重复9次测试。When parsing the test instruction that needs to be executed, the embodiment of the present application also searches for the interface control included in the application, determines all the interface controls included in the application, and determines the interface required for the test instruction. The control, and then the control interface control performs the task of the corresponding test instruction. For example, when the test instruction includes the task of performing the play/pause function, the embodiment of the present application controls the corresponding play/pause button control and performs the play/pause function task. . Among them, the corresponding number of tests will be determined according to the number of tests. For example, if the number of tests is 10, the test control corresponding to the test command will be completed after the interface control is found out, and then the test corresponding to the test script is completed first, and then Repeat 9 tests after the completion of the test.
作为本申请的一个实施例,在使用Uiautomator作为测试工具时,可以根据元素的text、hint、contentDescription等属性,利用findObject()方法来查找到应用程序包含的界面控件。同时,可以对abdshell命令进行封装,以驱动instrumentation的API实现对测试脚本的解析以及利用测试指令对界面控件的控制,以实现对录制测试脚本解析以及测试指令的执行,完成对应用程序的测试。在本申请实施例中,可以调用Uiautomator对测试指令进行解析确定出所需执行的功能任务,并对移动终端进行功能任务的注入,以使得界面控件能根据功能任务完成应用程序的测试。As an embodiment of the present application, when using Uiautomator as a test tool, the findObject() method can be used to find the interface control included in the application according to the attributes of the element, such as text, hint, and contentDescription. At the same time, the abdshell command can be encapsulated to drive the instrumentation API to implement the analysis of the test script and the control of the interface control by using the test instructions to implement the recording test script parsing and the execution of the test instructions, and complete the testing of the application. In the embodiment of the present application, the Uiautomator can be called to parse the test instruction to determine the function task to be performed, and the function task is injected into the mobile terminal, so that the interface control can complete the application test according to the functional task.
本申请实施例通过利用移动终端本身预先录制用户对应用程序的操作行为并生成对应的测试脚本,再基于录制的测试脚本直接对应用程序进行测试,从而使得本申请实施例无需依赖任何其他设备,而是直接使用移动终端本身就可以完成对应用程序的测试,摆脱了测试场地和设备等因素的限制,且可以仅针对用户的需求来进行针对性测试脚本生成与测试,从而极大地提升了对应用程序的测试效率,使得应用程序的测试变得简单高效。The embodiment of the present application pre-records the user's operation behavior on the application program by using the mobile terminal itself, and generates a corresponding test script, and then directly tests the application program based on the recorded test script, so that the embodiment of the present application does not need to rely on any other device. Instead, the application itself can be tested directly using the mobile terminal itself, free from the limitations of test sites and devices, and can be targeted and generated only for the user's needs, thus greatly improving the The testing efficiency of the application makes the testing of the application simple and efficient.
作为本申请实施例二,如图2所示,在本申请实施例一回放测试之前,还包括移动终端对用户的应用程序操作行为进行第一测试脚本的录制。为了实现移动终端不依赖于其他设备而进行应用程序的测试,本申请实施例中会先对用户操作应用程序的操作行为进行录制以生成测试脚本,以基于生成的测试脚本为基础来实现对用户操作行为的回放,实现对应用程序的测试,因此在本申请实施例一之前,本申请实施例会录制用户应用程序的操作行为,详述如下:As the second embodiment of the present application, as shown in FIG. 2, before the playback test of the embodiment of the present application, the mobile terminal further records the first test script of the application operation behavior of the user. In order to implement the test of the application by the mobile terminal without relying on other devices, in the embodiment of the present application, the operation behavior of the user operation application is first recorded to generate a test script, and the user is implemented based on the generated test script. The playback of the operation behavior is implemented to test the application. Therefore, before the first embodiment of the present application, the embodiment of the present application records the operation behavior of the user application, which is as follows:
S201,接收用户输入的脚本录制指令,并确定出应用程序包含的界面控件。S201: Receive a script recording instruction input by a user, and determine an interface control included in the application.
在接收到用户在测试工具中输入的脚步录制指令后,移动终端开始进行脚步本录制的模式,此时首先会确定出应用程序中所包含的所有界面控件,如上述的在使用Uiautomator作为测试工具时,可以根据元素的text、hint、contentDescription等属性,利用findObject()方法来查找到应用程序包含的界面控件。After receiving the footstep recording command input by the user in the test tool, the mobile terminal starts the mode of the footstep recording. At this time, all the interface controls included in the application are first determined, such as using the Uiautomator as a test tool as described above. When you use the elements of text, hint, contentDescription, etc., you can use the findObject() method to find the interface controls contained in the application.
S202,记录应用程序在对用户输入的操作指令响应过程中,界面控件对应的响应数据。S202. Record response data corresponding to the interface control during the response of the application to the operation command input by the user.
其中,界面控件对应响应数据是指界面控件对用户操作行为进行响应时产生的数据,以及对应的用户操作行为的时间,如用户视频播放应用程序在视频播放时进行了1.5倍的快进操作,此时快进按钮控件会响应执行1.5倍的快进操作,此时快进按钮控件对应的响应数据就是1.5倍的快进倍率以及用户快进操作时的时间。The response data corresponding to the interface control refers to the data generated when the interface control responds to the user's operation behavior, and the time of the corresponding user operation behavior, such as the user video playback application performs a fast forward operation of 1.5 times during the video playback. At this time, the fast forward button control will respond to the 1.5x fast forward operation, and the response data corresponding to the fast forward button control is 1.5 times the fast forward magnification and the time when the user fast forwards the operation.
用户在对应用程序进行操作时,界面控件会对用户的操作行为进行响应,从而实现应用程序的各个功能对用户操作的响应,如视频播放应用程序中用户若在录制时点击了播放/暂停按钮,对应的播放/暂停按钮控件执行播放/暂停功能任务,因此,此时对界面控件的响应数据进行记录,即可知道在用户的操作过程中应用程序都在何时执行了一些什么功能,以便后续对用户操作的准确回放。When the user operates the application, the interface control responds to the user's operation behavior, thereby realizing the response of each function of the application to the user operation, such as the user playing the play/pause button during recording in the video playback application. The corresponding play/pause button control performs a play/pause function task. Therefore, at this time, the response data of the interface control is recorded, and it is possible to know when the application performs some functions during the user's operation, so that Subsequent accurate playback of user actions.
S203,接收用户输入的录制停止指令,并基于记录的界面控件对应的响应数据生成第一测试脚本。S203. Receive a recording stop instruction input by the user, and generate a first test script based on the response data corresponding to the recorded interface control.
在用户完成对应用程序的操作行为后,只需在测试工具中输入相应的录制停止指令,即可停止对用户操作行为的录制,并会将录制得到的界面控件的响应数据进行处理,得到相应的测试脚本,以为后续回放测试作为基础。如用户录制期间完成对视频播放应用程序的播放/暂停/快进/停止功能操作后,得到了对应界面控件的响应数据之后,根据这些响应数据生成测试脚本,以记录用户对应用程序的操作,并在接收到用户的录制回放指令后实现对这些操作行为的一一回放,实现对应用程序的测试。After the user completes the operation behavior of the application, simply input the corresponding recording stop instruction in the test tool to stop recording the user's operation behavior, and process the response data of the recorded interface control to obtain corresponding The test script is based on subsequent playback tests. After the user performs the play/pause/fast forward/stop function operation of the video playing application during the recording, after obtaining the response data of the corresponding interface control, a test script is generated according to the response data to record the user's operation on the application. And after receiving the user's recorded playback instruction, the playback of these operation behaviors is realized one by one, and the application is tested.
作为本申请的一个优选实施例,在移动终端完成对用户操作应用程序的操作行为的录制,得到测试脚本之后,还包括:移动终端将测试脚本发送至服务器,并由服务器对测试脚本进行标准化处理,以其他移动终端应用程序测试时下载调用。As a preferred embodiment of the present application, after the mobile terminal completes the recording of the operation behavior of the user operation application, after obtaining the test script, the method further includes: the mobile terminal sends the test script to the server, and the test script is standardized by the server. To download calls when testing with other mobile terminal applications.
考虑到当用户需要同时测试多台移动终端时,若一一按照上述实施例的录制-回放步骤进行处理,需要录制非常多次的测试脚本,需要耗费大量的时间精力,效率较低。因此,为了提升用户对多台移动终端的应用程序测试,本申请实施例中,移动终端在记录好用户的操作行为并得到测试脚本之后,会将测试脚本上传至服务器以供其他移动终端的下载使用,由于其他移动终端也只需要下载测试脚本即可实现后续的应用程序测试,因此同样可以实现对应用程序的独立自动测试,而无需使用电脑来对测试进行调控。Considering that when the user needs to test a plurality of mobile terminals at the same time, if the recording-playback steps of the above embodiment are processed one by one, it is necessary to record a very large number of test scripts, which requires a lot of time and effort and is inefficient. Therefore, in order to improve user application testing of multiple mobile terminals, in the embodiment of the present application, after recording the user's operation behavior and obtaining the test script, the mobile terminal uploads the test script to the server for downloading by other mobile terminals. Use, because other mobile terminals only need to download test scripts to implement subsequent application testing, so independent automatic testing of the application can be achieved without using a computer to regulate the test.
实际情况中,用户的移动终端可能会有所不同,硬件配置也会存在差异,如显示屏幕的大小、分辨率等各不相同,而在记录响应数据时可能会涉及到一些与硬件配置相关的数据,如对图片移动时,记录了用户操作时图片移动的像素距离,此时若直接按照实际用户操作对应生成的测试脚本来对其他移动终端进行测试时,可能会对测试造成较大的影响,使得其他移动终端无法进行应用程序测试。因此为了保证对各个移动终端的正常测试,本申请实施例中会对得到的测试脚本进行统一化处理,使得其他移动终端也能直接使用录制得到的测试脚本,如将上述图片移动的像素距离转换为相对显示屏幕的百分比大小距离,此时无论其他移动终端的显示屏幕大小、分辨率是多少,都可以保证对测试时图片的正常移动。In actual situations, the user's mobile terminal may be different, and the hardware configuration may also be different. For example, the size and resolution of the display screen are different, and some related to the hardware configuration may be involved in recording the response data. Data, such as when moving a picture, records the pixel distance of the picture movement when the user operates. At this time, if the test script generated by the actual user operation is directly tested on other mobile terminals, the test may have a greater impact. This makes it impossible for other mobile terminals to perform application testing. Therefore, in order to ensure normal testing of each mobile terminal, the obtained test script is unified in the embodiment of the present application, so that other mobile terminals can directly use the recorded test script, such as converting the pixel distance of the above picture. In order to compare the percentage distance of the display screen, regardless of the display screen size and resolution of other mobile terminals, the normal movement of the picture during the test can be guaranteed.
作为本申请的一个实施例,在接收到录制回放指令进行回放测试之前,还包括:根据接收到的用户输入的测试参数设置指令,对第一测试次数和或第一测试指令进行调整。As an embodiment of the present application, before receiving the recording playback instruction for performing the playback test, the method further includes: adjusting the first test number and the first test instruction according to the received test parameter input instruction of the user input.
考虑到默认设置的测试次数不一定能满足用户的需求,因此本申请实施例中为用户提供对测试次数修改的功能,以满足不同用户的实际需求。同时,由于本申请实施例一中的测试脚本是对用户应用程序的操作行为进行录制得到的,而用户手动操作时对一些参数值的设置可能不是很精确,如在视频播放应用程序中,采用向右滑动的方式设置快进倍率,此时用户对快进倍率的设置难以准确量化,实际设置的参数值与理想值往往存在一定的差异,因此,为了实现对这些参数值的准确设置,本申请实施例中为用户提供了对测试指令的修改功能,以实现对测试的精确控制。In the embodiment of the present application, the user is provided with the function of modifying the number of tests to meet the actual needs of different users, in view of the fact that the number of tests of the default setting may not meet the requirements of the user. Meanwhile, since the test script in the first embodiment of the present application records the operation behavior of the user application, the setting of some parameter values may not be very accurate when the user manually operates, such as in a video playback application. The method of sliding to the right sets the fast forward magnification. At this time, the user's setting of the fast forward magnification is difficult to accurately quantify. The actual set parameter value and the ideal value often have a certain difference. Therefore, in order to achieve accurate setting of these parameter values, In the application embodiment, the user is provided with a modification function of the test instruction to achieve precise control of the test.
作为本申请的进行脚本录制的一种具体实现方法,包括:As a specific implementation method of the script recording of the present application, the following includes:
若移动终端的操作系统为安卓系统,利用AccessibilityService对用户操作指令的输入进行事件监听。If the operating system of the mobile terminal is an Android system, the AccessibilityService is used to perform event monitoring on the input of the user operation instruction.
基于AccessibilityEvent的getSource()方法,获取界面控件对操作指令的响应数据。Based on the getSource() method of AccessibilityEvent, the response data of the interface control to the operation instruction is obtained.
作为本申请实施例三,如图3所示,在移动终端根据接收到的录制回放指令,对其录制的用户的应用程序操作行为的第一测试脚本进行提取之前,还包括:As the third embodiment of the present application, as shown in FIG. 3, before the mobile terminal extracts the first test script of the user's application operation behavior recorded by the mobile terminal according to the received recording playback instruction, the method further includes:
S100,判断接收到的脚本选取指令是否为录制回放指令。S100: Determine whether the received script selection instruction is a recording playback instruction.
在判断接收到的脚本选取指令是否为录制回放指令之后,还包括:After determining whether the received script selection instruction is a recording playback instruction, the method further includes:
S104,若脚本选取指令不为录制回放指令,从预设的测试脚本集中选取出脚本选取指令指向的第二测试脚本。S104. If the script selection instruction is not a recording playback instruction, select a second test script pointed to by the script selection instruction from the preset test script set.
S105,获取第二测试脚本对应的第二测试次数,并对第二测试脚本进行解析,确定出第二测试脚本中包含的第二测试指令。S105. Acquire a second test number corresponding to the second test script, and parse the second test script to determine a second test instruction included in the second test script.
S106,查找出应用程序所包含的界面控件,并基于第二测试次数,控制界面控件执行第二测试指令对应的任务,以对应用程序进行测试。S106: Find an interface control included in the application, and based on the second test number, control the interface control to execute a task corresponding to the second test instruction to test the application.
在本申请实施例一中,都是直接读取对用户应用程序操作录制得到的测试脚本进行测试,但实际情况中有时用户可能需要移动终端直接运行非移动终端录制的预设测试脚本以进行测试。因此,本申请实施例中提供了运行非录制的测试脚本的进行应用程序测试的功能,以满足用户的实际需求,在本申请实施例中,用户只需要预先将非移动终端录制的测试脚本存入移动终端,移动终端会将所有存入的非录制的测试脚本存储为一个测试脚本集,此时用户只需要在输入录制回放指令时,输入相应的脚步选取指令,即可实现从测试脚本集中选取出所需测试脚本进行回访测试。In the first embodiment of the present application, the test script obtained by recording the operation of the user application is directly read, but in actual cases, the user may need the mobile terminal to directly run the preset test script recorded by the non-mobile terminal for testing. . Therefore, in the embodiment of the present application, the function of performing the application test for running the non-recorded test script is provided to meet the actual needs of the user. In the embodiment of the present application, the user only needs to save the test script recorded by the non-mobile terminal in advance. Into the mobile terminal, the mobile terminal stores all the stored non-recorded test scripts as a test script set. At this time, the user only needs to input the corresponding step selection instruction when inputting the recording playback instruction, thereby realizing the test script set. Select the required test script to conduct a return visit test.
作为本申请的一个实施例,用户可以在电脑端利用Uiautomator测试工具预先编写好测试脚本,如在确定好测试任务之后,针对每个界面控件编写好对应的测试指令,设置好相应的执行顺序以得到所需的测试脚本,再设置好测试脚本对应的测试次数,从而完成了对测试脚本的编写。在得到测试脚本之后,在将其存储至移动终端,以使得移动终端可以根据存储好的测试脚本,直接独立完成对应用程序的测试。As an embodiment of the present application, the user can pre-write the test script on the computer side by using the Uiautomator test tool. After determining the test task, the corresponding test instruction is written for each interface control, and the corresponding execution order is set. Get the required test script, and then set the number of tests corresponding to the test script, thus completing the preparation of the test script. After the test script is obtained, it is stored to the mobile terminal, so that the mobile terminal can directly test the application independently according to the stored test script.
作为本申请的一个实施例,在对应用程序进行测试之后,还包括:As an embodiment of the present application, after testing the application, the method further includes:
对应用程序在测试中的响应数据进行分析,得到应用程序的性能指标数据。Analyze the response data of the application in the test to obtain the performance indicator data of the application.
其中,应用程序在测试中的响应数据包括测试中应用程序对每个测试指令的响应时间以及响应结果,如视频播放应用程序中,应用程序对快进指令的响应时间是多少秒,响应结果是成功还是失败,响应过程中应用程序是否崩溃等。由于本申请实施例一中仅能对用户在录制过程中对应用程序的操作行为进行录制,因此也仅能得到这些操作行为对应的测试指令的响应数据进行分析,得到一些与操作行为相关的应用程序的性能指标,以及一些常见的与操作行为直接关联度较小的性能指标,如对于视频播放应用程序,用户在录制时仅进行了播放、暂停、快进以及快退操作,此时本申请实施例仅会对于这些操作相关的性能指标,如播放、暂停、快进以及快退的响应时间是否正常,对应功能是否正常响应等,以及与操作行为直接关联度较小的性能指标,如多次测试中应用程序是否出现崩溃,处理器资源占用是否出现过高等进行分析,得到对应的性能指标数据。本申请实施例在进行响应数据分析时,会首先确定出每个测试指令对应的响应数据,并读取出预先设置的对应的测试结果标准值进行比较,再得到最终的性能指标数据。The response data of the application in the test includes the response time of the application to each test instruction in the test and the response result, such as the response time of the application to the fast forward instruction in the video playing application, and the response result is Success or failure, whether the application crashes during the response, etc. In the first embodiment of the present application, only the user can record the operation behavior of the application during the recording process, and therefore only the response data of the test instructions corresponding to the operation behaviors can be analyzed, and some applications related to the operation behavior are obtained. The performance indicators of the program, as well as some common performance indicators that are directly related to the operating behavior. For example, for the video playback application, the user only plays, pauses, fast forwards, and rewinds while recording. The embodiment only has performance indicators related to these operations, such as whether the response time of play, pause, fast forward, and fast reverse is normal, whether the corresponding function is normally responded, and the performance indicators that are directly related to the operation behavior, such as multiple In the subtest, whether the application crashes, whether the processor resource occupancy is too high, etc., analyzes and obtains the corresponding performance indicator data. In the response data analysis, the embodiment of the present application first determines the response data corresponding to each test instruction, and reads the corresponding standard value of the test result set in advance for comparison, and then obtains the final performance indicator data.
在本申请实施例中,通过预先录制用户对应用程序的操作行为并生成对应的测试脚本,再基于录制的测试脚本直接对应用程序进行测试,从而使得本申请实施例无需依赖任何其他设备,而是直接使用移动终端本身就可以完成对应用程序的测试,摆脱了测试场地和设备等因素的限制,且可以仅针对用户的需求来进行针对性测试脚本生成与测试,从而极大地提升了对应用程序的测试效率,使得应用程序的测试变得简单高效。同时为用户提供参数修改、预设测试脚本运行以及性能指标分析等功能,使得用户对应用程序的测试更加智能便捷,进一步提升了对应用程序的测试效率。In the embodiment of the present application, the application is tested by pre-recording the user's operation behavior on the application and generating a corresponding test script, and then the application is directly tested based on the recorded test script, so that the embodiment of the present application does not need to rely on any other device. It is possible to directly test the application using the mobile terminal itself, get rid of the limitations of the test site and the device, and can only generate and test the targeted test script for the user's needs, thereby greatly improving the application. The testing efficiency of the program makes the testing of the application simple and efficient. At the same time, the user provides functions such as parameter modification, preset test script running and performance index analysis, which makes the user's testing of the application more intelligent and convenient, and further improves the testing efficiency of the application.
对应于上文实施例的方法,图4示出了本申请实施例提供的应用程序测试装置的结构框图,为了便于说明,仅示出了与本申请实施例相关的部分。图4示例的应用程序测试装置可以是前述实施例一提供的应用程序测试方法的执行主体。Corresponding to the method of the above embodiment, FIG. 4 is a structural block diagram of an application testing device provided by an embodiment of the present application. For the convenience of description, only parts related to the embodiment of the present application are shown. The application testing device illustrated in FIG. 4 may be the execution body of the application testing method provided in the foregoing first embodiment.
参照图4,该应用程序测试装置包括:Referring to FIG. 4, the application testing device includes:
录制回放模块41,用于根据接收到的录制回放指令,对应用程序测试装置录制的用户操作应用程序的操作行为的第一测试脚本进行提取。The recording and playback module 41 is configured to extract, according to the received recording and playback instruction, the first test script of the operation behavior of the user operation application recorded by the application testing device.
第一脚本解析模块41,用于获取所述第一测试脚本对应的第一测试次数,并对所述第一测试脚本进行解析,确定出所述第一测试脚本中包含的第一测试指令。The first script parsing module 41 is configured to obtain a first test number corresponding to the first test script, and parse the first test script to determine a first test instruction included in the first test script.
第一测试模块42,用于查找出所述应用程序所包含的界面控件,并基于所述第一测试次数,控制所述界面控件执行所述第一测试指令对应的任务,以对所述应用程序进行测试。The first test module 42 is configured to find an interface control included in the application, and control, according to the first number of tests, the interface control to perform a task corresponding to the first test instruction, to the application The program is tested.
进一步地,该应用程序测试装置,还包括:Further, the application testing device further includes:
脚本录制模块,用于对所述用户的应用程序操作行为进行所述第一测试脚本的录制。a script recording module, configured to perform recording of the first test script on an application operation behavior of the user.
脚本录制模块,包括:Script recording module, including:
控件确定模块,用于接收所述用户输入的脚本录制指令,并确定出所述应用程序包含的所述界面控件。And a control determining module, configured to receive a script recording instruction input by the user, and determine the interface control included in the application.
响应记录模块,用于记录所述应用程序在对所述用户输入的操作指令响应过程中,所述界面控件对应的响应数据。The response recording module is configured to record response data corresponding to the interface control during the response of the application to the operation instruction input by the user.
脚本生成模块,用于接收所述用户输入的录制停止指令,并基于记录的所述界面控件对应的响应数据生成所述第一测试脚本。a script generating module, configured to receive a recording stop instruction input by the user, and generate the first test script based on the response data corresponding to the recorded interface control.
进一步地,所述响应记录模块,包括:Further, the response recording module includes:
监听模块,用于若所述移动终端的操作系统为安卓系统,利用AccessibilityService对用户所述操作指令的输入进行事件监听。The monitoring module is configured to perform event monitoring on the input of the operation instruction of the user by using the AccessibilityService if the operating system of the mobile terminal is an Android system.
数据获取模块,用于基于AccessibilityEvent的getSource()方法,获取界面控件对所述操作指令的所述响应数据。The data obtaining module is configured to obtain the response data of the interface control by the interface control based on the getSource() method of the AccessibilityEvent.
进一步地,该应用程序测试装置,还包括:Further, the application testing device further includes:
判断接收到的脚本选取指令是否为所述录制回放指令Determining whether the received script selection instruction is the recording playback instruction
脚本选取模块,用于若所述脚本选取指令不为所述录制回放指令,从预设的测试脚本集中选取出所述脚本选取指令指向的第二测试脚本。The script selection module is configured to: if the script selection instruction is not the recording playback instruction, select a second test script pointed to by the script selection instruction from a preset test script set.
第二脚本解析模块,用于获取所述第二测试脚本对应的第二测试次数,并对所述第二测试脚本进行解析,确定出所述第二测试脚本中包含的第二测试指令。The second script parsing module is configured to obtain a second test number corresponding to the second test script, and parse the second test script to determine a second test instruction included in the second test script.
第二测试模块,用于查找出所述应用程序所包含的所述界面控件,并基于所述第二测试次数,控制所述界面控件执行所述第二测试指令对应的任务,以对所述应用程序进行测试。a second test module, configured to: find the interface control included in the application, and control, according to the second number of tests, the interface control to perform a task corresponding to the second test instruction, to The application is tested.
进一步地,该应用程序测试装置,还包括:Further, the application testing device further includes:
性能分析模块,用于对所述应用程序在所述测试中的响应数据进行分析,得到所述应用程序的性能指标数据。The performance analysis module is configured to analyze the response data of the application in the test to obtain performance indicator data of the application.
本申请实施例提供的应用程序测试装置中各模块实现各自功能的过程,具体可参考前述图1所示实施例一的描述,此处不再赘述。For the process of implementing the respective functions in the application testing device provided by the embodiment of the present application, refer to the description of the first embodiment shown in FIG. 1 , and details are not described herein again.
应理解,上述实施例中各步骤的序号的大小并不意味着执行顺序的先后,各过程的执行顺序应以其功能和内在逻辑确定,而不应对本申请实施例的实施过程构成任何限定。It should be understood that the size of the sequence of the steps in the above embodiments does not mean that the order of execution is performed. The order of execution of each process should be determined by its function and internal logic, and should not be construed as limiting the implementation process of the embodiments of the present application.
还应理解的是,虽然术语“第一”、“第二”等在文本中在一些本申请实施例中用来描述各种元素,但是这些元素不应该受到这些术语的限制。这些术语只是用来将一个元素与另一元素区分开。例如,第一接触可以被命名为第二接触,并且类似地,第二接触可以被命名为第一接触,而不背离各种所描述的实施例的范围。第一接触和第二接触都是接触,但是它们不是同一接触。It should also be understood that although the terms "first", "second", and the like are used in the text to describe various elements in the embodiments of the present application, these elements should not be limited by these terms. These terms are only used to distinguish one element from another. For example, the first contact can be named a second contact, and similarly, the second contact can be named the first contact without departing from the scope of the various described embodiments. Both the first contact and the second contact are contacts, but they are not the same contact.
图5是本申请一实施例提供的移动终端的示意图。如图5所示,该实施例的移动终端5包括:处理器50、存储器51,所述存储器51中存储有可在所述处理器50上运行的计算机可读指令52。所述处理器50执行所述计算机可读指令52时实现上述各个应用程序测试方法实施例中的步骤,例如图1所示的步骤101至103。或者,所述处理器50执行所述计算机可读指令52时实现上述各装置实施例中各模块/单元的功能,例如图4所示模块41至43的功能。FIG. 5 is a schematic diagram of a mobile terminal according to an embodiment of the present application. As shown in FIG. 5, the mobile terminal 5 of this embodiment includes a processor 50, a memory 51 in which computer readable instructions 52 executable on the processor 50 are stored. The processor 50, when executing the computer readable instructions 52, implements the steps in the various application test method embodiments described above, such as steps 101 through 103 shown in FIG. Alternatively, when the processor 50 executes the computer readable instructions 52, the functions of the modules/units in the various apparatus embodiments described above are implemented, such as the functions of the modules 41 to 43 shown in FIG.
所述移动终端5可以是桌上型计算机、笔记本、掌上电脑及云端服务器等计算设备。所述移动终端可包括,但不仅限于,处理器50、存储器51。本领域技术人员可以理解,图5仅仅是移动终端5的示例,并不构成对移动终端5的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件,例如所述移动终端还可以包括输入发送设备、网络接入设备、总线等。The mobile terminal 5 can be a computing device such as a desktop computer, a notebook, a palmtop computer, and a cloud server. The mobile terminal may include, but is not limited to, a processor 50, a memory 51. It will be understood by those skilled in the art that FIG. 5 is merely an example of the mobile terminal 5, does not constitute a limitation of the mobile terminal 5, may include more or less components than the illustration, or combine some components, or different components. For example, the mobile terminal may further include an input sending device, a network access device, a bus, and the like.
所称处理器50可以是中央处理单元(Central Processing Unit,CPU),还可以是其他通用处理器、数字信号处理器(Digital Signal Processor,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、现成可编程门阵列(Field-Programmable Gate Array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。The so-called processor 50 can be a central processing unit (Central Processing Unit, CPU), can also be other general purpose processors, digital signal processors (DSP), application specific integrated circuits (Application Specific Integrated Circuit (ASIC), Field-Programmable Gate Array (FPGA) or other programmable logic device, discrete gate or transistor logic device, discrete hardware components, etc. The general purpose processor may be a microprocessor or the processor or any conventional processor or the like.
所述存储器51可以是所述移动终端5的内部存储单元,例如移动终端5的硬盘或内存。所述存储器51也可以是所述移动终端5的外部存储设备,例如所述移动终端5上配备的插接式硬盘,智能存储卡(Smart Media Card,SMC),安全数字(Secure Digital,SD)卡,闪存卡(Flash Card)等。进一步地,所述存储器51还可以既包括所述移动终端5的内部存储单元也包括外部存储设备。所述存储器51用于存储所述计算机可读指令以及所述移动终端所需的其他程序和数据。所述存储器51还可以用于暂时地存储已经发送或者将要发送的数据。The memory 51 may be an internal storage unit of the mobile terminal 5, such as a hard disk or a memory of the mobile terminal 5. The memory 51 may also be an external storage device of the mobile terminal 5, such as a plug-in hard disk equipped on the mobile terminal 5, a smart memory card (SMC), and a secure digital (SD). Card, flash card, etc. Further, the memory 51 may also include both an internal storage unit of the mobile terminal 5 and an external storage device. The memory 51 is configured to store the computer readable instructions and other programs and data required by the mobile terminal. The memory 51 can also be used to temporarily store data that has been sent or is about to be transmitted.
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above integrated unit can be implemented in the form of hardware or in the form of a software functional unit.
所述集成的模块/单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请实现上述实施例方法中的全部或部分流程,也可以通过计算机可读指令来指令相关的硬件来完成,所述的计算机可读指令可存储于一计算机可读存储介质中,该计算机可读指令在被处理器执行时,可实现上述各个方法实施例的步骤。其中,所述计算机可读指令包括计算机可读指令代码,所述计算机可读指令代码可以为源代码形式、对象代码形式、可执行文件或某些中间形式等。所述计算机可读介质可以包括:能够携带所述计算机可读指令代码的任何实体或装置、记录介质、U盘、移动硬盘、磁碟、光盘、计算机存储器、只读存储器(Read-Only Memory,ROM)、随机存取存储器(Random Access Memory,RAM)、电载波信号、电信信号以及软件分发介质等。需要说明的是,所述计算机可读介质包含的内容可以根据司法管辖区内立法和专利实践的要求进行适当的增减,例如在某些司法管辖区,根据立法和专利实践,计算机可读介质不包括电载波信号和电信信号。The integrated modules/units, if implemented in the form of software functional units and sold or used as separate products, may be stored in a computer readable storage medium. Based on such understanding, the present application implements all or part of the processes in the foregoing embodiments, and may also be implemented by computer readable instructions, which may be stored in a computer readable storage medium. The computer readable instructions, when executed by a processor, may implement the steps of the various method embodiments described above. Wherein, the computer readable instructions comprise computer readable instruction code, which may be in the form of source code, an object code form, an executable file or some intermediate form or the like. The computer readable medium may include any entity or device capable of carrying the computer readable instruction code, a recording medium, a USB flash drive, a removable hard disk, a magnetic disk, an optical disk, a computer memory, a read only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), electrical carrier signals, telecommunications signals, and software distribution media. It should be noted that the content contained in the computer readable medium may be appropriately increased or decreased according to the requirements of legislation and patent practice in a jurisdiction, for example, in some jurisdictions, according to legislation and patent practice, computer readable media Does not include electrical carrier signals and telecommunication signals.
以上所述实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述实施例对本申请进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使对应技术方案的本质脱离本申请各实施例技术方案的精神和范围,均应包含在本申请的保护范围之内。The above-mentioned embodiments are only used to explain the technical solutions of the present application, and are not limited thereto; although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that they can still implement the foregoing embodiments. The technical solutions described in the examples are modified or equivalently replaced with some of the technical features; and the modifications or substitutions do not deviate from the spirit and scope of the technical solutions of the embodiments of the present application, and should be included in Within the scope of protection of this application.

Claims (20)

  1. 一种应用程序测试方法,其特征在于,包括: An application testing method, comprising:
    移动终端根据接收到的录制回放指令,对其录制的用户操作应用程序的操作行为的第一测试脚本进行提取;The mobile terminal extracts the first test script of the recorded operation behavior of the user operation application according to the received recording playback instruction;
    获取所述第一测试脚本对应的第一测试次数,并对所述第一测试脚本进行解析,确定出所述第一测试脚本中包含的第一测试指令;Obtaining a first test number corresponding to the first test script, and parsing the first test script to determine a first test instruction included in the first test script;
    查找出所述应用程序所包含的界面控件,并基于所述第一测试次数,控制所述界面控件执行所述第一测试指令对应的任务,以对所述应用程序进行测试。Finding an interface control included in the application, and controlling, according to the first number of tests, the interface control to execute a task corresponding to the first test instruction, to test the application.
  2. 如权利要求1所述的应用程序测试方法,其特征在于,在所述移动终端根据接收到的录制回放指令,对其录制的用户的应用程序操作行为的第一测试脚本进行提取之前,还包括: The application testing method according to claim 1, wherein before the mobile terminal extracts the first test script of the user's application operation behavior recorded according to the received recording playback instruction, the method further includes: :
    接收所述用户输入的脚本录制指令,并确定出所述应用程序包含的所述界面控件;Receiving a script recording instruction input by the user, and determining the interface control included in the application;
    记录所述应用程序在对所述用户输入的操作指令响应过程中,所述界面控件对应的响应数据;Recording response data corresponding to the interface control during the response of the application to the operation command input by the user;
    接收所述用户输入的录制停止指令,并基于记录的所述界面控件对应的响应数据生成所述第一测试脚本。Receiving a recording stop instruction input by the user, and generating the first test script based on the recorded response data corresponding to the interface control.
  3. 如权利要求2所述的应用程序测试方法,其特征在于,所述记录所述应用程序在对所述用户输入的操作指令响应过程中,所述界面控件对应的响应数据,包括: The application testing method according to claim 2, wherein the recording response data of the interface control in the process of responding to the operation command input by the user includes:
    若所述移动终端的操作系统为安卓系统,利用AccessibilityService对用户所述操作指令的输入进行事件监听;If the operating system of the mobile terminal is an Android system, the AccessibilityService is used to perform event monitoring on the input of the operation instruction of the user;
    基于AccessibilityEvent的getSource()方法,获取界面控件对所述操作指令的所述响应数据。The response data of the interface control is obtained by the interface control based on the getSource() method of the AccessibilityEvent.
  4. 如权利要求1所述的应用程序测试方法,其特征在于,在所述移动终端根据接收到的录制回放指令,对其录制的用户的应用程序操作行为的第一测试脚本进行提取之前,还包括: The application testing method according to claim 1, wherein before the mobile terminal extracts the first test script of the user's application operation behavior recorded according to the received recording playback instruction, the method further includes: :
    判断接收到的脚本选取指令是否为所述录制回放指令;Determining whether the received script selection instruction is the recording playback instruction;
    在所述判断接收到的脚本选取指令是否为所述录制回放指令之后,还包括:After the determining whether the received script selection instruction is the recording playback instruction, the method further includes:
    若所述脚本选取指令不为所述录制回放指令,从预设的测试脚本集中选取出所述脚本选取指令指向的第二测试脚本;If the script selection instruction is not the recording playback instruction, the second test script pointed by the script selection instruction is selected from the preset test script set;
    获取所述第二测试脚本对应的第二测试次数,并对所述第二测试脚本进行解析,确定出所述第二测试脚本中包含的第二测试指令;Obtaining a second test number corresponding to the second test script, and parsing the second test script to determine a second test instruction included in the second test script;
    查找出所述应用程序所包含的所述界面控件,并基于所述第二测试次数,控制所述界面控件执行所述第二测试指令对应的任务,以对所述应用程序进行测试。Finding the interface control included in the application, and controlling, according to the second number of tests, the interface control to execute a task corresponding to the second test instruction, to test the application.
  5. 如权利要求1或4所述的应用程序测试方法,其特征在于,在对所述应用程序进行测试之后,还包括: The application testing method according to claim 1 or 4, further comprising: after testing the application, further comprising:
    对所述应用程序在所述测试中的响应数据进行分析,得到所述应用程序的性能指标数据。The response data of the application in the test is analyzed to obtain performance indicator data of the application.
  6. 一种应用程序测试装置,其特征在于,包括: An application testing device, comprising:
    录制回放模块,用于移动终端根据接收到的录制回放指令,对其录制的用户操作应用程序的操作行为的第一测试脚本进行提取;a recording and playback module, configured for the mobile terminal to extract, according to the received recording and playback instruction, the first test script of the recorded operation behavior of the user operation application;
    第一脚本解析模块,用于获取所述第一测试脚本对应的第一测试次数,并对所述第一测试脚本进行解析,确定出所述第一测试脚本中包含的第一测试指令;a first script parsing module, configured to acquire a first test number corresponding to the first test script, and parse the first test script to determine a first test instruction included in the first test script;
    第一测试模块,用于查找出所述应用程序所包含的界面控件,并基于所述第一测试次数,控制所述界面控件执行所述第一测试指令对应的任务,以对所述应用程序进行测试。a first test module, configured to find an interface control included in the application, and control, according to the first number of tests, the interface control to execute a task corresponding to the first test instruction, to the application carry out testing.
  7. 如权利要求6所述的应用程序测试装置,其特征在于,还包括: The application testing device of claim 6, further comprising:
    控件确定模块,用于接收所述用户输入的脚本录制指令,并确定出所述应用程序包含的所述界面控件;a control determining module, configured to receive a script recording instruction input by the user, and determine the interface control included in the application;
    响应记录模块,用于记录所述应用程序在对所述用户输入的操作指令响应过程中,所述界面控件对应的响应数据;a response recording module, configured to record response data corresponding to the interface control during response of the application to the operation command input by the user;
    脚本生成模块,用于接收所述用户输入的录制停止指令,并基于记录的所述界面控件对应的响应数据生成所述第一测试脚本。a script generating module, configured to receive a recording stop instruction input by the user, and generate the first test script based on the response data corresponding to the recorded interface control.
  8. 如权利要求7所述的应用程序测试装置,其特征在于,所述响应记录模块,还包括: The application testing device according to claim 7, wherein the response recording module further comprises:
    监听模块,用于若所述移动终端的操作系统为安卓系统,利用AccessibilityService对用户所述操作指令的输入进行事件监听;a monitoring module, configured to: if the operating system of the mobile terminal is an Android system, use an AccessibilityService to perform event monitoring on an input of the operation instruction of the user;
    数据获取模块,用于基于AccessibilityEvent的getSource()方法,获取界面控件对所述操作指令的所述响应数据。The data obtaining module is configured to obtain the response data of the interface control by the interface control based on the getSource() method of the AccessibilityEvent.
  9. 如权利要求6所述的应用程序测试装置,其特征在于,还包括: The application testing device of claim 6, further comprising:
    指令判断模块,用于判断接收到的脚本选取指令是否为所述录制回放指令;An instruction determining module, configured to determine whether the received script selection instruction is the recording playback instruction;
    脚本选取模块,用于若所述脚本选取指令不为所述录制回放指令,从预设的测试脚本集中选取出所述脚本选取指令指向的第二测试脚本;a script selection module, configured to: if the script selection instruction is not the recording playback instruction, select a second test script pointed to by the script selection instruction from a preset test script set;
    第二脚本解析模块,用于获取所述第二测试脚本对应的第二测试次数,并对所述第二测试脚本进行解析,确定出所述第二测试脚本中包含的第二测试指令;a second script parsing module, configured to acquire a second test number corresponding to the second test script, and parse the second test script to determine a second test instruction included in the second test script;
    第二测试模块,用于查找出所述应用程序所包含的所述界面控件,并基于所述第二测试次数,控制所述界面控件执行所述第二测试指令对应的任务,以对所述应用程序进行测试。a second test module, configured to: find the interface control included in the application, and control, according to the second number of tests, the interface control to perform a task corresponding to the second test instruction, to The application is tested.
  10. 如权利要求6或9所述的应用程序测试装置,其特征在于,还包括: The application testing device according to claim 6 or 9, further comprising:
    性能分析模块,用于对所述应用程序在所述测试中的响应数据进行分析,得到所述应用程序的性能指标数据。The performance analysis module is configured to analyze the response data of the application in the test to obtain performance indicator data of the application.
  11. 一种移动终端,其特征在于,所述移动终端包括存储器、处理器,所述存储器上存储有可在所述处理器上运行的计算机可读指令,所述处理器执行所述计算机可读指令时实现如下步骤: A mobile terminal, comprising: a memory, a processor, on the memory, computer readable instructions executable on the processor, the processor executing the computer readable instructions The following steps are implemented:
    移动终端根据接收到的录制回放指令,对其录制的用户操作应用程序的操作行为的第一测试脚本进行提取;The mobile terminal extracts the first test script of the recorded operation behavior of the user operation application according to the received recording playback instruction;
    获取所述第一测试脚本对应的第一测试次数,并对所述第一测试脚本进行解析,确定出所述第一测试脚本中包含的第一测试指令;Obtaining a first test number corresponding to the first test script, and parsing the first test script to determine a first test instruction included in the first test script;
    查找出所述应用程序所包含的界面控件,并基于所述第一测试次数,控制所述界面控件执行所述第一测试指令对应的任务,以对所述应用程序进行测试。Finding an interface control included in the application, and controlling, according to the first number of tests, the interface control to execute a task corresponding to the first test instruction, to test the application.
  12. 如权利要求11所述的移动终端,其特征在于,在所述移动终端根据接收到的录制回放指令,对其录制的用户的应用程序操作行为的第一测试脚本进行提取之前,还包括: The mobile terminal according to claim 11, wherein before the extracting, by the mobile terminal, the first test script of the user's application operation behavior recorded by the mobile terminal according to the received recording playback instruction, the method further includes:
    接收所述用户输入的脚本录制指令,并确定出所述应用程序包含的所述界面控件;Receiving a script recording instruction input by the user, and determining the interface control included in the application;
    记录所述应用程序在对所述用户输入的操作指令响应过程中,所述界面控件对应的响应数据;Recording response data corresponding to the interface control during the response of the application to the operation command input by the user;
    接收所述用户输入的录制停止指令,并基于记录的所述界面控件对应的响应数据生成所述第一测试脚本。Receiving a recording stop instruction input by the user, and generating the first test script based on the recorded response data corresponding to the interface control.
  13. 如权利要求12所述的移动终端,其特征在于,所述记录所述应用程序在对所述用户输入的操作指令响应过程中,所述界面控件对应的响应数据,包括: The mobile terminal according to claim 12, wherein the recording of the response data corresponding to the interface control by the application in response to the operation command input by the user comprises:
    若所述移动终端的操作系统为安卓系统,利用AccessibilityService对用户所述操作指令的输入进行事件监听;If the operating system of the mobile terminal is an Android system, the AccessibilityService is used to perform event monitoring on the input of the operation instruction of the user;
    基于AccessibilityEvent的getSource()方法,获取界面控件对所述操作指令的所述响应数据。The response data of the interface control is obtained by the interface control based on the getSource() method of the AccessibilityEvent.
  14. 如权利要求11所述的移动终端,其特征在于,在所述移动终端根据接收到的录制回放指令,对其录制的用户的应用程序操作行为的第一测试脚本进行提取之前,还包括: The mobile terminal according to claim 11, wherein before the extracting, by the mobile terminal, the first test script of the user's application operation behavior recorded by the mobile terminal according to the received recording playback instruction, the method further includes:
    判断接收到的脚本选取指令是否为所述录制回放指令;Determining whether the received script selection instruction is the recording playback instruction;
    在所述判断接收到的脚本选取指令是否为所述录制回放指令之后,还包括:After the determining whether the received script selection instruction is the recording playback instruction, the method further includes:
    若所述脚本选取指令不为所述录制回放指令,从预设的测试脚本集中选取出所述脚本选取指令指向的第二测试脚本;If the script selection instruction is not the recording playback instruction, the second test script pointed by the script selection instruction is selected from the preset test script set;
    获取所述第二测试脚本对应的第二测试次数,并对所述第二测试脚本进行解析,确定出所述第二测试脚本中包含的第二测试指令;Obtaining a second test number corresponding to the second test script, and parsing the second test script to determine a second test instruction included in the second test script;
    查找出所述应用程序所包含的所述界面控件,并基于所述第二测试次数,控制所述界面控件执行所述第二测试指令对应的任务,以对所述应用程序进行测试。Finding the interface control included in the application, and controlling, according to the second number of tests, the interface control to execute a task corresponding to the second test instruction, to test the application.
  15. 如权利要求11或14所述的移动终端,其特征在于,在对所述应用程序进行测试之后,还包括: The mobile terminal according to claim 11 or 14, wherein after testing the application, the method further comprises:
    对所述应用程序在所述测试中的响应数据进行分析,得到所述应用程序的性能指标数据。The response data of the application in the test is analyzed to obtain performance indicator data of the application.
  16. 一种计算机可读存储介质,所述计算机可读存储介质存储有计算机可读指令,其特征在于,所述计算机可读指令被至少一个处理器执行时实现如下步骤: A computer readable storage medium storing computer readable instructions, wherein the computer readable instructions, when executed by at least one processor, implement the following steps:
    移动终端根据接收到的录制回放指令,对其录制的用户操作应用程序的操作行为的第一测试脚本进行提取;The mobile terminal extracts the first test script of the recorded operation behavior of the user operation application according to the received recording playback instruction;
    获取所述第一测试脚本对应的第一测试次数,并对所述第一测试脚本进行解析,确定出所述第一测试脚本中包含的第一测试指令;Obtaining a first test number corresponding to the first test script, and parsing the first test script to determine a first test instruction included in the first test script;
    查找出所述应用程序所包含的界面控件,并基于所述第一测试次数,控制所述界面控件执行所述第一测试指令对应的任务,以对所述应用程序进行测试。Finding an interface control included in the application, and controlling, according to the first number of tests, the interface control to execute a task corresponding to the first test instruction, to test the application.
  17. 根据权利要求16所述的计算机可读存储介质,其特征在于,在所述移动终端根据接收到的录制回放指令,对其录制的用户的应用程序操作行为的第一测试脚本进行提取之前,还包括: The computer readable storage medium according to claim 16, wherein before the mobile terminal extracts the first test script of the user's application operation behavior recorded according to the received recording playback instruction, include:
    接收所述用户输入的脚本录制指令,并确定出所述应用程序包含的所述界面控件;Receiving a script recording instruction input by the user, and determining the interface control included in the application;
    记录所述应用程序在对所述用户输入的操作指令响应过程中,所述界面控件对应的响应数据;Recording response data corresponding to the interface control during the response of the application to the operation command input by the user;
    接收所述用户输入的录制停止指令,并基于记录的所述界面控件对应的响应数据生成所述第一测试脚本。Receiving a recording stop instruction input by the user, and generating the first test script based on the recorded response data corresponding to the interface control.
  18. 根据权利要求17所述的计算机可读存储介质,其特征在于,所述记录所述应用程序在对所述用户输入的操作指令响应过程中,所述界面控件对应的响应数据,包括: The computer readable storage medium according to claim 17, wherein the recording of the response data corresponding to the interface control in the process of responding to the operation command input by the user comprises:
    若所述移动终端的操作系统为安卓系统,利用AccessibilityService对用户所述操作指令的输入进行事件监听;If the operating system of the mobile terminal is an Android system, the AccessibilityService is used to perform event monitoring on the input of the operation instruction of the user;
    基于AccessibilityEvent的getSource()方法,获取界面控件对所述操作指令的所述响应数据。The response data of the interface control is obtained by the interface control based on the getSource() method of the AccessibilityEvent.
  19. 根据权利要求16所述的计算机可读存储介质,其特征在于,在所述移动终端根据接收到的录制回放指令,对其录制的用户的应用程序操作行为的第一测试脚本进行提取之前,还包括: The computer readable storage medium according to claim 16, wherein before the mobile terminal extracts the first test script of the user's application operation behavior recorded according to the received recording playback instruction, include:
    判断接收到的脚本选取指令是否为所述录制回放指令;Determining whether the received script selection instruction is the recording playback instruction;
    在所述判断接收到的脚本选取指令是否为所述录制回放指令之后,还包括:After the determining whether the received script selection instruction is the recording playback instruction, the method further includes:
    若所述脚本选取指令不为所述录制回放指令,从预设的测试脚本集中选取出所述脚本选取指令指向的第二测试脚本;If the script selection instruction is not the recording playback instruction, the second test script pointed by the script selection instruction is selected from the preset test script set;
    获取所述第二测试脚本对应的第二测试次数,并对所述第二测试脚本进行解析,确定出所述第二测试脚本中包含的第二测试指令;Obtaining a second test number corresponding to the second test script, and parsing the second test script to determine a second test instruction included in the second test script;
    查找出所述应用程序所包含的所述界面控件,并基于所述第二测试次数,控制所述界面控件执行所述第二测试指令对应的任务,以对所述应用程序进行测试。Finding the interface control included in the application, and controlling, according to the second number of tests, the interface control to execute a task corresponding to the second test instruction, to test the application.
  20. 根据权利要求16或19所述的计算机可读存储介质,其特征在于,在对所述应用程序进行测试之后,还包括: The computer readable storage medium according to claim 16 or 19, further comprising: after testing the application,
    对所述应用程序在所述测试中的响应数据进行分析,得到所述应用程序的性能指标数据。The response data of the application in the test is analyzed to obtain performance indicator data of the application.
PCT/CN2018/097116 2018-05-17 2018-07-25 Application program testing method and apparatus, and mobile terminal and medium WO2019218464A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201810475104.6 2018-05-17
CN201810475104.6A CN108763071A (en) 2018-05-17 2018-05-17 A kind of webpage test method and terminal device

Publications (1)

Publication Number Publication Date
WO2019218464A1 true WO2019218464A1 (en) 2019-11-21

Family

ID=64007041

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/097116 WO2019218464A1 (en) 2018-05-17 2018-07-25 Application program testing method and apparatus, and mobile terminal and medium

Country Status (2)

Country Link
CN (1) CN108763071A (en)
WO (1) WO2019218464A1 (en)

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111382058B (en) * 2018-12-29 2024-02-02 北京字节跳动网络技术有限公司 Service testing method and device, server and storage medium
CN109933524A (en) * 2019-01-31 2019-06-25 平安科技(深圳)有限公司 Interface test method, device, computer equipment and storage medium
CN109992509A (en) * 2019-03-22 2019-07-09 恒生电子股份有限公司 The automated execution method, apparatus of test case, electronic equipment
CN110245072A (en) * 2019-05-20 2019-09-17 深圳壹账通智能科技有限公司 A kind of test method and device
CN111949537A (en) * 2020-08-14 2020-11-17 北京锐安科技有限公司 Interface test method, device, equipment and medium
CN111966600B (en) * 2020-08-31 2023-08-04 平安健康保险股份有限公司 Webpage testing method, webpage testing device, computer equipment and computer readable storage medium
CN115102879B (en) * 2022-07-21 2023-11-21 身边云(北京)信息服务有限公司 Test method of shared service platform, electronic equipment and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104008047A (en) * 2013-02-27 2014-08-27 腾讯科技(深圳)有限公司 Intelligent terminal program testing method and system
CN105786705A (en) * 2016-02-26 2016-07-20 上海斐讯数据通信技术有限公司 Execution method and device of nested loop test scripts
CN107748718A (en) * 2017-10-11 2018-03-02 百富计算机技术(深圳)有限公司 Applied program testing method, device and server
CN108717393A (en) * 2018-05-16 2018-10-30 平安科技(深圳)有限公司 A kind of applied program testing method and mobile terminal

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101377759B (en) * 2008-08-26 2010-06-09 中国工商银行股份有限公司 Automatic interface test system
US9715483B2 (en) * 2010-09-16 2017-07-25 International Business Machines Corporation User interface for testing and asserting UI elements with natural language instructions
CN104820640B (en) * 2015-05-19 2018-07-24 广州华多网络科技有限公司 A kind of webpage test method and device
CN106528418B (en) * 2016-10-28 2019-01-22 广东浪潮大数据研究有限公司 A kind of test method and device

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104008047A (en) * 2013-02-27 2014-08-27 腾讯科技(深圳)有限公司 Intelligent terminal program testing method and system
CN105786705A (en) * 2016-02-26 2016-07-20 上海斐讯数据通信技术有限公司 Execution method and device of nested loop test scripts
CN107748718A (en) * 2017-10-11 2018-03-02 百富计算机技术(深圳)有限公司 Applied program testing method, device and server
CN108717393A (en) * 2018-05-16 2018-10-30 平安科技(深圳)有限公司 A kind of applied program testing method and mobile terminal

Also Published As

Publication number Publication date
CN108763071A (en) 2018-11-06

Similar Documents

Publication Publication Date Title
WO2019218458A1 (en) Application program test method and device, mobile terminal and medium
WO2019218464A1 (en) Application program testing method and apparatus, and mobile terminal and medium
CN107516510B (en) Automatic voice testing method and device for intelligent equipment
CN109189682B (en) Script recording method and device
CN108900776B (en) Method and apparatus for determining response time
CN109871326B (en) Script recording method and device
TWI510913B (en) Testing device and testing method thereof
CN107506300B (en) User interface testing method, device, server and storage medium
WO2019227641A1 (en) Application testing method, apparatus, terminal device and medium
US9819758B2 (en) Remote debugging into mobile web applications across devices
CN104063305A (en) Pressure testing method, device and system for intelligent terminal software
US20230214243A1 (en) One-machine multi-control method, apparatus, system and electronic device
CN110895503B (en) Application performance monitoring method and client
CN110597704B (en) Pressure test method, device, server and medium for application program
CN110837467A (en) Software testing method, device and system
CN110543416A (en) Method, device, equipment and storage medium for automatically testing terminal program
CN111382017A (en) Fault query method, device, server and storage medium
US10922249B2 (en) Input/output control code filter
CN113590092A (en) Script generation method and device and computer readable storage medium
CN113127001B (en) Method, device, equipment and medium for monitoring code compiling process
CN111522737B (en) Automatic test verification method and device for front-end interface and storage medium
CN117076336B (en) Testing method and device of cloud edge cooperative system, storage medium and equipment
CN116795727B (en) Reproduction method and device of test process, electronic equipment and storage medium
CN112468679B (en) Method and device for synchronously playing audio and video courseware and electronic equipment
JP6907624B2 (en) Reproduction device, reproduction method and reproduction program

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: 18919193

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: 18919193

Country of ref document: EP

Kind code of ref document: A1