[summary of the invention]
Technical matters to be solved by this invention is to provide the functional test from embedded system to start with, and can satisfy the method for automatically testing recording playback mode of terminal system of functional test of the agreement such as RDP, ICA, Telnet of embedded system.
The present invention solves the problems of the technologies described above by the following technical programs: a kind of method for automatically testing recording playback mode of terminal system comprises the following step of carrying out successively:
Step 10: the practical operation to the user is recorded, and this practical operation comprises mouse action, and keyboard operation generates the script that the user understands easily then automatically, but the script edit;
Step 20: in the process thatstep 10 is recorded, insert the checkpoint, need check the state of this point when testing automatically;
Step 30:, and automatically perform test, the state of record check point with the script playback ofstep 10 generation;
Step 40: the script playback finishes, and the checkpointed state of record is analyzed, and gathered test result, generates test report automatically.
This invention further is specially:
Describedstep 10 specifically comprises the following step of carrying out successively:
Program starts fromstep 102;
Step 104: the user begins practical operation, records, and when the user operated object, each service end all will produce corresponding window events, uses the change of this window events in client notification application user interface;
Step 106: service end send window incident is given client;
Step 108: client terminal start-up event notice hook in the time of execution instep 104, monitor service end send window incident is given the window events notice of client, client is by the window events of event notice hook selective reception, and the incident of selecting handled accordingly, the information of the service end of obtaining by object interface entersstep 110 andstep 112 simultaneously;
Step 110: generation script enters step 114 then;
Step 112: generate and hint obliquely at file, enter step 114 then;
EOP (end of program) is in step 114.
In the describedstep 106, specifically comprise the steps: service end send window incident, give all interested clients with the window events notification broadcast, service end will be called the event notice function, and the information of transmission identified event type and the UI element of this incident of application, client can use this information to retrieve an object of UI element, and collects more information.
In the describedstep 108, when the condition of appointment is mated in the generation of incident, service end will be called the call back function of client, and this moment, the customer end adopted call back function received event notice, and processing events.
Describedstep 112 specifically comprises the steps: to obtain the object interface that sends the window events notice in the call back function of window events hook, and obtains the attribute of object, these attributes is passed to generate mapped file in the mapping generator.
Described mapped file has comprised the details of object and the sequence number of object.
Describedstep 110 specifically comprises the steps: in the call back function of window events hook, obtain the object interface that sends the window events notice, and obtain the attribute of object, the operation that these attributes are reached object is sent in the script generator equally, and script generator is realized the generation and the output of script sentence.
Two kinds of scenario generation methods have been adopted in the generation of described script sentence: linear scenario generation method and key word drive scenario generation method.
Describedstep 30 specifically comprises the following step of carrying out successively:
Step 302: the script resolver parses script sentence from script file, analyzes each component of script sentence, as control title and sequence number, and event type or the like relevant information;
Step 304: mapping resolver the control title that obtains from script sentence and sequence number find this control in mapped file the detailed attributes information and the unique identification of control;
Step 306: with the unique identification of control, the operation that the attribute information of control reaches control passes to the event replay device, the event replay device finds the interface of control according to the unique identification of control, and according to the operation of control control is sent corresponding operation information, the attribute checkpoint that can insert control simultaneously;
Step 308: simulating keyboard and mouse input, the control when running into incomplete support windows messaging and interface method can adopt the input of simulating keyboard and mouse;
EOP (end of program) is instep 310.
Describedstep 40 specifically comprises the following step of carrying out successively:
Step 402: record current time in system during test run, operator and testing total working time;
Step 404: when the script playback was failed, misregistration information can navigate to the position of script;
Step 406: the check-up through statistical means dotted state, when checkpoint verification is failed, misregistration information, and record expection and actual result's contrast;
Step 408: the time of adding up state, operation result and the operation of every script operation;
Step 410: show the last test result: success or failure;
Step 412: the form of above-mentioned test result with text shown, and distinguished, support print result with certain color.
The advantage of the method for automatically testing recording playback mode of terminal system of the present invention is: because this method is based on showing that the control operation realizes automatic test, and and operating system independent, so applicable to terminal embedded type system, also go for the automation function test of non-embedded system; Adopt automatic generation script mode, the operation of test exists with the form of script, provides strong checkpoint for test result simultaneously; ICA, RDP are based on the host-host protocol of image, the image resource of server is delivered to the client use in the mode of detecing, and this method is the image resource of server to be delivered to client in the mode of detecing use, and this method also is based on demonstration control realization automation mechanized operation, so this method of testing is supported the test of protocol functions such as ICA, RDP; Test for the GUI function provides reliable checkpoint; The function automatic test can be saved the time of test, the mistake of avoiding manual test to cause, thus shortened cycle of developing and the quality of having guaranteed product.
[embodiment]
See also Fig. 1, the method for automatically testing recording playback mode of terminal system of the present invention comprises the following step of carrying out successively:
Step 10: the practical operation to the user is recorded, and this practical operation comprises mouse action, and keyboard operation generates the script that the user understands easily then automatically, but the script edit;
Step 20: in the process thatstep 10 is recorded, insert the checkpoint, need check the state of this point when testing automatically;
Step 30:, and automatically perform test, the state of record check point with the script playback ofstep 10 generation;
Step 40: the script playback finishes, and the checkpointed state of record is analyzed, and gathered test result, generates test report automatically.
See also Fig. 2, describedstep 10 specifically comprises the following step of carrying out successively:
Program starts fromstep 102.
Step 104: the user begins practical operation, record, when the user operates object, each object/window (also claiming service end) all will produce corresponding window events (WinEvent), use the change of this window events in client notification application user interface, for example, create and the deployment object, perhaps change title, state or the value of UI element;
Step 106: service end send window incident is given client;
Step 108: client terminal start-up event notice hook (WindowsHook) in the time of execution instep 104, monitor service end send window incident is given the window events notice of client, client is by the window events of event notice hook selective reception, and the incident of selecting handled accordingly, the information of the service end of obtaining by object interface entersstep 110 andstep 112 simultaneously;
Step 110: generation script enters step 114 then;
Step 112: generate mapped file, enter step 114 then;
EOP (end of program) is in step 114.
In the describedstep 106, specifically comprise the steps: service end send window incident, give all interested clients with the window events notification broadcast, service end will be called the event notice function, and the information of transmission identified event type and the UI element of this incident of application, client can use this information to retrieve an object of UI element, and collects more information.
In the describedstep 108, during client receive window incident, according to the difference of tested object, the user can oneself remove the selective reception validity event, and following several selection is arranged: receive all incidents or one group of special event; Reception is from the incident of all threads or certain particular thread; Reception is from the incident of all processes or certain specific process; In the treatment progress or the outer incident of process.
When the condition of appointment is mated in the generation of incident, service end will be called the call back function of client, and this moment, the customer end adopted call back function received event notice, and processing events.
Describedstep 112 specifically comprises the steps:
In the call back function of window events hook, obtain the object interface that sends the window events notice, and obtain title, the type of object ... Deng attribute, these attributes are passed to generate mapped file in the mapping generator.
Mapped file is shape such as F={{N, V, R, S, L, D, K, A, P, C ..., the set of n}}, N title wherein, the V value, R role, the S state, the L position, D describes, K shortcut, A default-action, P parent window, C class, n sequence number etc.File structure has comprised the details of object and the sequence number of object.
Object uniquely identified method: at first activate the window at object place, for the object of the same window, by " role-name " identification, and when running into similar object of the same name, discern by the formation object sequence number again, sequence number adds 1 successively since 0.
Describedstep 110 specifically comprises the steps:
In the call back function of window events hook, obtain the object interface that sends the window events notice, and obtain title, the type of object ... Deng attribute, the operation that these attributes are reached object is sent in the script generator equally, and script generator is realized the generation and the output of script sentence.
Linear scenario generation method is adopted in the generation of described script sentence.
Linear scenario generation method: linear script is the script that obtains when recording the test of carrying out by hand, and this linear script comprises the operating key of all keystrokes, function key, control testing software and the numerical key of input data etc.The object sequence number of this incident of reception that finds with the attribute of the incident recorded and object and from mapped file is converted into script sentence, and every script sentence all tackles it current window is set, and makes things convenient for the application of script playback in thestep 30.
The type of inserting the checkpoint in thestep 20 comprises following several:
Text checkpoint: can obtain that the checkpoint is caught and the value of letter, literal and numeral relatively from single file or Multiline Edit frame and other objects.Comprise CheckBox, Generic GroupBox, Label, PushButton, RadioButton, ToolBar, Window etc.;
Object data checkpoint: the data in the object are verified;
Object properties checkpoint: after adding this type of checkpoint, will demonstrate the tabulation of captive object and respective attributes thereof, from the tabulation of object, select to want the attribute of checking then;
Bitmap checkpoint: can analyze contrast screen and screen area image;
There is the checkpoint in window: whether window is occurred verifying as expection;
Audio frequency checkpoint: the audio frequency that expection occurs is verified.
See also Fig. 3, describedstep 30 specifically comprises the following step of carrying out successively:
Step 302: the script resolver parses script sentence from script file, analyzes each component of script sentence, as control title and sequence number, and event type or the like relevant information;
Step 304: mapping resolver the control title that obtains from script sentence and sequence number find this control in mapped file the detailed attributes information and the unique identification of control;
Step 306: with the unique identification of control, the operation that the attribute information of control reaches control passes to the event replay device, the event replay device finds the interface of control according to the unique identification of control, and according to the operation of control control is sent corresponding operation information, the attribute checkpoint that can insert control simultaneously;
Step 308: simulating keyboard and mouse input, when the control that runs into incomplete support windows messaging and interface mode, can adopt the input of simulating keyboard and mouse, the GUI control generally has two kinds, a kind of control can be supported Windows directly to send out message to control, or Windows has and provides the interface function of this control to control, we will operate this control by Automatic Program, only need find the unique identification of this control accurately, and send message or call the interface function that Windows provides at its, another control is not supported windows messaging and interface mode, and keyboard and mouse are as input mode, can only simulating keyboard and the operation of mouse, could operate this control by Automatic Program, carried out clicking operation as mouse at so-and-so coordinate of screen, this operation has been recorded in the script, directly carried out when move next time by this operation;
EOP (end of program) is instep 310.
See also Fig. 4, describedstep 40 specifically comprises the following step of carrying out successively:
Step 402: record current time in system during test run, operator and testing total working time;
Step 404: when the script playback was failed, misregistration information can navigate to the position of script;
Step 406: the check-up through statistical means dotted state, when checkpoint verification is failed, misregistration information, and record expection and actual result's contrast;
Step 408: the time of adding up state, operation result and the operation of every script operation;
Step 410: show the last test result: success or failure;
Step 412: the form of above-mentioned test result with text shown, and distinguished, support print result with certain color.
Though more than described the specific embodiment of the present invention; but being familiar with those skilled in the art is to be understood that; our described specific embodiment is illustrative; rather than be used for qualification to scope of the present invention; those of ordinary skill in the art are in the modification and the variation of the equivalence of doing according to spirit of the present invention, all should be encompassed in the scope that claim of the present invention protects.