Summary of the invention
In order to overcome the weak point of the prior art of above-mentioned indication, the invention provides a kind of playback tempo control method and system of test script, be intended to improve testing efficiency and accurate testing degree, reduce the interference causing because of script playback time slot.
The present invention is achieved by the following technical solutions:
A playback tempo control method, comprise the following steps:
S1, test terminal are when carrying out script playback, and open system status monitoring is served;
S2, test terminal receive after an operational order of wscript.exe transmission, and decision instruction type and corresponding project to be measured are carried out described operational order simultaneously;
S3, system state monitoring service monitoring are after the expection variation of project to be measured, and the feedback information that operational order is finished is back to wscript.exe, then receives next operational order until script playback completes.
In the playback tempo control method of test script of the present invention, the type of described operational order comprises clicking operation, long by operation, word input operation, physical button operation, slide.The project to be measured that described operational order is corresponding comprises one or both or three kinds in control state, Activity state, word state.
Further, described step S3 comprises:
The current variation of S31, system state monitoring service monitoring project to be measured, comprises one or both or three kinds in monitoring current control state, current Activity state, current word state;
Whether the current variation of the project to be measured of S32, judgement monitoring gained the follow-up variation of associated project to be measured, if so, continues the follow-up variation of monitoring project to be measured, otherwise directly performs step S33;
S33, the feedback information that operational order is finished are back to wscript.exe, then receive next operational order until script playback completes.
Further, the playback tempo control method of test script of the present invention also comprises: S4, wscript.exe receive after the feedback information that operational order is finished, judge whether script playback completes, if, to system state monitoring service, send script playback and complete order, system state monitoring end of service, otherwise send next operational order.
The present invention also provides a kind of playback tempo control system of test script, comprising:
Preparation module, for test terminal when carrying out script playback, open system state monitoring module;
Instruction analysis and execution module, receive for test terminal after an operational order of wscript.exe transmission, and decision instruction type and corresponding project to be measured are carried out described operational order simultaneously;
System state monitoring module, for monitoring the variation of project to be measured;
Feedback module, for monitoring after the expection variation of project to be measured, the feedback information that operational order is finished is back to wscript.exe, then receives next operational order until script playback completes.
In the playback tempo control system of test script of the present invention, the type of described operational order comprises clicking operation, long by operation, word input operation, physical button operation, slide.The project to be measured that described operational order is corresponding comprises one or both or three kinds in control state, Activity state, word state.
Further, described system state monitoring module comprises:
Current state monitoring means, for monitoring the current variation of project to be measured, comprises one or both or three kinds in monitoring current control state, current Activity state, current word state;
Succeeding state monitoring means, for judging the whether follow-up variation of associated project to be measured of current variation of the project to be measured of monitoring gained, if so, continues the follow-up variation of monitoring project to be measured, otherwise directly starts feedback module.
Further, the playback tempo control system of test script of the present invention also comprises: stop monitoring modular, for wscript.exe, receive after the feedback information that operational order is finished, judge whether script playback completes, if, to system state monitoring module, send script playback and complete order, termination system state monitoring module, otherwise send next operational order.
Compared with prior art, the present invention is by the state variation of control and measuring terminal, control the playback progress of directive script, the script playback mode that is different from existing fixedly time slot, has very strong adaptability, can automatically control playback speed according to the real time status of test terminal, intelligently test script is carried out to playback, the interference that minimizing causes because of playback time slot, has guaranteed the accuracy of playback when improving testing efficiency, directly improved the precision of test report.
Embodiment
For the ease of those skilled in the art's understanding, below in conjunction with drawings and Examples, the invention will be further described.
A playback tempo control method, comprise the following steps:
S1, test terminal are when carrying out script playback, and open system status monitoring is served;
S2, test terminal receive after an operational order of wscript.exe transmission, and decision instruction type and corresponding project to be measured are carried out described operational order simultaneously;
S3, system state monitoring service monitoring are after the expection variation of project to be measured, and the feedback information that operational order is finished is back to wscript.exe, then receives next operational order until script playback completes.
Activity is an assembly of being responsible for user interactions, and in Activity, all operations is all closely related with user, can show appointment control by setContentView (View).In android application, an Activity is exactly an independent screen conventionally, can show that some controls also can monitor and process user's event and make response above it.
In step S1, when test terminal starts playback script, open system state monitoring service, this serves Activity state variation, control state variation, word state variation of main monitoring system etc.
In step S2, when playback instrument sends an operational order (as button click, open application, slip screen etc.) to test terminal, the type that system state monitoring service judgement is current sent instructions, according to the instruction type judgement sending, need the project to be measured of monitoring (as button click, system state monitoring service need to be monitored control state variation and Activity state variation simultaneously), simultaneity factor is carried out this operational order.The operational order of button click of take is example, when the operational order of system state monitoring service detection to the button click of playback instrument transmission, judge that it is clicking operation type, and start to detect control state variation, Activity state variation, simultaneity factor is carried out the operation of button click.In the present invention, the type of described operational order includes but not limited to clicking operation, long by operation, word input operation, physical button operation, slide.The project to be measured that described operational order is corresponding can comprise one or both or three kinds in control state, Activity state, word state.
Further, described step S3 comprises:
The current variation of S31, system state monitoring service monitoring project to be measured, comprises one or both or three kinds in monitoring current control state, current Activity state, current word state;
Whether the current variation of the project to be measured of S32, judgement monitoring gained the follow-up variation of associated project to be measured, if so, continues the follow-up variation of monitoring project to be measured, otherwise directly performs step S33;
S33, the feedback information that operational order is finished are back to wscript.exe, then receive next operational order until script playback completes.
In step S3, system state monitoring service is monitored for project to be measured, when project generation to be measured variation in line being detected, also can judge whether that the follow-up variation that can cause project to be measured occurs (as when Activity state variation being detected according to its current variable condition, whether loaded) if also needing further to monitor next Activity interface, if can cause follow-up variation, continue to wait for that this follow-up variation occurs, to monitoring after the follow-up variation of Activity state, the feedback information just this operational order being finished is sent to wscript.exe, if can not cause that succeeding state occurs, the feedback information that system state monitoring service is finished this operational order is so sent to wscript.exe, wscript.exe receives after the feedback information that instruction is finished, continue to send next instruction to test terminal, so repeatedly, until script be finished.Take button click operational order as example, and after system is carried out click push-botton operation, there is variation to Activity state in system state monitoring service detection, and further judge whether Activity state variation can cause that succeeding state changes.The Activity state relation completing due to the current variation of Activity state and follow-up loading, therefore, when Activity state variation being detected, need further monitoring Activity interface whether to load, the follow-up variation of Activity state is monitored, to monitoring after the follow-up variation of Activity state, the feedback information just this operational order being finished is sent to wscript.exe.Following table 1 provides instruction type the to be measured project that need monitoring corresponding with it.
| Instruction type |
Project to be measured |
| Clicking operation |
Control state, Activity state |
| Long by operation |
Control state, Activity state |
| Word input operation |
Word state |
| Physical button operation |
Control state, Activity state |
| Slide |
Control state |
Form 1
Further, the playback tempo control method of test script of the present invention also comprises: S4, wscript.exe receive after the feedback information that operational order is finished, judge whether script playback completes, if, to system state monitoring service, send script playback and complete order, system state monitoring end of service, otherwise send next operational order.When wscript.exe receives after the feedback information that operational order is finished, after judgement present instruction playback completes, judge whether this present instruction also has subsequent instructions, continues to send to test terminal if having, otherwise finish playback; Wscript.exe sends it back to system state monitoring service after the order discharging, this system state monitoring service auto-destruct.
Test terminal in the present invention comprises the intelligent terminals such as smart mobile phone, panel computer.The playback tempo control method flow process that the invention also discloses the test script of a kind of embodiment, as shown in Figure 1, comprises the following steps:
S101, the service of open system status monitoring, start playback script;
S102, wscript.exe send an operational order to test terminal;
S103, test terminal receive operational order, and decision instruction type is clicking operation;
Described operational order is carried out in S104, test terminal;
The current variation that S105, system state monitoring service monitoring arrive project to be measured, comprises control state variation and Activity state variation;
Whether the current variation of the project to be measured of S106, judgement monitoring gained the follow-up variation of associated project to be measured, if so, performs step S107, otherwise directly performs step S108;
S107, continue to monitor after the follow-up variation of project to be measured execution step S108;
S108, the feedback information that operational order is finished are back to wscript.exe;
S109, wscript.exe receive after the feedback information that operational order is finished, judge whether script playback completes, be i.e. after current operation instruction, whether also have subsequent instructions, if, execution step S110, continues to send next operational order to test terminal otherwise return to step S102;
S110, wscript.exe send script playback to system state monitoring service and complete order;
S111, system state monitoring service auto-destruct.
The present invention also provides a kind of playback tempo control system of test script, as shown in Figure 2, comprising:
Preparation module 21, for test terminal when carrying out script playback, open system state monitoring module;
Instruction analysis and execution module 22, receive for test terminal after an operational order of wscript.exe transmission, and decision instruction type and corresponding project to be measured are carried out described operational order simultaneously;
System state monitoring module 23, for monitoring the variation of project to be measured;
Feedback module 24, for monitoring after the expection variation of project to be measured, the feedback information that operational order is finished is back to wscript.exe, then receives next operational order until script playback completes.
In the playback tempo control system of test script of the present invention, the type of described operational order includes but not limited to clicking operation, long by operation, word input operation, physical button operation, slide.The project to be measured that described operational order is corresponding can comprise one or both or three kinds in control state, Activity state, word state.
Further, described system state monitoring module 23 comprises:
Current state monitoring means 231, for monitoring the current variation of project to be measured, comprises one or both or three kinds in monitoring current control state, current Activity state, current word state;
Succeeding state monitoring means 232, for judging the whether follow-up variation of associated project to be measured of current variation of the project to be measured of monitoring gained, if so, continues the follow-up variation of monitoring project to be measured, otherwise directly starts feedback module.
Further, the playback tempo control system of test script of the present invention also comprises: stop monitoring modular 25, for wscript.exe, receive after the feedback information that operational order is finished, judge whether script playback completes, if, to system state monitoring module, send script playback and complete order, termination system state monitoring module, otherwise send next operational order.
Above content is in conjunction with concrete optimal way further description made for the present invention, should not assert that specific embodiment of the invention is confined to above explanation.For those skilled in the art, without departing from the inventive concept of the premise, can also make some simple deduction or replace, within the definite protection domain of the claim that all should be considered as being submitted to by the present invention.