CN105512031A - Mobile terminal and automatic test method - Google Patents

Mobile terminal and automatic test method Download PDF

Info

Publication number
CN105512031A
CN105512031A CN201510860131.1A CN201510860131A CN105512031A CN 105512031 A CN105512031 A CN 105512031A CN 201510860131 A CN201510860131 A CN 201510860131A CN 105512031 A CN105512031 A CN 105512031A
Authority
CN
China
Prior art keywords
recording
playback
mobile terminal
tested
program
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.)
Pending
Application number
CN201510860131.1A
Other languages
Chinese (zh)
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.)
Huizhou TCL Mobile Communication Co Ltd
Original Assignee
Huizhou TCL Mobile Communication 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 Huizhou TCL Mobile Communication Co Ltd filed Critical Huizhou TCL Mobile Communication Co Ltd
Priority to CN201510860131.1A priority Critical patent/CN105512031A/en
Publication of CN105512031A publication Critical patent/CN105512031A/en
Pending legal-status Critical Current

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

Abstract

The invention discloses a mobile terminal and an automatic test method thereof; the method comprises the following steps: recording user operations on a to-be tested program on the mobile terminal; storing the operations in a recording result file of the mobile terminal; receiving a playback test order of the to-be tested program, replaying a scripts file and reading the recording result file, and starting the to-be tested program, thus automatically executing the playback test. The method can realize automatic test based on UI on the mobile terminal.

Description

A kind of mobile terminal and automatic test approach thereof
Technical field
The present invention relates to a kind of mobile terminal and automatic test approach thereof.
Background technology
Along with the development of mobile terminal technology and universal, various mobile terminal plays an increasingly important role in people's daily life, working and learning, meanwhile, in order to meet the ever-increasing demand for experience of people, function also more and more hommization and the intellectuality of the various programs that mobile terminal provides, and the performance index such as the stability of program, reliability also become the main consideration aspect of people's optional m igration terminal, therefore, the test of mobile terminal Program is also become very important.
Existing mobile terminal to be tested automatically, mainly contain following three kinds: the first, get around user interface (UserInterface, UI), directly call API in framework and test; The second, uses the white-box testing that javajuint carries out in source code; The third, based on the automatic test of UI.Wherein, the current automatic test based on UI all needs PC PC to be connected by USB with testing mobile terminal, and script runs directly on PC.This test mode defines environment for use and improves difficulty of test.
Summary of the invention
The technical matters that the present invention mainly solves how to realize the automatic test based on UI on mobile terminals.
For solving the problems of the technologies described above, the technical scheme that the present invention adopts is: provide a kind of mobile terminal automatic test approach, described method comprises: receive recording operation instruction, records the operation of user in program to be tested; The operation of the user of recording in program to be tested is kept in the recording destination file of described mobile terminal; When receiving the described program to be tested of playback test, by playback script file, read described recording destination file; Start described program to be tested, automatically perform playback test.
Wherein, described method also comprises: recording in the operating process of user in program to be tested, performed the described recording state of inquiry by the instruction correspondence receiving interactive interface and controlled the operation of recording process; In the described program to be tested of described startup, automatically perform in playback test process, perform the described playback test mode of inquiry by the instruction correspondence of interactive interface and control the operation of described playback test process.
Wherein, after the instruction of described reception recording operation, before recording the operation of user in program to be tested, also comprise: recording library file is loaded the internal memory into described mobile terminal, initialization is carried out to the described recording destination file in described recording library file; Described after receiving the described program to be tested of playback test, by playback script file, before reading described recording destination file, also comprise: playback library file is loaded the internal memory into described mobile terminal, initialization is carried out to described playback library file.
Wherein, receive recording operation instruction, before recording the operation of user in program to be tested, also comprise: the root access limit obtaining described mobile terminal.
Wherein, the operation of described user in program to be tested comprises touch screen operation and keyboard operation.
For solving the problems of the technologies described above, another technical solution used in the present invention is: provide a kind of mobile terminal, described mobile terminal comprises records module, preservation module, read module and test module, wherein: described recording module, for receiving recording operation instruction, records the operation of user in program to be tested; Described preservation module is for being kept in the recording destination file of described mobile terminal by the operation of the user of recording in program to be tested; Described read module is used for, when receiving the described program to be tested of playback test, by playback script file, reading described recording destination file; Described test module starts described program to be tested for controlling, and automatically performs playback test.
Wherein, described mobile terminal also comprises control module, and described control module, for recording in the operating process of user in program to be tested, by receiving the instruction of interactive interface, controls the corresponding operation performing the described recording state of inquiry and control recording process; Described control module also in the described program to be tested of described startup, automatically performs in playback test process, by the instruction of interactive interface, controls the corresponding operation performing the described playback test mode of inquiry and control described playback test process.
Wherein, described mobile terminal also comprises initialization module, described initialization module is for after receiving recording operation instruction, before recording the operation of user in program to be tested, recording library file is loaded the internal memory into described mobile terminal, initialization is carried out to the described recording destination file in described recording library file; Or described initialization module also for described when receive playback test described program to be tested after, by playback script file, before reading described recording destination file, playback library file is loaded the internal memory into described mobile terminal, initialization is carried out to described playback library file.
Wherein, described mobile terminal also comprises acquisition module, and described acquisition module is used for, in the instruction of reception recording operation, before recording the operation of user in program to be tested, obtaining the root access limit of described mobile terminal.
Wherein, the operation of described user in program to be tested comprises touch screen operation and keyboard operation.
The invention has the beneficial effects as follows: the situation being different from prior art, the present invention is by mobile terminal being recorded the operation of user in program to be tested and being kept in the recording destination file of mobile terminal, when receiving playback and testing program to be tested, by playback script file, read and record destination file, start program to be tested, automatically perform playback test.By such mode, realize recording and the operation of replaying user in program to be tested at mobile terminal, thus can realize not needing dependence PC or other utility appliance just can realize the automatic test of mobile terminal based on UI.
Accompanying drawing explanation
Fig. 1 is the process flow diagram of a kind of mobile terminal automatic test approach that the embodiment of the present invention provides;
Fig. 2 is the structural representation of a kind of mobile terminal that the embodiment of the present invention provides;
Fig. 3 is the structural representation of the another kind of mobile terminal that the embodiment of the present invention provides.
Embodiment
Refer to Fig. 1, Fig. 1 is the process flow diagram of a kind of mobile terminal automatic test approach that the embodiment of the present invention provides, and wherein, automatic test approach of the present invention mainly realizes based on android system, as shown in the figure, the mobile terminal automatic test approach of the present embodiment comprises the following steps:
S101: receive recording operation instruction, records the operation of user in program to be tested.
After receiving recording operation instruction (namely tester indicates sign on), start recording function, record all operation of user in program to be tested, wherein, the operation of user in program to be tested comprises touch screen operation and keyboard operation etc.
During specific implementation, use the library file of the record.so of a LinuxC language compilation reading/dev/input/eventX, called by the mode of JNI in the application, realize recording.
Wherein, before recording, also comprise and load internal memory into mobile terminal by recording library file record.so, initialization is carried out to the recording destination file recorded in library file record.so, and then starts to record.
During specific implementation initialization procedure, by intinit (); This function completes all initialization operations to event file, comprises the initialization to pollfd structure, the establishment etc. of some file directorys.Then by calling introbot_record (constchar*scriptFileName); This function is the function that specific implementation is recorded, and records the operation of user.
S102: the operation of the user of recording in program to be tested is kept in the recording destination file of mobile terminal.
The operation of the user of recording in program to be tested is kept in the recording destination file of mobile terminal.
Particularly, be kept in the sf file of running after fame with scriptFileName.In recording process, each events file of specifying of function introbot_record (constchar*scriptFileName) poll, obtains file type and inlet flow, and being sequentially written in file according to filename+inlet flow.
Wherein, recording in the operating process of user in program to be tested, performing inquiry recording state by the instruction correspondence receiving interactive interface and control the operation of recording process.
Wherein, specifically can by calling RecordSateTypecheck_record_state (); This function is the equal of a tester, and outside can be called by interactive interface and be checked current recording state with superior function.Mobile terminal, according to the instruction of interactive interface, returns the state of the enumeration type of a RecordSateType.RecordSateType is a self-defining enumeration type, and the inside contains some states of recording process.
Further, can also by calling intset_record_state (RecordSateTypestateType); This function is used for setting the state in recording process, to play the effect controlling recording process.Can set be such as-1 (STOP), to realize the effect stopping recording.
That is, when the present invention starts to record, first the application program of java layer can load this library file of record.so.Load in record.so and first can perform init () function after internal memory, perform initialized operation.Realized recording by robot_recrod (constchar*scriptFileName) after initialization completes, and be written in scriptFileName file and save, while recording, ceaselessly feed back current state to java layer by check_record_state (), java layer also can be controlled the process of recording by set_record_state (RecordSateTypestateType) according to the needs of tester.
S103: when receiving playback and testing program to be tested, by playback script file, reads and records destination file.
Playback refers to reloads former test script, allows test machine perform playback test according to the content of script.Playback is exactly the inverse process of above-mentioned recording.
When receiving playback and testing program to be tested, by playback script file, start and test.After startup, the Content Transformation of script file can become by mobile terminal automatically/and the form of dev/input/event file also writes the file of correspondence one by one, completes playback.
During specific implementation, use LinuxC language compilation one again to the library file of the replay.so of/dev/input/eventX writing in files, called by the mode of JNI in the application, realize playback function.
Wherein, after receiving playback and testing program to be tested, by playback script file, read before recording destination file, also comprise: playback library file is loaded the internal memory into mobile terminal, initialization is carried out to playback library file, then by the playback script file in the playback library file after initialization, reads and record destination file.
Particularly, intinit () can be passed through; This function completes all initialization operations to event file, comprises the initialization to pollfd structure, the initialization etc. of stat structure.
S104: start program to be tested, automatically performs playback test.
After executing initialization, then by the playback script file after initialization, read recording destination file and carry out playback test.Particularly, by calling introbot_replay (constchar*scriptFileName); This function realizes the function of concrete playback script.Parameter s criptFileName is that the transmission of JAVA layer is got off, and specifies by it the script file needing playback.During playback, first this function carries out clear operation to timeval structure object, guarantees that content is up-to-date; Then script file is read, and according to the filename of script file, the document flow of correspondence is written to/dev/input/ under corresponding events file in, obtain the current time simultaneously, and input_event.time is set to current time value, be written in the lump in event file.Realize the conversion of form, complete playback.
In startup program to be tested, automatically perform in playback test process, perform inquiry playback test mode by the instruction correspondence of interactive interface and control the operation of playback test process.
Particularly, by calling RepalySateTypecheck_replay_state (); This function is the equal of a tester, and mobile terminal can receive the instruction of the current playback state of inquiry by interactive interface.The state of the enumeration type of a RepalySateType is returned according to instruction.RepalySateType is a self-defining enumeration type, and the inside contains some states of replayed section.
Further, can control playback test process by calling intset_replay_state (RepalySateTypestateType), this function is used for setting the state in replayed section, to play the effect controlling playback process.Can set be such as-1 (STOP), to realize the function stopping playback.
That is, in the present invention, when starting playback, first the application program of java layer can load this library file of replay.so.Replay.so loads after internal memory, first can perform init () function, performs initialized operation.By robot_replayconstchar*scriptFileName after initialization completes) find the script file of specifying, write again after data in file are carried out format conversion/dev/input in, while playback, ceaselessly feed back current state to java layer by check_replay_state (), java layer also can be controlled the process of playback by intset_replay_state (RepalySateTypestateType) according to the needs of tester.
Wherein, above-mentioned recording and replayed section in the present embodiment, mainly in the operation that bottom carries out Linux file, can provide interactive interface by realizing an application software at JAVA layer to user, thus realize the control of recording and replayed section.During specific implementation, for controlling to record and after the application software of playback starts, show a suspended window, all recording and playback of user is operated and can be controlled by click suspended window.Start/stop can record and playback as by click suspended window, compile and preserve script, the number of times etc. of playback cycle is set.
Specifically, by application software control recording and playback can be specifically: after user launches application software is clicked and started to record button, the main interface of application program is automatically exited and is navigate to main interface, shows the suspended window that can click simultaneously, next step operation of indicating user.Click after recording button " clicktorecord ", application program enters recording " recording " state; If wanting to stop recording, directly can click " recording " button, stop arriving compiling afterwards and preserving interface, input is preserved after needing the name of preserving, and also can select not preserve; After this step, come and playback number of times interface be set, after playback number of times is set, start playback, playback be the script of current recording.If previous step abandons compiling and preserves, application program is the data in playback internal memory, can not generation script file.If have selected preservation, the script file after application program meeting playback compiling, this script file can directly be deposited in the terminal, can reuse.In replayed section, clicking suspended window can stop at any time, and after stopping, application program can get back to " clicktorecord " state, waits for that second time is recorded.
Script file before playback, can click Play button, select concrete script file to carry out playback by combobox in the main interface of application program.Concrete replayed section with above-mentioned mention consistent.
Wherein, said method of the present invention, first needs the file below reading/dev/input/ catalogue, and this just needs the root access limit of mobile terminal system.
Wherein, if said method of the present invention realizes in root system, then do not need to obtain root access limit, if be in non-root system, just need the access limit first obtaining root.
Wherein, as a kind of concrete implementation, the embodiment of the present invention can obtain root authority by performing as issued orders:
adbshellsetpropro.secure0
adbshellsetpropro.debuggable1
adbshellsetpropro.allow.mock.location1
adbshellsetproppersist.sys.usb.configmtp,adb
adbshellsetpropro.adbsecure0
timeout/t2
adbshell/system/bin/setenforce0
timeout/t2
adbremount
Certainly, the third party of SuperUser and so on also can be used should to have to obtain interim su authority, also can specific implementation said method of the present invention.
The mobile terminal automatic test approach that the above embodiment of the present invention provides, by mobile terminal being recorded the operation of user in program to be tested and being kept in the recording destination file of mobile terminal, when receiving playback and testing program to be tested, by playback script file, read and record destination file, start program to be tested, automatically perform playback test.By such mode, realize recording and the operation of replaying user in program to be tested at mobile terminal, thus can realize not needing dependence PC or other utility appliance just can realize the automatic test of mobile terminal based on UI.
The method of the above embodiment of the present invention, records (Record) test scene (script) in android terminal, then can at any time directly playback in the terminal (Playback) out, and capture test log.Above method of testing, use scenes is simple, does not have other requirements, also do not need to depend on the utility appliance such as other such as PC, directly operate on testing mobile terminal test environment.Less demanding to tester in addition, do not require that tester has script edit ability.Therefore, said method of the present invention can realize recording whenever and wherever possible and testing.
Refer to Fig. 2, Fig. 2 is the structural representation of a kind of mobile terminal that the embodiment of the present invention provides, the mobile terminal of the present embodiment is for performing above-mentioned method embodiment illustrated in fig. 1, as shown in the figure, the mobile terminal 100 of the present embodiment comprises records module 11, preservation module 12, read module 13 and test module 14, wherein:
Recording module 11 for receiving recording operation instruction, recording the operation of user in program to be tested.
Record module 11 (namely tester indicates sign on) after receiving recording operation instruction, start recording function, record all operation of user in program to be tested, wherein, the operation of user in program to be tested comprises touch screen operation and keyboard operation etc.
During specific implementation, record the library file that module 11 uses the record.so of a LinuxC language compilation reading/dev/input/eventX, called by the mode of JNI in the application, realize recording.
Wherein, please continue to refer to Fig. 2, the mobile terminal 100 of the present embodiment also comprises initialization module 15, initialization module 15 is for after receiving recording operation instruction, before recording the operation of user in program to be tested, recording library file is loaded the internal memory into mobile terminal, initialization is carried out to the recording destination file recorded in library file.
Particularly, recording library file record.so is loaded the internal memory into mobile terminal by initialization module 15, carries out initialization to the recording destination file recorded in library file record.so, then records module 11 and starts to record again.
During specific implementation initialization procedure, initialization module 15 is by intinit (); This function completes all initialization operations to event file, comprises the initialization to pollfd structure, the establishment etc. of some file directorys.Then module 11 is recorded by calling introbot_record (constchar*scriptFileName); This function is the function that specific implementation is recorded, and records the operation of user.
Preserve module 12 for the operation of the user of recording in program to be tested being kept in the recording destination file of mobile terminal.
Preserve module 12 operation of the user of recording in program to be tested is kept in the recording destination file of mobile terminal.
Particularly, be kept in the sf file of running after fame with scriptFileName.In recording process, each events file of specifying of function introbot_record (constchar*scriptFileName) poll, obtains file type and inlet flow, and being sequentially written in file according to filename+inlet flow.
Wherein, please continue to refer to Fig. 2, the mobile terminal 100 of the embodiment of the present invention also comprises control module 16, control module 16 is for recording in the operating process of user in program to be tested, by receiving the instruction of interactive interface, control the corresponding operation performing inquiry recording state and control recording process.
Wherein, control module 16 specifically can by calling RecordSateTypecheck_record_state (); This function is the equal of a tester, and outside can be called by interactive interface and be checked current recording state with superior function.Mobile terminal, according to the instruction of interactive interface, returns the state of the enumeration type of a RecordSateType.RecordSateType is a self-defining enumeration type, and the inside contains some states of recording process.
Further, can also by calling intset_record_state (RecordSateTypestateType); This function is used for setting the state in recording process, to play the effect controlling recording process.Can set be such as-1 (STOP), to realize the effect stopping recording.
That is, when the present invention starts to record, first the application program of java layer can load this library file of record.so.Load in record.so and first can perform init () function after internal memory, perform initialized operation.Realized recording by robot_recrod (constchar*scriptFileName) after initialization completes, and be written in scriptFileName file and save, while recording, ceaselessly feed back current state to java layer by check_record_state (), java layer also can be controlled the process of recording by set_record_state (RecordSateTypestateType) according to the needs of tester.
Read module 13, for when receiving playback and testing program to be tested, by playback script file, reads and records destination file.
Playback refers to reloads former test script, allows test machine perform playback test according to the content of script.Playback is exactly the inverse process of above-mentioned recording.
When receiving playback and testing program to be tested, by playback script file, start and test.After startup, the Content Transformation of script file can become by mobile terminal automatically/and the form of dev/input/event file also writes the file of correspondence one by one, completes playback.
During specific implementation, read module 13 uses LinuxC language compilation one again to the library file of the replay.so of/dev/input/eventX writing in files, is called in the application, realize playback function by the mode of JNI.
Wherein, initialization module 15, also for after receiving playback and testing program to be tested, by playback script file, reads before recording destination file, playback library file is loaded the internal memory into mobile terminal, carries out initialization to playback library file.
Particularly, initialization module 15 can pass through intinit (); This function completes all initialization operations to event file, comprises the initialization to pollfd structure, the initialization etc. of stat structure.
Test module 14 starts program to be tested for controlling, and automatically performs playback test.
After initialization module 15 executes initialization, then test module 14 is by the playback script file after initialization, reads recording destination file and carries out playback test.Particularly, by calling introbot_replay (constchar*scriptFileName); This function realizes the function of concrete playback script.Parameter s criptFileName is that the transmission of JAVA layer is got off, and specifies by it the script file needing playback.During playback, first this function carries out clear operation to timeval structure object, guarantees that content is up-to-date; Then script file is read, and according to the filename of script file, the document flow of correspondence is written to/dev/input/ under corresponding events file in, obtain the current time simultaneously, and input_event.time is set to current time value, be written in the lump in event file.Realize the conversion of form, complete playback.
Wherein, control module 16, also for starting program to be tested at test module 14, automatically performs in playback test process, performs inquiry playback test mode and control the operation of playback test process by the instruction correspondence of interactive interface.
Particularly, control module 16 is by calling RepalySateTypecheck_replay_state (); This function is the equal of a tester, and mobile terminal can receive the instruction of the current playback state of inquiry by interactive interface.The state of the enumeration type of a RepalySateType is returned according to instruction.RepalySateType is a self-defining enumeration type, and the inside contains some states of replayed section.
Further, control module 16 can also control playback test process by calling intset_replay_state (RepalySateTypestateType), this function is used for setting the state in replayed section, to play the effect controlling playback process.Can set be such as-1 (STOP), to realize the function stopping playback.
That is, in the present invention, when starting playback, first the application program of java layer can load this library file of replay.so.Replay.so loads after internal memory, first can perform init () function, performs initialized operation.By robot_replayconstchar*scriptFileName after initialization completes) find the script file of specifying, write again after data in file are carried out format conversion/dev/input in, while playback, ceaselessly feed back current state to java layer by check_replay_state (), java layer also can be controlled the process of playback by intset_replay_state (RepalySateTypestateType) according to the needs of tester.
Wherein, above-mentioned recording and replayed section in the present embodiment, mainly in the operation that bottom carries out Linux file, can provide interactive interface by realizing an application software at JAVA layer to user, thus realize the control of recording and replayed section.During specific implementation, for controlling to record and after the application software of playback starts, show a suspended window, all recording and playback of user is operated and can be controlled by click suspended window.Start/stop can record and playback as by click suspended window, compile and preserve script, the number of times etc. of playback cycle is set.
Specifically, by application software control recording and playback can be specifically: after user launches application software is clicked and started to record button, the main interface of application program is automatically exited and is navigate to main interface, shows the suspended window that can click simultaneously, next step operation of indicating user.Click after recording button " clicktorecord ", application program enters recording " recording " state; If wanting to stop recording, directly can click " recording " button, stop arriving compiling afterwards and preserving interface, input is preserved after needing the name of preserving, and also can select not preserve; After this step, come and playback number of times interface be set, after playback number of times is set, start playback, playback be the script of current recording.If previous step abandons compiling and preserves, application program is the data in playback internal memory, can not generation script file.If have selected preservation, the script file after application program meeting playback compiling, this script file can directly be deposited in the terminal, can reuse.In replayed section, clicking suspended window can stop at any time, and after stopping, application program can get back to " clicktorecord " state, waits for that second time is recorded.
Script file before playback, can click Play button, select concrete script file to carry out playback by combobox in the main interface of application program.Concrete replayed section with above-mentioned mention consistent.
Wherein, said method of the present invention, first needs the file below reading/dev/input/ catalogue, and therefore, please continue to refer to Fig. 2, the mobile terminal 100 of the present embodiment also comprises acquisition module 17, and acquisition module 17 is for obtaining the root access limit of mobile terminal.
Wherein, as a kind of concrete implementation, the embodiment of the present invention can obtain root authority by performing as issued orders:
adbshellsetpropro.secure0
adbshellsetpropro.debuggable1
adbshellsetpropro.allow.mock.location1
adbshellsetproppersist.sys.usb.configmtp,adb
adbshellsetpropro.adbsecure0
timeout/t2
adbshell/system/bin/setenforce0
timeout/t2
adbremount
Certainly, acquisition module 17 also can use the third party of SuperUser and so on should have to obtain interim su authority, also can specific implementation said method of the present invention.
Refer to Fig. 3, Fig. 3 is the structural representation of the another kind of mobile terminal that the embodiment of the present invention provides, the mobile terminal 200 of the present embodiment is for performing above-mentioned automatic test approach embodiment illustrated in fig. 1, the mobile terminal 200 of the present embodiment comprises processor 21, storer 22, receiver 23 and bus system 24, wherein:
Processor 21 controls the operation of mobile terminal 200, and processor 21 can also be called CPU (CentralProcessingUnit, CPU (central processing unit)).Processor 21 may be a kind of integrated circuit (IC) chip, has the processing power of signal.Processor 21 can also be general processor, digital signal processor (DSP, DigitalSignalProcessing), special IC (ASIC, ApplicationSpecificIntegratedCircuit), field programmable gate array (FPGA, Field-ProgrammableGateArray) or other programmable logic device (PLD), discrete gate or transistor logic, discrete hardware components.The processor etc. of general processor can be microprocessor or this processor also can be any routine.
Storer 22 can comprise ROM (read-only memory) and random access memory, and provides instruction and data to processor 21.A part for storer 22 can also comprise nonvolatile RAM (NVRAM).
Each assembly of mobile terminal 200 is coupled by bus system 24, and wherein bus system 24 is except comprising data bus, can also comprise power bus, control bus and status signal bus in addition etc.This bus system can be ISA (IndustryStandardArchitecture, industry standard architecture) bus, PCI (PeripheralComponentInterconnect, peripheral component interconnect) bus or EISA (ExtendedIndustryStandardArchitecture, extended industry-standard architecture) bus etc.Described bus can be one or more physical circuit, can be divided into address bus, data bus, control bus etc. when being many physical circuits.In some other embodiment of the present invention, processor 21, storer 22 and receiver 23 also directly can be connected by communication line.But for the purpose of clearly demonstrating, in the drawings various bus is all designated as bus system 24.
Storer 22 is for the system data of store electrons equipment.
Processor 21 receives recording operation instruction for controlling receiver 23, controls to record the operation of user in program to be tested.
Wherein, the operation of user in program to be tested comprises touch screen operation and keyboard operation etc.During specific implementation, processor 21 uses the library file of the record.so of a LinuxC language compilation reading/dev/input/eventX, is called in the application by the mode of JNI, realizes recording.
Wherein, after receiver 23 receives recording operation instruction, before the operation of user in program to be tested recorded by processor 21, processor 21 controls the internal memory loaded by recording library file into mobile terminal, carries out initialization to the recording destination file recorded in library file.
Particularly, recording library file record.so is loaded the internal memory into mobile terminal by processor 21, carries out initialization to the recording destination file recorded in library file record.so, and then starts to record.
During specific implementation initialization procedure, processor 21 is by intinit (); This function completes all initialization operations to event file, comprises the initialization to pollfd structure, the establishment etc. of some file directorys.Then by calling introbot_record (constchar*scriptFileName); This function is the function that specific implementation is recorded, and records the operation of user.
Processor 21 also for the operation of the user of recording in program to be tested being kept in the recording destination file of mobile terminal, and saves the data in storer 22 further.
Particularly, be kept in the sf file of running after fame with scriptFileName.In recording process, each events file of specifying of function introbot_record (constchar*scriptFileName) poll, obtains file type and inlet flow, and being sequentially written in file according to filename+inlet flow.
Wherein, processor 21, also for recording in the operating process of user in program to be tested, by receiving the instruction of interactive interface, controls the corresponding operation performing inquiry recording state and control recording process.
Wherein, processor 21 specifically can by calling RecordSateTypecheck_record_state (); This function is the equal of a tester, and outside can be called by interactive interface and be checked current recording state with superior function.Mobile terminal, according to the instruction of interactive interface, returns the state of the enumeration type of a RecordSateType.RecordSateType is a self-defining enumeration type, and the inside contains some states of recording process.
Further, processor 21 can also by calling intset_record_state (RecordSateTypestateType); This function is used for setting the state in recording process, to play the effect controlling recording process.Can set be such as-1 (STOP), to realize the effect stopping recording.
That is, when the present invention starts to record, processor 21 is this library file of controlled loading record.so first.Load in record.so and first can perform init () function after internal memory, perform initialized operation.Realized recording by robot_recrod (constchar*scriptFileName) after initialization completes, and be written in scriptFileName file and save, while recording, ceaselessly feed back current state to java layer by check_record_state (), java layer also can be controlled the process of recording by set_record_state (RecordSateTypestateType) according to the needs of tester.
Processor 21, also for when receiving playback and testing program to be tested, by playback script file, reads and records destination file.
Playback refers to reloads former test script, allows test machine perform playback test according to the content of script.Playback is exactly the inverse process of above-mentioned recording.
Processor 21 by receiver 23 receive playback test program to be tested time, by playback script file, start test.After startup, the Content Transformation of script file can become by mobile terminal automatically/and the form of dev/input/event file also writes the file of correspondence one by one, completes playback.
During specific implementation, processor 21, by using LinuxC language compilation one again to the library file of the replay.so of/dev/input/eventX writing in files, is called by the mode of JNI in the application, realizes playback function.
Wherein, processor 21, also for after receiving playback and testing program to be tested, by playback script file, reads before recording destination file, playback library file is loaded the internal memory into mobile terminal, carries out initialization to playback library file.
Particularly, processor 21 can pass through intinit (); This function completes all initialization operations to event file, comprises the initialization to pollfd structure, the initialization etc. of stat structure.
Wherein, processor 21 also starts program to be tested for controlling, and automatically performs playback test.
After processor 21 executes initialization, then by the playback script file after initialization, read recording destination file and carry out playback test.Particularly, processor 21 is by calling introbot_replay (constchar*scriptFileName); This function realizes the function of concrete playback script.Parameter s criptFileName is that the transmission of JAVA layer is got off, and specifies by it the script file needing playback.During playback, first this function carries out clear operation to timeval structure object, guarantees that content is up-to-date; Then script file is read, and according to the filename of script file, the document flow of correspondence is written to/dev/input/ under corresponding events file in, obtain the current time simultaneously, and input_event.time is set to current time value, be written in the lump in event file.Realize the conversion of form, complete playback.
Wherein, processor 21 also in startup program to be tested, automatically performs in playback test process, performs inquiry playback test mode and control the operation of playback test process by the instruction correspondence of interactive interface.
Particularly, processor 21 is by calling RepalySateTypecheck_replay_state (); This function is the equal of a tester, and mobile terminal can receive the instruction of the current playback state of inquiry by interactive interface.The state of the enumeration type of a RepalySateType is returned according to instruction.RepalySateType is a self-defining enumeration type, and the inside contains some states of replayed section.
Further, processor 21 can also control playback test process by calling intset_replay_state (RepalySateTypestateType), this function is used for setting the state in replayed section, to play the effect controlling playback process.Can set be such as-1 (STOP), to realize the function stopping playback.
That is, in the present invention, when starting playback, first the application program of java layer can load this library file of replay.so.Replay.so loads after internal memory, first can perform init () function, performs initialized operation.By robot_replayconstchar*scriptFileName after initialization completes) find the script file of specifying, write again after data in file are carried out format conversion/dev/input in, while playback, ceaselessly feed back current state to java layer by check_replay_state (), java layer also can be controlled the process of playback by intset_replay_state (RepalySateTypestateType) according to the needs of tester.
Wherein, said method of the present invention, first needs the file below reading/dev/input/ catalogue, and therefore, processor 21 is also for obtaining the root access limit of mobile terminal system.
Wherein, as a kind of concrete implementation, the embodiment of the present invention can obtain root authority by performing as issued orders:
adbshellsetpropro.secure0
adbshellsetpropro.debuggable1
adbshellsetpropro.allow.mock.location1
adbshellsetproppersist.sys.usb.configmtp,adb
adbshellsetpropro.adbsecure0
timeout/t2
adbshell/system/bin/setenforce0
timeout/t2
adbremount
Certainly, processor 21 also can use the third party of SuperUser and so on should have to obtain interim su authority, also can specific implementation said method of the present invention.
The method that the invention described above embodiment discloses can be applied in processor 21, or is realized by processor 21.In implementation procedure, each step of said method can be completed by the instruction of the integrated logic circuit of the hardware in processor 21 or software form.Can realize or perform disclosed each method, step and the logic diagram in the embodiment of the present invention.Step in conjunction with the method disclosed in the embodiment of the present invention directly can be presented as that hardware decoding processor is complete, or combines complete by the hardware in decoding processor and software module.Software module can be positioned at random access memory, flash memory, ROM (read-only memory), in the storage medium of this area maturations such as programmable read only memory or electrically erasable programmable storer, register.This storage medium is positioned at storer 22, and processor 21 reads the information in storer 22, completes the step of said method in conjunction with its hardware.
The mobile terminal that the above embodiment of the present invention provides and automatic test approach thereof, by mobile terminal being recorded the operation of user in program to be tested and being kept in the recording destination file of mobile terminal, when receiving playback and testing program to be tested, by playback script file, read and record destination file, start program to be tested, automatically perform playback test.By such mode, realize recording and the operation of replaying user in program to be tested at mobile terminal, thus can realize not needing dependence PC or other utility appliance just can realize the automatic test of mobile terminal based on UI.
The method of the above embodiment of the present invention, records (Record) test scene (script) in android terminal, then can at any time directly playback in the terminal (Playback) out, and capture test log.Above method of testing, use scenes is simple, does not have other requirements, also do not need to depend on the utility appliance such as other such as PC, directly operate on testing mobile terminal test environment.Less demanding to tester in addition, do not require that tester has script edit ability.Therefore, said method of the present invention can realize recording whenever and wherever possible and testing.
In several embodiment provided by the present invention, should be understood that, disclosed system, apparatus and method, can realize by another way.Such as, device embodiment described above is only schematic, such as, the division of described module or unit, be only a kind of logic function to divide, actual can have other dividing mode when realizing, such as multiple unit or assembly can in conjunction with or another system can be integrated into, or some features can be ignored, or do not perform.Another point, shown or discussed coupling each other or direct-coupling or communication connection can be by some interfaces, and the indirect coupling of device or unit or communication connection can be electrical, machinery or other form.
The described unit illustrated as separating component or can may not be and physically separates, and the parts as unit display can be or may not be physical location, namely can be positioned at a place, or also can be distributed in multiple network element.Some or all of unit wherein can be selected according to the actual needs to realize the object of the present embodiment scheme.
In addition, each functional unit in each embodiment of the present invention can be integrated in a processing unit, also can be that the independent physics of unit exists, also can two or more unit in a unit integrated.Above-mentioned integrated unit both can adopt the form of hardware to realize, and the form of SFU software functional unit also can be adopted to realize.
If described integrated unit using the form of SFU software functional unit realize and as independently production marketing or use time, can be stored in a computer read/write memory medium.Based on such understanding, the part that technical scheme of the present invention contributes to prior art in essence in other words or all or part of of this technical scheme can embody with the form of software product, this computer software product is stored in a storage medium, comprising some instructions in order to make a computer equipment (can be personal computer, server, or the network equipment etc.) or processor (processor) perform all or part of step of method described in each embodiment of the present invention.And aforesaid storage medium comprises: USB flash disk, portable hard drive, ROM (read-only memory) (ROM, Read-OnlyMemory), random access memory (RAM, RandomAccessMemory), magnetic disc or CD etc. various can be program code stored medium.
The foregoing is only embodiments of the invention; not thereby the scope of the claims of the present invention is limited; every utilize instructions of the present invention and accompanying drawing content to do equivalent structure or equivalent flow process conversion; or be directly or indirectly used in other relevant technical fields, be all in like manner included in scope of patent protection of the present invention.

Claims (10)

1. a mobile terminal automatic test approach, is characterized in that, described method comprises:
Receive recording operation instruction, record the operation of user in program to be tested;
The operation of the user of recording in program to be tested is kept in the recording destination file of described mobile terminal;
When receiving the described program to be tested of playback test, by playback script file, read described recording destination file;
Start described program to be tested, automatically perform playback test.
2. method according to claim 1, is characterized in that, described method also comprises:
Recording in the operating process of user in program to be tested, performing the described recording state of inquiry by the instruction correspondence receiving interactive interface and control the operation of recording process;
In the described program to be tested of described startup, automatically perform in playback test process, perform the described playback test mode of inquiry by the instruction correspondence of interactive interface and control the operation of described playback test process.
3. method according to claim 1, is characterized in that, after the instruction of described reception recording operation, before recording the operation of user in program to be tested, also comprises:
Recording library file is loaded the internal memory into described mobile terminal, initialization is carried out to the described recording destination file in described recording library file;
Described after receiving the described program to be tested of playback test, by playback script file, before reading described recording destination file, also comprise:
Playback library file is loaded the internal memory into described mobile terminal, initialization is carried out to described playback library file.
4. method according to claim 1, is characterized in that, receives recording operation instruction, before recording the operation of user in program to be tested, also comprises:
Obtain the root access limit of described mobile terminal.
5. method according to claim 1, is characterized in that, the operation of described user in program to be tested comprises touch screen operation and keyboard operation.
6. a mobile terminal, is characterized in that, described mobile terminal comprises records module, preservation module, read module and test module, wherein:
Described recording module, for receiving recording operation instruction, records the operation of user in program to be tested;
Described preservation module is for being kept in the recording destination file of described mobile terminal by the operation of the user of recording in program to be tested;
Described read module is used for, when receiving the described program to be tested of playback test, by playback script file, reading described recording destination file;
Described test module starts described program to be tested for controlling, and automatically performs playback test.
7. mobile terminal according to claim 6, it is characterized in that, described mobile terminal also comprises control module, described control module is for recording in the operating process of user in program to be tested, by receiving the instruction of interactive interface, control the corresponding operation performing the described recording state of inquiry and control recording process;
Described control module also in the described program to be tested of described startup, automatically performs in playback test process, by the instruction of interactive interface, controls the corresponding operation performing the described playback test mode of inquiry and control described playback test process.
8. mobile terminal according to claim 6, it is characterized in that, described mobile terminal also comprises initialization module, described initialization module is for after receiving recording operation instruction, before recording the operation of user in program to be tested, recording library file is loaded the internal memory into described mobile terminal, initialization is carried out to the described recording destination file in described recording library file; Or
Described initialization module also for described when receive playback test described program to be tested after, by playback script file, before reading described recording destination file, playback library file is loaded the internal memory into described mobile terminal, initialization is carried out to described playback library file.
9. mobile terminal according to claim 6, it is characterized in that, described mobile terminal also comprises acquisition module, and described acquisition module is used in the instruction of reception recording operation, before recording the operation of user in program to be tested, obtain the root access limit of described mobile terminal.
10. mobile terminal according to claim 6, is characterized in that, the operation of described user in program to be tested comprises touch screen operation and keyboard operation.
CN201510860131.1A 2015-11-30 2015-11-30 Mobile terminal and automatic test method Pending CN105512031A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510860131.1A CN105512031A (en) 2015-11-30 2015-11-30 Mobile terminal and automatic test method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510860131.1A CN105512031A (en) 2015-11-30 2015-11-30 Mobile terminal and automatic test method

Publications (1)

Publication Number Publication Date
CN105512031A true CN105512031A (en) 2016-04-20

Family

ID=55720032

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510860131.1A Pending CN105512031A (en) 2015-11-30 2015-11-30 Mobile terminal and automatic test method

Country Status (1)

Country Link
CN (1) CN105512031A (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106844883A (en) * 2016-12-29 2017-06-13 北京华大九天软件有限公司 It is a kind of that the method that interface is tested automatically is carried out by script
CN108415827A (en) * 2018-01-23 2018-08-17 阿里巴巴集团控股有限公司 Using automatic processing method, device, client and system
CN108874696A (en) * 2017-12-29 2018-11-23 哈尔滨安天科技股份有限公司 Automatic test approach, device and the electronic equipment of more legal power safety storage equipment
CN109062816A (en) * 2018-10-12 2018-12-21 广东电网有限责任公司 A kind of method, device and equipment of software test
CN109684196A (en) * 2018-11-01 2019-04-26 北京中清龙图网络技术有限公司 A kind of test method and device
CN110221983A (en) * 2019-06-19 2019-09-10 深圳市腾讯网域计算机网络有限公司 Test method, device, computer readable storage medium and computer equipment

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103970649A (en) * 2013-01-31 2014-08-06 腾讯科技(深圳)有限公司 Test method and device for Android terminal application programs
CN104008047A (en) * 2013-02-27 2014-08-27 腾讯科技(深圳)有限公司 Intelligent terminal program testing method and system
CN104572447A (en) * 2014-12-19 2015-04-29 中国电子科技集团公司第十五研究所 Method and system for business process recording and replaying based on Android operation system

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103970649A (en) * 2013-01-31 2014-08-06 腾讯科技(深圳)有限公司 Test method and device for Android terminal application programs
CN104008047A (en) * 2013-02-27 2014-08-27 腾讯科技(深圳)有限公司 Intelligent terminal program testing method and system
CN104572447A (en) * 2014-12-19 2015-04-29 中国电子科技集团公司第十五研究所 Method and system for business process recording and replaying based on Android operation system

Cited By (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106844883A (en) * 2016-12-29 2017-06-13 北京华大九天软件有限公司 It is a kind of that the method that interface is tested automatically is carried out by script
CN108874696A (en) * 2017-12-29 2018-11-23 哈尔滨安天科技股份有限公司 Automatic test approach, device and the electronic equipment of more legal power safety storage equipment
CN108415827A (en) * 2018-01-23 2018-08-17 阿里巴巴集团控股有限公司 Using automatic processing method, device, client and system
CN108415827B (en) * 2018-01-23 2021-07-09 创新先进技术有限公司 Application automation processing method, device, client and system
CN109062816A (en) * 2018-10-12 2018-12-21 广东电网有限责任公司 A kind of method, device and equipment of software test
CN109684196A (en) * 2018-11-01 2019-04-26 北京中清龙图网络技术有限公司 A kind of test method and device
CN109684196B (en) * 2018-11-01 2024-01-09 北京中清龙图网络技术有限公司 Test method and device
CN110221983A (en) * 2019-06-19 2019-09-10 深圳市腾讯网域计算机网络有限公司 Test method, device, computer readable storage medium and computer equipment
CN110221983B (en) * 2019-06-19 2024-01-16 深圳市腾讯网域计算机网络有限公司 Test method, test device, computer readable storage medium and computer equipment

Similar Documents

Publication Publication Date Title
CN105512031A (en) Mobile terminal and automatic test method
CN104063305A (en) Pressure testing method, device and system for intelligent terminal software
CN110046479B (en) Link library file anti-debugging method and device based on android operating system
US20120297178A1 (en) Configuration mode switching system and method
US9645911B2 (en) System and method for debugging firmware/software by generating trace data
US20070247430A1 (en) Keyboard and mouse operation data recording/reproducing system and method thereof
US20080021693A1 (en) Storage Device Simulator
CN108804300A (en) Automated testing method and system
CN111338925A (en) Applet test method, device and system, electronic equipment and storage medium
CN104503772A (en) Operating system installation and test environment establishment method and device based on virtual machine
CN102169390B (en) Information terminal and touch control method thereof
CN115658529A (en) Automatic testing method for user page and related equipment
US8086834B2 (en) System and method for populating a dedicated system service repository for an information handling system
CN102214105B (en) Parallelization quick start method and the electronic installation with multiplied unit
CN100576187C (en) A kind of exploitation adjustment method and system of application program
CN113032246A (en) SSD (solid State disk) firmware operation method and device, readable storage medium and electronic equipment
CN115422091B (en) Firmware debugging method and device, electronic equipment and storage medium
CN112463574A (en) Software testing method, device, system, equipment and storage medium
CN111124773A (en) Batch volume IO read-write test method, system and equipment based on vdbech
CN114253781B (en) Test method, device, equipment and storage medium
CN113342702B (en) Application program testing method, device, equipment and readable storage medium
CN113064833A (en) Single chip microcomputer simulation method, system, device, equipment and storage medium
CN102750167A (en) Method and device for starting application program and computer system
CN113672465A (en) Method, system, medium, terminal and unmanned aerial vehicle for generating process log system by process name
CN108984238A (en) Gesture processing method, device and the electronic equipment of application program

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20160420