CN104423822B - Record the method and device of automatic test script - Google Patents

Record the method and device of automatic test script Download PDF

Info

Publication number
CN104423822B
CN104423822B CN201310388968.1A CN201310388968A CN104423822B CN 104423822 B CN104423822 B CN 104423822B CN 201310388968 A CN201310388968 A CN 201310388968A CN 104423822 B CN104423822 B CN 104423822B
Authority
CN
China
Prior art keywords
event
touch action
automatic test
coordinate value
test script
Prior art date
Legal status (The legal status 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 status listed.)
Active
Application number
CN201310388968.1A
Other languages
Chinese (zh)
Other versions
CN104423822A (en
Inventor
邓曦
万宇
谢少佳
蒋志毅
沈杨
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tencent Technology Shenzhen Co Ltd
Tencent Cloud Computing Beijing Co Ltd
Original Assignee
Tencent Technology Shenzhen Co Ltd
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 Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN201310388968.1A priority Critical patent/CN104423822B/en
Publication of CN104423822A publication Critical patent/CN104423822A/en
Application granted granted Critical
Publication of CN104423822B publication Critical patent/CN104423822B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/01Input arrangements or combined input and output arrangements for interaction between user and computer
    • G06F3/048Interaction techniques based on graphical user interfaces [GUI]
    • G06F3/0484Interaction techniques based on graphical user interfaces [GUI] for the control of specific functions or operations, e.g. selecting or manipulating an object, an image or a displayed text element, setting a parameter value or selecting a range
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/01Input arrangements or combined input and output arrangements for interaction between user and computer
    • G06F3/048Interaction techniques based on graphical user interfaces [GUI]
    • G06F3/0487Interaction techniques based on graphical user interfaces [GUI] using specific features provided by the input device, e.g. functions controlled by the rotation of a mouse with dual sensing arrangements, or of the nature of the input device, e.g. tap gestures based on pressure sensed by a digitiser
    • G06F3/0488Interaction techniques based on graphical user interfaces [GUI] using specific features provided by the input device, e.g. functions controlled by the rotation of a mouse with dual sensing arrangements, or of the nature of the input device, e.g. tap gestures based on pressure sensed by a digitiser using a touch-screen or digitiser, e.g. input of commands through traced gestures

Landscapes

  • Engineering & Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Human Computer Interaction (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The invention discloses a kind of method and devices for recording automatic test script, belong to software testing technology field.The described method includes: the touch action of monitoring users on a terminal screen;Record the corresponding start position of touch action listened to and final position;Corresponding event is created according to the corresponding start position of the touch action and final position;Automatic test script is recorded according to the event of creation.The present invention is after listening to the touch action of user on a terminal screen, by recording the corresponding start position of touch action listened to and final position, and corresponding event is created according to the corresponding start position of touch action and final position, and then automatic test script is recorded according to the event of creation, it can reach the purpose that automatic test script is recorded under the conditions of unrestricted, and the process for recording automatic test script is easy, record cycle is short.

Description

Record the method and device of automatic test script
Technical field
The present invention relates to software testing technology field, in particular to a kind of method and dress for recording automatic test script It sets.
Background technique
During software development, in order to find whether potential mistake or defect or confirmation software meet use in software The performance requirement that family proposes before software development, it will usually manual test be carried out to the software that developed or automation is surveyed Examination.Since manual test need to occupy plenty of time and manpower and testing efficiency is lower, based on the considerations of time and cost, The mode that automatic test is usually taken at this stage tests software.And in order to carry out automatic test, it usually needs to generate The command code of plain text need to carry out the recording of automatic test script, to be carried out according to the automatic test script Automatic test.Therefore, how automatic test script is recorded, becomes one that those skilled in the art more pay close attention to and asks Topic.
In the prior art, the recording that two ways carries out automatic test script is usually taken;First way passes through face One section of function is added before all event handling functions to section frame, using the function come capturing events, which includes: mouse Mark event, key-press event or screen sliding event etc.;Automatic test script is recorded according to the event captured;The second way, By JPDA(Java Platform Debugger Architecture, Java platform debugs architecture) and virtual machine Interaction, breakpoint is added on event handling function, later, captures thing according to the stack frame of the breakpoint of addition and current virtual machine Part, and automatic test script is recorded according to the event captured.
In the implementation of the present invention, the inventor finds that the existing technology has at least the following problems:
For first way, due to only add event handling function component can capturing events, do not add The component of event handling function just can not capturing events, and then the recording of automatic test script cannot be completed, so, this kind of side Formula limitation is too strong;For the second way, since the interaction of JPDA and virtual machine is excessively complicated, the reality of this kind of mode Existing process is complex, and need to consume the excessive time.
Summary of the invention
In order to solve problems in the prior art, the embodiment of the invention provides a kind of methods for recording automatic test script And device.The technical solution is as follows:
On the one hand, a kind of method for recording automatic test script is provided, which comprises
The touch action of monitoring users on a terminal screen;
Record the corresponding start position of touch action listened to and final position;
Corresponding event is created according to the corresponding start position of the touch action and final position;
Automatic test script is recorded according to the event of creation.
On the other hand, a kind of device for recording automatic test script is provided, described device includes:
Module is monitored, for the touch action of monitoring users on a terminal screen;
Logging modle, for recording the corresponding start position of touch action and terminal position that the monitoring module listens to It sets;
Creation module, the corresponding start position of touch action and final position wound for being recorded according to the logging modle Build corresponding event;
Module is recorded, the event for creating according to the creation module records automatic test script.
Technical solution provided in an embodiment of the present invention has the benefit that
After listening to the touch action of user on a terminal screen, by recording touch action corresponding listened to Point position and final position, and corresponding event, Jin Ergen are created according to the corresponding start position of touch action and final position Automatic test script is recorded according to the event of creation, can reach the mesh for recording automatic test script under the conditions of unrestricted , and the process for recording automatic test script is easy, record cycle is short.
Detailed description of the invention
To describe the technical solutions in the embodiments of the present invention more clearly, make required in being described below to embodiment Attached drawing is briefly described, it should be apparent that, drawings in the following description are only some embodiments of the invention, for For those of ordinary skill in the art, without creative efforts, it can also be obtained according to these attached drawings other Attached drawing.
Fig. 1 is a kind of method flow diagram for recording automatic test script that the embodiment of the present invention one provides;
Fig. 2 is a kind of method flow diagram for recording automatic test script provided by Embodiment 2 of the present invention;
Fig. 3 is a kind of schematic diagram of terminal screen provided by Embodiment 2 of the present invention;
Fig. 4 is a kind of apparatus structure schematic diagram for recording automatic test script that the embodiment of the present invention three provides;
Fig. 5 is a kind of schematic diagram of internal structure for creation module that the embodiment of the present invention three provides;
Fig. 6 is the schematic diagram of internal structure for the second creating unit of one kind that the embodiment of the present invention three provides;
Fig. 7 is a kind of schematic diagram of internal structure for recording module that the embodiment of the present invention three provides;
Fig. 8 is the schematic diagram of internal structure for the second recording elements of one kind that the embodiment of the present invention three provides;
Fig. 9 is another schematic diagram of internal structure for recording module that the embodiment of the present invention three provides;
Figure 10 is a kind of structural schematic diagram for terminal that the embodiment of the present invention four provides.
Specific embodiment
To make the object, technical solutions and advantages of the present invention clearer, below in conjunction with attached drawing to embodiment party of the present invention Formula is described in further detail.
Embodiment one
It is provided in this embodiment referring to Fig. 1 the embodiment of the invention provides a kind of method for recording automatic test script Method flow includes:
101: the touch action of monitoring users on a terminal screen;
102: recording the corresponding start position of the touch action listened to and final position;
103: corresponding event is created according to the corresponding start position of touch action and final position;
Further, corresponding event is created according to the corresponding start position of touch action and final position, including but not It is limited to:
Judge whether the corresponding start position of touch action and final position are consistent;
If the corresponding start position of touch action is inconsistent with final position, screen sliding event is created;
If the corresponding start position of touch action is consistent with final position, click event is created.
Further, if the corresponding start position of touch action is consistent with final position, click event is created, including But it is not limited to:
Obtain the duration of touch action;
Judge whether the duration of touch action is greater than preset threshold;
If the duration of touch action is greater than preset threshold, creates and repeatedly click event;
If the duration of touch action is less than preset threshold, creation single clicks on event.
104: automatic test script is recorded according to the event of creation.
Further, automatic test script is recorded according to the event of creation, comprising:
If the event of creation is screen sliding event, according to screen sliding event, the coordinate of the corresponding start position of touch action The coordinate value in value and final position records automatic test script;
If the event of creation is click event, according to the event of click, the coordinate of the corresponding start position of touch action The coordinate value in value or final position records automatic test script.
Further, according to the event of click, the coordinate value of the corresponding start position of touch action or the coordinate in final position Value records automatic test script, including but not limited to:
If the event of creation is repeatedly to click event, basis repeatedly clicks corresponding event, touch action point The coordinate value of the coordinate value or final position set records automatic test script;
If the event of creation is the event that single clicks on, basis single clicks on corresponding point of event, touch action The coordinate value of the coordinate value or final position set records automatic test script.
Further, automatic test script is recorded according to the event of creation, including but not limited to:
The coordinate value of the event of creation, the coordinate value of the corresponding start position of touch action and final position is pressed into message Queue;
Serialized message queue obtains XML(Extensible Markup Language, extensible markup language) disappear Breath;
XML message is sent to connection equipment, automatic test script is recorded according to XML message by connection equipment.
Method provided in an embodiment of the present invention passes through record after listening to the touch action of user on a terminal screen The corresponding start position of the touch action listened to and final position, and according to the corresponding start position of touch action and terminal position The corresponding event of creation is set, and then automatic test script is recorded according to the event of creation, can reach under the conditions of unrestricted The purpose of automatic test script is recorded, and the process for recording automatic test script is easy, record cycle is short.In addition, may be used also The coordinate value of the event of creation, the coordinate value of the corresponding start position of touch action and final position is sent to connection equipment, Automatic test script is recorded by connection equipment, to extend the mode for recording automatic test script.
Embodiment two
The embodiment of the invention provides a kind of methods for recording automatic test script, applied to equipped with Android system Terminal, now in conjunction with the content of above-described embodiment one, to the mode provided in an embodiment of the present invention for recording automatic test script into Explanation is explained in detail in row.Referring to fig. 2, method flow provided in this embodiment includes:
201: the touch action of monitoring users on a terminal screen;
It, specifically can be by under Android system when monitoring users touch action on a terminal screen for the step Getevent(event capturing) thread realize, i.e., execute this step provide method when, take the lead in starting getevent thread, lead to Cross the touch action of the real-time monitoring users of getevent thread on a terminal screen;Wherein, touch action includes but is not limited to a little Hit movement and screen sliding movement.
202: recording the corresponding start position of the touch action listened to and final position;
For the step, the specific implementation in the corresponding start position of record touch action and final position, including but It is not limited to: recording the coordinate value of the corresponding start position of touch action and the coordinate value in final position respectively.
By taking Fig. 3 as an example, it is curve ab, touch action that the touch action of user on a terminal screen, which is formed by sliding trace, Starting point be that a, terminal b are recorded respectively then in the corresponding start position of touch action that listens to of record and final position The coordinate value (a1, a2) of a point and the coordinate value (b1, b2) of b point, then coordinate value (a1, a2) and the corresponding position (b1, b2) are just The corresponding start position of the touch action listened to and final position.
203: corresponding event is created according to the corresponding start position of touch action and final position;
For the step, the specific reality of corresponding event is created according to the corresponding start position of touch action and final position Existing mode, including but not limited to:
Judge whether the corresponding start position of touch action and final position are consistent;
If the corresponding start position of touch action is inconsistent with final position, screen sliding event is created;
If the corresponding start position of touch action is consistent with final position, click event is created.
Wherein, it when judging whether the corresponding start position of touch action and final position are consistent, can be touched by judgement Whether the coordinate value coordinate value corresponding with final position for acting corresponding start position is unanimously realized;If touch action is corresponding Start position coordinate value coordinate value corresponding with final position it is consistent, then judge the corresponding start position of touch action and end Point position consistency;If the coordinate value of the corresponding start position of touch action coordinate value corresponding with final position is inconsistent, sentence The disconnected corresponding start position of touch action and final position are inconsistent.About judging the corresponding start position of touch action and terminal The whether consistent implementation in position, for the present embodiment to this without specifically limiting, this step only provides a kind of possible realization Mode.
Further, since when user executes click action on a terminal screen, it is understood that there may be the case where continuous several times are clicked.Example Such as, user currently opens calculator application, carries out 333333/6 operation, then the correspondence position of user on a terminal screen When setting input data 333333, multiple 3 position of click keys is needed, that is, there is the case where continuous several times click.Therefore, this reality The method for applying example offer further includes that differentiation user's click action is multiple click action and the process for single clicing on movement, specific step It is rapid as follows:
Obtain the duration of touch action;
Judge whether the duration of touch action is greater than preset threshold;
If the duration of touch action is greater than preset threshold, creates and repeatedly click event;
If the duration of touch action is less than preset threshold, creation single clicks on event.
Further, when obtaining the duration of touch action, timer can be used, timing, meter is carried out to touch action When initial time be user's finger initial contact terminal screen at the time of, timing terminate the time be user finger it is eventually off User's finger touching terminal screen is not heard in predetermined time interval at the time of terminal screen, and hereafter.Wherein, make a reservation for Time interval is less than preset threshold.By taking predetermined time interval is 0.5 second as an example, it is assumed that at the beginning of 10:00:00 listens to user's finger Begin touching terminal screen, then triggering timing device carries out timing, listens to user's finger in 10:00:01 and leaves terminal screen, and Hereafter user's finger touching terminal screen is not heard in 0.5 second, then triggering timing device stops timing, and working as timer Duration of the difference of preceding numerical value and predetermined time interval as touch action.
Wherein, the size of preset threshold concretely 1 second, the size of certain preset threshold can also be other in addition to 1 second Numerical value, for example, 2 seconds or 5 seconds etc., the present embodiment is to the size of preset threshold without specifically limiting.
Below with a specific example to the step provide according to the corresponding start position of touch action and terminal position It sets and creates the process of corresponding event and carry out that explanation is explained in detail.
With the start position of the touch action listened to for A, final position B, preset threshold is for 1 second, then first Judge whether position A with position B belongs to same position, if position A and position B belong to same position, shows user in terminal Click action is performed on screen, further obtains the duration of touch action, if the duration of touch action is 2 Second, then since the duration of touch action is greater than preset threshold 1 second, so event is repeatedly clicked in creation;If position A and position B is not belonging to same position, then shows that user performs screen sliding movement on a terminal screen, so creation screen sliding event.
204: automatic test script is recorded according to the event of creation.
For the step, the specific implementation of automatic test script is recorded according to the event of creation, including but unlimited In:
If the event of creation is screen sliding event, according to screen sliding event, the coordinate of the corresponding start position of touch action The coordinate value in value and final position records automatic test script;
If the event of creation is click event, according to the event of click, the coordinate of the corresponding start position of touch action The coordinate value in value or final position records automatic test script.
Wherein, coordinate value and terminal position when the event of creation is screen sliding event, due to the start position of touch action The coordinate value set is inconsistent, and therefore, when recording automatic test script, need the touch action recorded before plays point The coordinate value and screen sliding event of the coordinate value and final position set record automatic test script, i.e., in the automatic test of recording The not only coordinate of the start position including touch action and the coordinate in final position in script further include that the touching that executes of user is dynamic Make corresponding event type namely screen sliding event;
Further, according to the event of click, the coordinate value of the corresponding start position of touch action or the coordinate in final position Value records the specific implementation of automatic test script, including but not limited to:
If the event of creation is repeatedly to click event, basis repeatedly clicks corresponding event, touch action point The coordinate value of the coordinate value or final position set records automatic test script;
If the event of creation is the event that single clicks on, basis single clicks on corresponding point of event, touch action The coordinate value of the coordinate value or final position set records automatic test script.
Wherein, when the event of creation is click event, either multiple click event still single clicks on event, touching The coordinate value of the start position of movement and the coordinate value in final position are consistent always;Thus, it is only required to according to the touching recorded before The coordinate value of the start position of movement or the coordinate value in final position record automatic test script;Surveyed in the automation of recording In training sheet, only user execute touch action corresponding to event type it is different, be divided into multiple click event and Single click on event.
It should be noted that the method provided through this embodiment can realize the recording of automatic test script, specific When implementing the above method, it can both execute, can also be executed in the connection equipment of terminal, the present embodiment does not limit this at the terminal It is fixed.When executing at the terminal, can through the above steps 201 to step 204 realize.It, can be by terminal when being executed on connecting equipment The coordinate value of the event of creation, the coordinate value of the corresponding start position of touch action and final position is sent to connection equipment, Later again by connection equipment according to the coordinate value of the corresponding start position of event, touch action of creation and the coordinate in final position Value records automatic test script.Detailed process is as follows:
The coordinate value of the event of creation, the coordinate value of the corresponding start position of touch action and final position is pressed into message Queue;
Serialized message queue, obtains XML message;
XML message is sent to connection equipment, automatic test script is recorded according to XML message by connection equipment.
Wherein, for the ease of transmitting message queue between terminal and connection equipment, before transmitting the message queue, lead to Often the message queue is serialized, i.e., converts binary stream for the message queue, and then use HTTP(Hypertext Transfer protocol, hypertext transfer protocol) by network terminal and connection equipment between transmit the binary stream; After connection equipment receives the binary stream, unserializing is carried out to the binary stream, message queue, and then basis can be obtained Message queue records automatic test script.
Method provided in an embodiment of the present invention passes through record after listening to the touch action of user on a terminal screen The corresponding start position of the touch action listened to and final position, and according to the corresponding start position of touch action and terminal position The corresponding event of creation is set, and then automatic test script is recorded according to the event of creation, can reach under the conditions of unrestricted The purpose of automatic test script is recorded, and the process for recording automatic test script is easy, record cycle is short.In addition, may be used also The coordinate value of the event of creation, the coordinate value of the corresponding start position of touch action and final position is sent to connection equipment, Automatic test script is recorded by connection equipment, to extend the mode for recording automatic test script.
Embodiment three
The embodiment of the invention provides it is a kind of record automatic test script device, for execute above-described embodiment one or Method provided by embodiment two, referring to fig. 4, which includes:
Module 41 is monitored, for the touch action of monitoring users on a terminal screen;
Logging modle 42 monitors the corresponding start position of touch action and terminal position that module 41 listens to for recording It sets;
Creation module 43, the corresponding start position of touch action and final position wound for being recorded according to logging modle 42 Build corresponding event;
Module 44 is recorded, the event for creating according to creation module 43 records automatic test script.
Further, referring to Fig. 5, creation module 43, comprising:
Judging unit 431, for judging whether the corresponding start position of touch action and final position are consistent;
First creating unit 432, for judging the corresponding start position of touch action and terminal position when judging unit 431 When setting inconsistent, screen sliding event is created;
Second creating unit 433, for judging the corresponding start position of touch action and terminal position when judging unit 431 It sets unanimously, then creates click event.
Further, referring to Fig. 6, the second creating unit 433, comprising:
Subelement 4331 is obtained, for obtaining the duration of touch action;
Judgment sub-unit 4332, for judging whether the duration for obtaining the touch action that subelement 4331 is got is big In preset threshold;
First creation subelement 4333, for judging that it is pre- that the duration of touch action is greater than when judgment sub-unit 4332 If when threshold value, creating and repeatedly clicking event;
Second creation subelement 4334, for judging that it is pre- that the duration of touch action is less than when judgment sub-unit 4332 If when threshold value, creation single clicks on event.
Further, referring to Fig. 7, module 44 is recorded, comprising:
First recording elements 441, for when the event of creation be screen sliding event when, according to screen sliding event, touch action pair The coordinate value for the start position answered and the coordinate value in final position record automatic test script;
Second recording elements 442, for when the event of creation be click event when, according to click event, touch action pair The coordinate value for the start position answered or the coordinate value in final position record automatic test script.
Further, referring to Fig. 8, the second recording elements 442, comprising:
First records subelement 4421, for when the event of creation is repeatedly to click event, according to it is multiple click event, The coordinate value of the corresponding start position of touch action or the coordinate value in final position record automatic test script;
Second record subelement 4422, for when the event of creation be single click on event when, according to the event that single clicks on, The coordinate value of the corresponding start position of touch action or the coordinate value in final position record automatic test script.
Further, referring to Fig. 9, module 44 is recorded, comprising:
It is pressed into unit 443, the coordinate value of the corresponding start position of event, touch action for that will create and final position Coordinate value be pressed into message queue;
Serialization unit 444 is used for serialized message queue, obtains XML message;
Transmission unit 445, the XML message for serializing serialization unit 444 are sent to connection equipment, are set by connection It is standby that automatic test script is recorded according to XML message.
To sum up, device provided in an embodiment of the present invention passes through after listening to the touch action of user on a terminal screen The corresponding start position of touch action listened to and final position are recorded, and according to the corresponding start position of touch action and end Point position creates corresponding event, and then records automatic test script according to the event of creation, can reach in unrestricted item The purpose of automatic test script is recorded under part, and the process for recording automatic test script is easy, record cycle is short.In addition, Also the coordinate value of the event of creation, the coordinate value of the corresponding start position of touch action and final position connection can be sent to set It is standby, automatic test script is recorded by connection equipment, to extend the mode for recording automatic test script.
Example IV
A kind of terminal is present embodiments provided, which can be used for executing the recording automation provided in above-described embodiment The method of test script.Referring to Figure 10, which includes:
RF(Radio Frequency, radio frequency) circuit 110, include one or more computer-readable storage medium Memory 120, input unit 130, display unit 140, sensor 150, voicefrequency circuit 160, the WiFi (Wireless of matter Fidelity, Wireless Fidelity) module 170, include one or more than one the processor 180 and power supply of processing core 190 equal components.It will be understood by those skilled in the art that the restriction of the not structure paired terminal of terminal structure shown in Figure 10, it can To include perhaps combining certain components or different component layouts than illustrating more or fewer components.Wherein:
RF circuit 110 can be used for receiving and sending messages or communication process in, signal sends and receivees, particularly, by base station After downlink information receives, one or the processing of more than one processor 180 are transferred to;In addition, the data for being related to uplink are sent to Base station.In general, RF circuit 110 includes but is not limited to antenna, at least one amplifier, tuner, one or more oscillators, uses Family identity module (SIM) card, transceiver, coupler, LNA(Low Noise Amplifier, low-noise amplifier), duplex Device etc..In addition, RF circuit 110 can also be communicated with network and other equipment by wireless communication.The wireless communication can make With any communication standard or agreement, and including but not limited to GSM (Global System of Mobile communication, entirely Ball mobile communcations system), GPRS (General Packet Radio Service, general packet radio service), CDMA (Code Division Multiple Access, CDMA), WCDMA (Wideband Code Division Multiple Access, wideband code division multiple access), LTE (Long Term Evolution, long term evolution), Email, SMS (Short Messaging Service, short message service) etc..
Memory 120 can be used for storing software program and module, and processor 180 is stored in memory 120 by operation Software program and module, thereby executing various function application and data processing.Memory 120 can mainly include storage journey Sequence area and storage data area, wherein storing program area can the (ratio of application program needed for storage program area, at least one function Such as sound-playing function, image player function) etc.;Storage data area, which can be stored, uses created number according to terminal 1000 According to (such as audio data, phone directory etc.) etc..In addition, memory 120 may include high-speed random access memory, can also wrap Include nonvolatile memory, a for example, at least disk memory, flush memory device or other volatile solid-state parts. Correspondingly, memory 120 can also include Memory Controller, to provide processor 180 and input unit 130 to memory 120 access.
Input unit 130 can be used for receiving the number or character information of input, and generate and user setting and function Control related keyboard, mouse, operating stick, optics or trackball signal input.Specifically, input unit 130 may include touching Sensitive surfaces 131 and other input equipments 132.Touch sensitive surface 131, also referred to as touch display screen or Trackpad are collected and are used Family on it or nearby touch operation (such as user using any suitable object or attachment such as finger, stylus in touch-sensitive table Operation on face 131 or near touch sensitive surface 131), and corresponding attachment device is driven according to preset formula.It is optional , touch sensitive surface 131 may include both touch detecting apparatus and touch controller.Wherein, touch detecting apparatus detection is used The touch orientation at family, and touch operation bring signal is detected, transmit a signal to touch controller;Touch controller is from touch Touch information is received in detection device, and is converted into contact coordinate, then gives processor 180, and can receive processor 180 The order sent simultaneously is executed.Furthermore, it is possible to using multiple types such as resistance-type, condenser type, infrared ray and surface acoustic waves Realize touch sensitive surface 131.In addition to touch sensitive surface 131, input unit 130 can also include other input equipments 132.Specifically, Other input equipments 132 can include but is not limited to physical keyboard, function key (such as volume control button, switch key etc.), One of trace ball, mouse, operating stick etc. are a variety of.
Display unit 140 can be used for showing information input by user or the information and terminal 1000 that are supplied to user Various graphical user interface, these graphical user interface can be made of figure, text, icon, video and any combination thereof. Display unit 140 may include display panel 141, optionally, can use LCD (Liquid Crystal Display, liquid crystal Show device), the forms such as OLED (Organic Light-Emitting Diode, Organic Light Emitting Diode) configure display panel 141.Further, touch sensitive surface 131 can cover display panel 141, when touch sensitive surface 131 detects touching on it or nearby After touching operation, processor 180 is sent to determine the type of touch event, is followed by subsequent processing device 180 according to the type of touch event Corresponding visual output is provided on display panel 141.Although touch sensitive surface 131 and display panel 141 are conducts in Figure 10 Two independent components output and input function to realize, but in some embodiments it is possible to by touch sensitive surface 131 and display Panel 141 is integrated and realizes and outputs and inputs function.
Terminal 1000 may also include at least one sensor 150, such as optical sensor, motion sensor and other sensings Device.Specifically, optical sensor may include ambient light sensor and proximity sensor, wherein ambient light sensor can be according to environment The light and shade of light adjusts the brightness of display panel 141, and proximity sensor can close display when terminal 1000 is moved in one's ear Panel 141 and/or backlight.As a kind of motion sensor, gravity accelerometer can detect in all directions (generally Three axis) acceleration size, can detect that size and the direction of gravity when static, can be used to identify mobile phone posture application (ratio Such as horizontal/vertical screen switching, dependent game, magnetometer pose calibrating), Vibration identification correlation function (such as pedometer, tap);Extremely In other sensors such as gyroscope, barometer, hygrometer, thermometer, the infrared sensors that terminal 1000 can also configure, herein It repeats no more.
Voicefrequency circuit 160, loudspeaker 161, microphone 162 can provide the audio interface between user and terminal 1000.Sound Electric signal after the audio data received conversion can be transferred to loudspeaker 161, be converted to by loudspeaker 161 by frequency circuit 160 Voice signal output;On the other hand, the voice signal of collection is converted to electric signal by microphone 162, is received by voicefrequency circuit 160 After be converted to audio data, then by after the processing of audio data output processor 180, be sent to through RF circuit 110 such as another Terminal, or audio data is exported to memory 120 to be further processed.Voicefrequency circuit 160 is also possible that earplug is inserted Hole, to provide the communication of peripheral hardware earphone Yu terminal 1000.
WiFi belongs to short range wireless transmission technology, and terminal 1000 can help user to receive and dispatch electricity by WiFi module 170 Sub- mail, browsing webpage and access streaming video etc., it provides wireless broadband internet access for user.
Processor 180 is the control centre of terminal 1000, utilizes each portion of various interfaces and connection whole mobile phone Point, by running or execute the software program and/or module that are stored in memory 120, and calls and be stored in memory 120 Interior data execute the various functions and processing data of terminal 1000, to carry out integral monitoring to mobile phone.Optionally, it handles Device 180 may include one or more processing cores;Preferably, processor 180 can integrate application processor and modulation /demodulation processing Device, wherein the main processing operation system of application processor, user interface and application program etc., modem processor is mainly located Reason wireless communication.It is understood that above-mentioned modem processor can not also be integrated into processor 180.
Terminal 1000 further includes the power supply 190(such as battery powered to all parts), it is preferred that power supply can pass through electricity Management system and processor 180 are logically contiguous, to realize management charging, electric discharge and power consumption by power-supply management system The functions such as management.Power supply 190 can also include one or more direct current or AC power source, recharging system, power supply event Hinder the random components such as detection circuit, power adapter or inverter, power supply status indicator.
Although being not shown, terminal 1000 can also include camera, bluetooth module etc., and details are not described herein.Specifically at this In embodiment, the display unit of terminal is touch-screen display, terminal further include have memory and one or more than one Program, one of them perhaps more than one program be stored in memory and be configured to by one or more than one Reason device execution states one or more than one program includes the instruction for performing the following operation:
The touch action of monitoring users on a terminal screen;
Record the corresponding start position of touch action listened to and final position;
Corresponding event is created according to the corresponding start position of the touch action and final position;
Automatic test script is recorded according to the event of creation.
Assuming that above-mentioned is the first possible embodiment, then provided based on the first possible embodiment Second of possible embodiment in, in the memory of the terminal, also include instructions for performing the following operations:
Judge whether the corresponding start position of the touch action and final position are consistent;
If the corresponding start position of the touch action is inconsistent with final position, screen sliding event is created;
If the corresponding start position of the touch action is consistent with final position, click event is created.
In the third the possible embodiment provided based on second of possible embodiment, the terminal Memory in, also include instructions for performing the following operations:
Obtain the duration of the touch action;
Judge whether the duration of the touch action is greater than preset threshold;
If the duration of the touch action is greater than the preset threshold, creates and repeatedly click event;
If the duration of the touch action is less than the preset threshold, creation single clicks on event.
The 4th kind provided based on second of possible embodiment or the third possible embodiment can Also include instructions for performing the following operations in the memory of the terminal in the embodiment of energy:
If the event of creation is screen sliding event, according to corresponding the screen sliding event, touch action point The coordinate value of the coordinate value and final position set records the automatic test script;
If the event of creation is click event, according to corresponding the click event, touch action point The coordinate value of the coordinate value or final position set records the automatic test script.
In the 5th kind of possible embodiment provided based on the 4th kind of possible embodiment, the terminal Memory in, also include instructions for performing the following operations:
It is corresponding according to the multiple click event, the touch action if the event of creation is repeatedly to click event The coordinate value of start position or the coordinate value in final position record the automatic test script;
If the event of creation is to single click on event, it is corresponding that event, the touch action are single clickd on according to The coordinate value of start position or the coordinate value in final position record the automatic test script.
Make in the first possible embodiment or second of possible embodiment or the third possible embodiment Based on and in the 6th kind of possible embodiment providing, in the memory of the terminal, also comprising for executing following behaviour The instruction of work:
The coordinate value of the event of creation, the coordinate value of the corresponding start position of the touch action and final position is pressed into Message queue;
The message queue is serialized, XML message is obtained;
The XML message is sent to connection equipment, automation is recorded according to the XML message by the connection equipment and is surveyed Training sheet.
Terminal provided in an embodiment of the present invention passes through record after listening to the touch action of user on a terminal screen The corresponding start position of the touch action listened to and final position, and according to the corresponding start position of touch action and terminal position The corresponding event of creation is set, and then automatic test script is recorded according to the event of creation, can reach under the conditions of unrestricted The purpose of automatic test script is recorded, and the process for recording automatic test script is easy, record cycle is short.In addition, may be used also The coordinate value of the event of creation, the coordinate value of the corresponding start position of touch action and final position is sent to connection equipment, Automatic test script is recorded by connection equipment, to extend the mode for recording automatic test script.
Embodiment five
The embodiment of the invention provides a kind of computer readable storage medium, which be can be State computer readable storage medium included in the memory in embodiment;It is also possible to individualism, without supplying terminal In computer readable storage medium.The computer-readable recording medium storage has one or more than one program, described The method that one or more than one program are used to execute processing video by one or more than one processor, the method Include:
The touch action of monitoring users on a terminal screen;
Record the corresponding start position of touch action listened to and final position;
Corresponding event is created according to the corresponding start position of the touch action and final position;
Automatic test script is recorded according to the event of creation.
Assuming that above-mentioned is the first possible embodiment, then provided based on the first possible embodiment Second of possible embodiment in, it is described according to the corresponding start position of the touch action and final position creation correspond to Event, comprising:
Judge whether the corresponding start position of the touch action and final position are consistent;
If the corresponding start position of the touch action is inconsistent with final position, screen sliding event is created;
If the corresponding start position of the touch action is consistent with final position, click event is created.
In the third the possible embodiment provided based on second of possible embodiment, if described The corresponding start position of the touch action is consistent with final position, then creates click event, comprising:
Obtain the duration of the touch action;
Judge whether the duration of the touch action is greater than preset threshold;
If the duration of the touch action is greater than the preset threshold, creates and repeatedly click event;
If the duration of the touch action is less than the preset threshold, creation single clicks on event.
The 4th kind provided based on second of possible embodiment or the third possible embodiment can It is described that automatic test script is recorded according to the event of creation in the embodiment of energy, comprising:
If the event of creation is screen sliding event, according to corresponding the screen sliding event, touch action point The coordinate value of the coordinate value and final position set records the automatic test script;
If the event of creation is click event, according to corresponding the click event, touch action point The coordinate value of the coordinate value or final position set records the automatic test script.
In the 5th kind of possible embodiment provided based on the 4th kind of possible embodiment, the basis The coordinate value of the click event, the coordinate value of the corresponding start position of the touch action or final position is recorded described automatic Change test script, comprising:
It is corresponding according to the multiple click event, the touch action if the event of creation is repeatedly to click event The coordinate value of start position or the coordinate value in final position record the automatic test script;
If the event of creation is to single click on event, it is corresponding that event, the touch action are single clickd on according to The coordinate value of start position or the coordinate value in final position record the automatic test script.
Make in the first possible embodiment or second of possible embodiment or the third possible embodiment Based on and provide the 6th kind of possible embodiment in, it is described according to the event of creation record automatic test script, packet It includes:
The coordinate value of the event of creation, the coordinate value of the corresponding start position of the touch action and final position is pressed into Message queue;
The message queue is serialized, XML message is obtained;
The XML message is sent to connection equipment, automation is recorded according to the XML message by the connection equipment and is surveyed Training sheet.
Computer readable storage medium provided in an embodiment of the present invention, it is dynamic listening to the touching of user on a terminal screen After work, by recording the corresponding start position of touch action listened to and final position, and according to touch action corresponding Point position and final position create corresponding event, and then record automatic test script according to the event of creation, can reach The purpose of automatic test script is recorded under the conditions of unrestricted, and the process for recording automatic test script is easy, records week Phase is short.In addition, also the coordinate value of the event of creation, the coordinate value of the corresponding start position of touch action and final position can be sent out It send to connection equipment, automatic test script is recorded by connection equipment, to extend the mode for recording automatic test script.
Embodiment six
The embodiment of the invention provides a kind of graphical user interface, the graphical user interface is used at the terminal, the end End includes touch-screen display, memory and one for executing one or more than one program or more than one Processor;The graphical user interface includes:
The touch action of monitoring users on a terminal screen on the touch-screen display;
Record the corresponding start position of touch action listened to and final position;
Corresponding event is created according to the corresponding start position of the touch action and final position;
Automatic test script is recorded according to the event of creation.
Graphical user interface provided in an embodiment of the present invention, after listening to the touch action of user on a terminal screen, By recording the corresponding start position of touch action listened to and final position, and according to the corresponding start position of touch action And final position creates corresponding event, and then records automatic test script according to the event of creation, can reach unrestricted The purpose of automatic test script is recorded under the conditions of system, and the process for recording automatic test script is easy, record cycle is short.This Outside, also the coordinate value of the event of creation, the coordinate value of the corresponding start position of touch action and final position can be sent to company Equipment is connect, automatic test script is recorded by connection equipment, to extend the mode for recording automatic test script.
It should be understood that the device provided by the above embodiment for recording automatic test script is recording automatic test When script, only the example of the division of the above functional modules, in practical application, it can according to need and by above-mentioned function It can distribute and be completed by different functional modules, i.e., the internal structure of device is divided into different functional modules, more than completing The all or part of function of description.In addition, the device provided by the above embodiment for recording automatic test script and recording are certainly The embodiment of the method for dynamicization test script belongs to same design, and specific implementation process is detailed in embodiment of the method, no longer superfluous here It states.
The serial number of the above embodiments of the invention is only for description, does not represent the advantages or disadvantages of the embodiments.
Those of ordinary skill in the art will appreciate that realizing that all or part of the steps of above-described embodiment can pass through hardware It completes, relevant hardware can also be instructed to complete by program, the program can store in a kind of computer-readable In storage medium, storage medium mentioned above can be read-only memory, disk or CD etc..
The foregoing is merely presently preferred embodiments of the present invention, is not intended to limit the invention, it is all in spirit of the invention and Within principle, any modification, equivalent replacement, improvement and so on be should all be included in the protection scope of the present invention.

Claims (8)

1. a kind of method for recording automatic test script, which is characterized in that the described method includes:
The touch action of monitoring users on a terminal screen;
Record the corresponding start position of touch action listened to and final position;
Judge whether the corresponding start position of the touch action and final position are consistent;
If the corresponding start position of the touch action is inconsistent with final position, screen sliding event is created;
If the corresponding start position of the touch action is consistent with final position, click event is created;
Automatic test script is recorded according to the event of creation;
It is described that automatic test script is recorded according to the event of creation, comprising:
The coordinate value of the event of creation, the coordinate value of the corresponding start position of the touch action and final position is pressed into message Queue;
Automatic test script is recorded according to the message queue;Alternatively, serializing the message queue, extensible markup is obtained Language XML message;The XML message is sent to connection equipment, by the connection equipment when receiving the XML message, Unserializing is carried out to the XML message, obtains the message queue, automatic test foot is recorded according to the message queue This.
If 2. the method according to claim 1, wherein the corresponding start position of the touch action with Final position is consistent, then creates click event, comprising:
Obtain the duration of the touch action;
Judge whether the duration of the touch action is greater than preset threshold;
If the duration of the touch action is greater than the preset threshold, creates and repeatedly click event;
If the duration of the touch action is less than the preset threshold, creation single clicks on event.
3. method according to claim 1 or 2, which is characterized in that described to record automatic test according to the event of creation Script, comprising:
If the event of creation is screen sliding event, according to the screen sliding event, the touch action corresponding start position Coordinate value and the coordinate value in final position record the automatic test script;
If the event of creation is click event, according to the click event, the touch action corresponding start position Coordinate value or the coordinate value in final position record the automatic test script.
4. according to the method described in claim 3, it is characterized in that, described according to the click event, the touch action pair The coordinate value for the start position answered or the coordinate value in final position record the automatic test script, comprising:
If the event of creation is repeatedly to click event, according to the multiple click event, the touch action corresponding The coordinate value of point position or the coordinate value in final position record the automatic test script;
If the event of creation is to single click on event, corresponding of event, the touch action is single clickd on according to The coordinate value of point position or the coordinate value in final position record the automatic test script.
5. a kind of device for recording automatic test script, which is characterized in that described device includes:
Module is monitored, for the touch action of monitoring users on a terminal screen;
Logging modle, for recording the corresponding start position of touch action and final position that the monitoring module listens to;
Creation module, the corresponding start position of touch action and final position creation pair for being recorded according to the logging modle The event answered;
Module is recorded, the event for creating according to the creation module records automatic test script;
The creation module, comprising:
Judging unit, for judging whether the corresponding start position of the touch action and final position are consistent;
First creating unit, for judging that the corresponding start position of touch action and final position are different when the judging unit When cause, screen sliding event is created;
Second creating unit, for judging the corresponding start position of touch action and final position one when the judging unit It causes, then creates click event;
The recording module, comprising:
It is pressed into unit, the coordinate value of event, the corresponding start position of the touch action for that will create and final position Coordinate value is pressed into message queue;
The module of recording further includes the unit for executing according to message queue recording automatic test script, or also Including serialization unit and transmission unit;
The serialization unit obtains expandable mark language XML message for serializing the message queue;
The transmission unit, the XML message for obtaining the serialization unit is sent to connection equipment, by the company Equipment is connect when receiving the XML message, unserializing is carried out to the XML message and obtains the message queue, according to institute It states message queue and records automatic test script.
6. device according to claim 5, which is characterized in that second creating unit, comprising:
Subelement is obtained, for obtaining the duration of the touch action;
Judgment sub-unit, for judging whether the duration for obtaining the touch action that subelement is got is greater than default threshold Value;
First creation subelement, for judging that the duration of touch action is greater than the default threshold when the judgment sub-unit When value, creates and repeatedly click event;
Second creation subelement, for judging that the duration of touch action is less than the default threshold when the judgment sub-unit When value, creation single clicks on event.
7. device according to claim 5 or 6, which is characterized in that the recording module, comprising:
First recording elements, for when the event of creation be screen sliding event when, according to the screen sliding event, the touch action pair The coordinate value for the start position answered and the coordinate value in final position record the automatic test script;
Second recording elements, for when the event of creation be click event when, according to the click event, the touch action pair The coordinate value for the start position answered or the coordinate value in final position record the automatic test script.
8. device according to claim 7, which is characterized in that second recording elements, comprising:
First records subelement, for when the event of creation is repeatedly to click event, according to the multiple click event, described The coordinate value of the corresponding start position of touch action or the coordinate value in final position record the automatic test script;
Second records subelement, for when the event of creation is to single click on event, according to the event, described of single clicing on The coordinate value of the corresponding start position of touch action or the coordinate value in final position record the automatic test script.
CN201310388968.1A 2013-08-30 2013-08-30 Record the method and device of automatic test script Active CN104423822B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201310388968.1A CN104423822B (en) 2013-08-30 2013-08-30 Record the method and device of automatic test script

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201310388968.1A CN104423822B (en) 2013-08-30 2013-08-30 Record the method and device of automatic test script

Publications (2)

Publication Number Publication Date
CN104423822A CN104423822A (en) 2015-03-18
CN104423822B true CN104423822B (en) 2019-04-02

Family

ID=52972974

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201310388968.1A Active CN104423822B (en) 2013-08-30 2013-08-30 Record the method and device of automatic test script

Country Status (1)

Country Link
CN (1) CN104423822B (en)

Families Citing this family (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105138458A (en) * 2015-09-10 2015-12-09 上海斐讯数据通信技术有限公司 Method and system for recording automatic testing scripts by combining intelligent terminal and computer terminal
CN106648397B (en) * 2015-11-02 2019-11-08 网易(杭州)网络有限公司 A kind of the game operation record processing method and system of mobile terminal
CN106055446B (en) * 2016-06-24 2019-09-20 捷开通讯(深圳)有限公司 A kind of test method and device of mobile terminal
CN106933628A (en) * 2017-03-06 2017-07-07 青岛海信移动通信技术股份有限公司 Application program performs method, mobile terminal and the computer equipment of operation
WO2019056333A1 (en) * 2017-09-25 2019-03-28 深圳传音制造有限公司 Screen recording method for mobile terminal testing and mobile terminal
CN109800135B (en) * 2017-11-17 2022-01-07 腾讯科技(深圳)有限公司 Information processing method and terminal
CN108021319B (en) * 2017-12-07 2021-06-29 北京小米移动软件有限公司 Method and device for trying intelligent equipment
CN108255729B (en) * 2018-01-24 2021-12-31 珠海金山网络游戏科技有限公司 Mobile phone game automatic testing method and system based on Unity platform
CN113535029A (en) * 2021-07-30 2021-10-22 西安闻泰电子科技有限公司 Operation recording method, terminal, computer device and computer-readable storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101118515A (en) * 2007-09-11 2008-02-06 腾讯科技(深圳)有限公司 Automatically testing method and apparatus for list
CN102156673A (en) * 2011-04-20 2011-08-17 北京航空航天大学 Test case description oriented GUI (Graphical User Interface) automatic test system and test method thereof
CN102314386A (en) * 2011-09-05 2012-01-11 百度在线网络技术(北京)有限公司 Method and equipment for testing mobile terminal

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070124367A1 (en) * 2005-11-29 2007-05-31 Guoxin Fan Integrated Mobile Diagnostics and Electronic Customer Care Test Script with Browser

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101118515A (en) * 2007-09-11 2008-02-06 腾讯科技(深圳)有限公司 Automatically testing method and apparatus for list
CN102156673A (en) * 2011-04-20 2011-08-17 北京航空航天大学 Test case description oriented GUI (Graphical User Interface) automatic test system and test method thereof
CN102314386A (en) * 2011-09-05 2012-01-11 百度在线网络技术(北京)有限公司 Method and equipment for testing mobile terminal

Also Published As

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

Similar Documents

Publication Publication Date Title
CN104423822B (en) Record the method and device of automatic test script
CN104427083B (en) The method and apparatus for adjusting volume
CN105320598B (en) Method for testing software and device
CN103500002B (en) The method of application program management, device and terminal unit
CN104978176B (en) Application programming interfaces call method, device and computer readable storage medium
CN104636047B (en) The method, apparatus and touch screen terminal operated to the object in list
CN106453511B (en) A kind of data back up method and equipment
CN104238893B (en) A kind of method and apparatus that video preview picture is shown
CN105549740B (en) A kind of method and apparatus of playing audio-fequency data
CN104077211B (en) A kind of test method and test system of mobile terminal software
CN106126411B (en) The method and apparatus that a kind of pair of tested program code is tested
CN104869465B (en) video playing control method and device
CN104572046B (en) A kind of storehouse restoring method and computer system
CN105847325B (en) The adjustment method and device of applications client
CN103473011A (en) Mobile terminal, and performance detecting method and performance detecting device for mobile terminal
CN105094513B (en) User's head portrait setting method, device and electronic equipment
CN104346276B (en) The method and device of software test
CN105389259B (en) A kind of method, apparatus and system for carrying out Application testing
CN104965642B (en) Drop-down list generation method and device
CN104166646B (en) A kind of method and apparatus for inputting uniform resource locator
CN109669662A (en) A kind of pronunciation inputting method, device, storage medium and mobile terminal
CN105700620B (en) A kind of method and apparatus executing control instruction
CN107066860B (en) A kind of fingerprint identification method and mobile terminal
CN104092657B (en) Method, equipment and the system of information transmission
CN103533411B (en) A kind of method and apparatus of control selections cursor movement

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
TR01 Transfer of patent right

Effective date of registration: 20210915

Address after: 518057 Tencent Building, No. 1 High-tech Zone, Nanshan District, Shenzhen City, Guangdong Province, 35 floors

Patentee after: TENCENT TECHNOLOGY (SHENZHEN) Co.,Ltd.

Patentee after: TENCENT CLOUD COMPUTING (BEIJING) Co.,Ltd.

Address before: 2, 518000, East 403 room, SEG science and Technology Park, Zhenxing Road, Shenzhen, Guangdong, Futian District

Patentee before: TENCENT TECHNOLOGY (SHENZHEN) Co.,Ltd.

TR01 Transfer of patent right