【Background technology】
Automatized script Programming with Pascal Language is often used in automated testing method to realize test measurand, due to tested pair
As varied, generally require to be extended the order of automatized script language.The automatized script language of mainstream is all at present
The expansion interface i.e. API of C language is provided, C language programming can be used to realize the extension of order.If publication date is 2009 4
The moon 1, the patent document that number of patent application is 200710161587.4 realize automatized script language:The order of TCL language
Extended method, to extend the function of TCL scripts.
The existing method for being extended order by the API of script is bound with script itself, identical
Function, different scripts needs according to respective method to write different explosion commands to realize, brings overlapping development
Efficiency.Moreover, a part of the explosion command as script analysis program, when expanded function when something goes wrong, can cause
Script resolver is run unstable, to influence the execution of automatized script.
【Invention content】
The technical issues of present invention need to solve is to overcome the shortcomings of above-mentioned, provides a kind of nonexpondable script of primary development
The extended method of language.
In order to solve the above technical problems, the present invention devises a kind of extended method of script comprising following step
Suddenly:
step1:To meet the needs of automatic test, the order of automatized script is extended, specifies an extension
The title of order;
step2:Using the client of one support XML-RPC agreement of scripting language, in the client using extension
The title of order and the format of defined parameters.
step3:A server end is write, XML-RPC server ends interface and addition are defined in server end and is expanded
Corresponding expansion module is ordered in exhibition, and XML-RPC server end interfaces include the IP address of the computer where server end, socket
The analysis mode of port and command parameter.
step4:When Run Script program, when running to the explosion command, by client by the title of explosion command and
Parameter is sent to server end according to the format defined by XML-RPC agreements, and XML-RPC server end interfaces arrive
Explosion command and parameter are parsed later, according to the analysis mode of the command parameter predefined, call corresponding extension
Module is executed, and expansion module is calculated, and after being finished, result of calculation is returned to visitor by XML-RPC agreements
Family end, client returns result to explosion command again, and after explosion command returns, explosion command execution terminates.
Compared with prior art, the present invention in, the expansion module of the explosion command of perform script language independently is realized, with show
Have different from script binding;After server end realizes expansion module, XML- can be passed through in various scripts
RPC interfaces call, and reach the nonexpondable function of primary development.Expansion module concentrates on server end and is implemented separately and script
Analysis program is run independently of each other, and expansion module goes wrong, and does not influence the operation of script other parts function.
It is transported moreover, the server end and script that are extended using the present invention execute to be located on different computers
Row, realize Distributed Calculation, can by script than it is relatively time-consuming or consumption resource extension calculate other performances more
The characteristics of carrying out operation on good server, make full use of Distributed Calculation improves the performance of automation platform, meets complicated ring
The requirement in border.
【Specific implementation mode】
The invention will be further described with embodiment below in conjunction with the accompanying drawings.
The present invention provides a kind of extended methods of script, can support a variety of automatized scripts.Work as automatized script
The function that the order of language provides cannot meet when needing of automatic test, need to be extended the order of script.
The method of the present invention uses one client of scripting language, a server end is write with other programming languages, in server
Corresponding expansion module is added on end to realize function that needs extend, client and server end passes through XML-RPC(XML
Remote Procedure Call, i.e. XML remote method call)Agreement is communicated.Being executed in automatized script language should
When explosion command, it will be ordered by client and parameter send server end to, server end is parsed, by expansion module
Calculating after, result of calculation is returned into client, client returns result to the order after receiving, order, which executes, to be terminated
It returns the result.
The extended method of script of the present invention, specific steps are as follows:
step1:To meet the needs of automatic test, the order of automatized script is extended, specifies an extension
The title of order;
step2:Using the client of one support XML-RPC agreement of scripting language, in the client using extension
The title of order and the format of defined parameters.
step3:A server end is write, XML-RPC server ends interface and addition are defined in server end and is expanded
Corresponding expansion module is ordered in exhibition, and XML-RPC server end interfaces include the IP address of the computer where server end, socket
The analysis mode of port and command parameter.
step4:As shown in Figure 1, working as Run Script program, when running to the explosion command, extension is ordered by client
The title and parameter of order are sent to server end, XML-RPC server ends according to the format defined by XML-RPC agreements
Interface parses explosion command and parameter after, according to the analysis mode of the command parameter predefined, calls
Corresponding expansion module is executed, and expansion module is calculated, and after being finished, result of calculation is assisted by XML-RPC
View returns to client, and client returns result to explosion command again, and after explosion command returns, which executes knot
Beam,.
The present invention, as the agreement communicated between automation language scripts and expansion module, is being expanded using XML-RPC agreements
The explosion command that script is realized in module is opened up, the result of calculation that expansion module generates is returned by XML-RPC communications protocol
Back to script, the extension and distributed execution, this method that realize script order extend the function of script,
Adapt to the automatized script exploitation of mainstream.
The advantage of the invention is that:
1, versatility:The expansion module for the script that this method carries out can be docked with a variety of scripts, real
Now across the feature of script, a variety of scripts are supported.
2, manageability:For expansion module on backstage based on unified management, can improve program operation efficiency and
Robustness.
3, scalability is strong, and the extension of function module need to only be executed in server end, and current most programming language is equal
It supports XML-RPC agreements, the characteristic for the language grasped can be made full use of to be designed.
Above-described is only embodiments of the present invention, it should be noted here that for those of ordinary skill in the art
For, without departing from the concept of the premise of the invention, improvement can also be made, but these belong to the protection model of the present invention
It encloses.