Summary of the invention
In view of the above problems, it proposes on the present invention overcomes the above problem or at least be partially solved in order to provide one kind
The test method and device based on customized test script of problem are stated, required for realizing that user customizes itself according to self-demand
Script, substantially increase the ease for use of measuring device.
The present invention provides a kind of test methods based on customized test script, comprising:
The parameter configuration is dynamically loaded into C# exploitation software by the parameter configuration that test case is described based on Json document
In user interface;
The instruction that user modifies the parameter configuration is received by the user interface, and according to described instruction to institute
The parameter information for stating test case is modified;
It provides the corresponding IronPython test case script of the test case to edit for user, according to the use received
The instruction of the customized modification in the family IronPython test case script, repairs IronPython test case script
Change;
The test case parameter information is transmitted to the IronPython by test case enforcement engine and tests case script;
It is described to execute that the IronPython test case script is executed according to the test case parameter information received
Test case.
Optionally, the instruction that the parameter configuration is modified by user interface reception user, and according to
Described instruction modifies to the parameter information of the test case, comprising:
The script file under the catalogue of the current program for executing test is searched, traversal reads the script file
Under preset test case Json file, obtain the test case information and test case parameter information in the Json file;
According to the name information of the test case in the test case information, the test case is successively added to test case column
In table;
The instruction that user modifies the parameter configuration is received by user interface, and is modified respectively according to described instruction
Test case parameter information in Json file simultaneously saves.
Optionally, increase control for the test case parameter information dynamic in the corresponding Json file of each test case, and initial
Change the control;
The instruction that user modifies the parameter configuration is received by the control in the user interface, according to the finger
It enables and modifies the test case parameter information and save.
Optionally, the finger of the user that the basis the receives customized modification IronPython test case script
It enables, modifies to IronPython test case script, comprising:
Any one test case is chosen in the test case list;
The corresponding Json file of the test case is searched and chosen under the Script file, according to the Json text
Part is searched and obtains corresponding IronPython test case script;
According to the instruction of the user received the customized modification IronPython test case script, to described
IronPython test case script is modified.
Optionally, described to be searched under the Script file and choose the corresponding Json file of the test case, root
According to the Json file search and obtain corresponding IronPython test case script, comprising:
It is searched under the Script file and chooses the corresponding Json file of the test case, in the Json file
The middle method attribute value read under measureItem;
According to the method attribute value, is searched in method file and obtain the entitled method attribute of file
Value extends the IronPython test case script of entitled py.
Optionally, the test case parameter information that the basis receives executes the IronPython and tests case script
To execute the test case, comprising:
It is communicated by the communication interface that C# is encapsulated with measurement module, equipment under test;
According to the test case parameter information received, the measurement module is controlled to described by the communication interface
Equipment under test executes the IronPython test case script and is measured with executing the test case, and reads measurement data.
Optionally, the communication interface that the IronPython test case script encapsulate by C# and measurement module are tested and set
After being communicated, further includes:
The connection status of the measurement module Yu the equipment under test is verified by the communication interface that the C# is encapsulated;
Determine the state between the measurement module and the equipment under test for connection.
Optionally, described that the test case parameter is transmitted to by the IronPython test case by test case enforcement engine
Before script, further includes:
The running environment that the IronPython tests case script is initialized by the test case enforcement engine.
According to another aspect of the present invention, a kind of test device based on customized test script is additionally provided, comprising:
Loading module, suitable for describing the parameter configuration of test case based on Json document, by the parameter configuration dynamically load
Into the user interface of C# exploitation software;
First modified module, suitable for receiving the instruction that user modifies the parameter configuration by the user interface,
And it is modified according to parameter information of the described instruction to the test case;
Second modified module is adapted to provide for the corresponding IronPython test case script of the test case and compiles for user
Volume, according to the instruction of the user received the customized modification IronPython test case script, to described
IronPython test case script is modified.
Transmission module, suitable for the test case parameter information is transmitted to the IronPython by test case enforcement engine
Test case script;
Execution module, suitable for executing the IronPython test case foot according to the test case parameter information received
This is to execute the test case.
According to a further aspect of the invention, a kind of computer storage medium, the computer storage medium are additionally provided
It is stored with computer program code, when the computer program code is run on the computing device, leads to the calculating equipment
Execute the test method described in any of the above embodiments based on customized test script.
The present invention provides a kind of test method and device based on customized test script are described based on Jason document
Test case parameter, and parameter configuration is dynamically loaded into the user interface of C# exploitation software, allow to according to reception
The user arrived modifies the instruction of test case parameter configuration, modifies to the test parameter;Additionally, it is provided test case is corresponding
IronPython tests case script, can participate in when user has the demand of custom script without instrument developer, user is certainly
Row carries out secondary development.Meanwhile the test case script based on default, user can rapid customization oneself script, and carry out hand
Dynamic debugging, substantially increases the ease for use of measuring device.
The above description is only an overview of the technical scheme of the present invention, in order to better understand the technical means of the present invention,
And it can be implemented in accordance with the contents of the specification, and in order to allow above and other objects of the present invention, feature and advantage can
It is clearer and more comprehensible, the followings are specific embodiments of the present invention.
According to the following detailed description of specific embodiments of the present invention in conjunction with the accompanying drawings, those skilled in the art will be brighter
The above and other objects, advantages and features of the present invention.
Specific embodiment
Exemplary embodiments of the present disclosure are described in more detail below with reference to accompanying drawings.Although showing the disclosure in attached drawing
Exemplary embodiment, it being understood, however, that may be realized in various forms the disclosure without should be by embodiments set forth here
It is limited.On the contrary, these embodiments are provided to facilitate a more thoroughly understanding of the present invention, and can be by the scope of the present disclosure
It is fully disclosed to those skilled in the art.It should be noted that under the premise of not conflicting, the embodiment of the present invention and preferably
Technical characteristic in embodiment can be combined with each other.
Inflexible caused by fixed test case script, expansion can only be supported in order to solve measuring instrumentss in the prior art
The problem of malleability difference, the embodiment of the invention provides a kind of test methods based on customized test script, can be according to user
The customized test script of demand substantially increases scalability, the flexibility of Survey Software entirety.Below by specific embodiment
It is described in detail.
Fig. 1 is the test method flow chart according to an embodiment of the invention based on customized test script, such as Fig. 1 institute
Show, the test method according to an embodiment of the present invention based on customized test script includes:
Step S102: describing the parameter configuration of test case based on Json document, and parameter configuration is dynamically loaded into C# exploitation
In the user interface of software;
Step S104: the instruction that user modifies parameter configuration is received by user interface, and according to the instruction to survey
The parameter information of examination example is modified;
Step S106: the corresponding IronPython test case script of test case is provided and is edited for user, according to reception
The instruction of the customized modification IronPython test case script of the user arrived, repairs IronPython test case script
Change;
Step S108: test case parameter information is transmitted to by IronPython by test case enforcement engine and tests case script;
Step S110: IronPython test case script is executed to execute test according to the test case parameter information received
Example.
The embodiment of the invention provides a kind of test methods based on customized test script, are described based on Jason document
The parameter configuration of test case, and parameter configuration is dynamically loaded into the user interface of C# exploitation software, allow to root
The instruction that test case parameter configuration is modified according to the user received, modifies to the test parameter;Additionally, it is provided test case
Corresponding IronPython tests case script, can participate in when user has the demand of custom script without instrument developer,
User can voluntarily carry out secondary development.Meanwhile the test case script based on default, user can rapid customization oneself script,
And debugged manually, substantially increase the ease for use of measuring device.
Fig. 2 is the flow chart of the modification test case parameter information of an alternative embodiment according to the present invention, as shown in Fig. 2,
In one alternate embodiment, above-mentioned steps S104 is specifically included:
S202: searching the script file under the catalogue of the current program for executing test, and traversal reads script file
The Json file of preset test case under folder obtains test case information and test case parameter information in Json file;
S204: according to the name information of the test case in test case information, the test case is successively added to test case
In list;
S206: user is received by user interface and modifies the instruction of the parameter configuration, and is repaired according to described instruction
Change the test case parameter information in each Json file and saves.
In conjunction with Fig. 3 it is found that measureItem (metering under the corresponding Json file of test case under Script file
Project) in include test case information, test case information includes the name (name information) and id (attribute information) of test case.Json
Include test case parameter information in params (variable element) under file, includes multiple object arrays, circulation time under params
Each object array is gone through, there is 7 attributes, including id (unique identification) under each object array, name (parameter name),
Whether value (parameter value), selectItem (option), type (control type), enable are (can operate), and visible (is
No display).Firstly, dynamically increasing control from top to bottom in interface according to these information, wherein type type is input increasing
Add input frame, increases drop-down list box for select.And increasing lable control before control, content is name attribute value.Its
It is secondary, control initialization is carried out, Input control initialization data is value attribute value, and select control needs first to recycle addition
SelectItem with ";" value of segmentation chooses and initialized into drop-down list box, then according to value attribute value.In addition, also
Whether can operate, can show if being respectively set according to two attribute values of enable, visible.
By the way that above-mentioned control is arranged, allows to receive user according to the control in user interface and modify test case ginseng
The instruction of number configuration, and test case parameter information is modified and saved according to described instruction, realize test case parameter letter
The visual edit of breath.
Fig. 4 is the flow chart of the modification IronPython test case script of an alternative embodiment according to the present invention, such as Fig. 4
Shown, above-mentioned steps S106 is specifically included:
S402: any one test case is chosen in test case list;
S404: searching under Script file and chooses the corresponding Json file of the test case, according to the Json file
It searches and obtains corresponding IronPython test case script;
S406: the customized instruction for modifying IronPython test case script of user based on the received, to this
IronPython test case script is modified.
In one alternate embodiment, the detailed process of step S404 is: searching and selects under the Script file
Described in the corresponding Json file of test case, in Json file read measureItem under method attribute value;According to institute
Method attribute value is stated, the entitled method attribute value of file is searched and obtained in method file, extends entitled py
IronPython test case script.
Above-mentioned test program using C# language exploitation desktop application it is professional on the basis of, increasing Python can
The mode of the ability of customized test case script, C# and Python hybrid programming improves the extension of metering device software entirety
Property, flexibility and adaptability so that participated in when user has the demand of custom script without instrument developer, user can from
Row carries out secondary development.Meanwhile the test case script user based on default can rapid customization oneself script, and carry out manual
Debugging, substantially increases the ease for use of measuring device.
In one alternate embodiment, above-mentioned steps S110 includes: the communication interface and measurement module, quilt by C# encapsulation
Measurement equipment is communicated;Measurement module is controlled by communication interface according to the test case parameter information received to hold equipment under test
Row IronPython test case script is measured with executing correspondingly test case, and reads measurement data.
Wherein, since IronPython script will be communicated with equipment under test, measurement module, interface is preferably included
GPIB, USB, serial ports, four kinds of network interface are unified to these four types of interfaces to carry out based on the advantage that C# supports various I/O read-write
Encapsulation is reduced to open, close, four kinds of reading and writing operations, and the library C# that these encapsulation are quoted in IronPython can be led to
Letter, encapsulates general I/O communication interface, increases new communication module, without carrying out adaptation exploitation to new module, save exploitation
The operation of personnel.
After being communicated above by the communication interface that C# is encapsulated with measurement module, equipment under test further include: pass through institute
The communication interface for stating C# encapsulation verifies the connection status of the measurement module and equipment under test;Determine the measurement module with it is described
State between equipment under test is connection.
Wherein, however, it is determined that the state between measurement module and equipment under test is connection, then is controlled by above-mentioned communication interface
Measurement module executes above-mentioned IronPython test case script to the equipment under test and is measured with executing above-mentioned test case.
If it is determined that the state between measurement module and equipment under test be it is not connected, then generate warning message, prompt in connection
Equipment under test and measurement module are stated, and then equipment under test is measured.
After measurement, corresponding test data is read, calculates and whether judgement equipment under test measures and pass through, and will measurement
Result shown back to interface.
According to same inventive concept, the embodiment of the invention also provides a kind of, and the test based on customized test script is filled
It sets.Fig. 5 shows the structural schematic diagram of the test device according to an embodiment of the invention based on customized test script, ginseng
See Fig. 5, the test device 500 based on customized test script includes at least: loading module 510, the first modified module 520,
Two modified modules 530, transmission module 540, execution module 550.
First introduce each composition of the test device 500 based on customized test script of the embodiment of the present invention or the function of device
Connection relationship between energy and each section:
Loading module 510 is added the parameter configuration dynamic suitable for being described the parameter configuration of test case based on Json document
It is downloaded in the user interface of C# exploitation software;
First modified module 520, couples with loading module 510, repairs suitable for receiving user by the user interface
Change the instruction of the parameter configuration, and is modified according to described instruction to the test case parameter information;
Second modified module 530 couples with the first modified module 520, it is corresponding to be adapted to provide for the test case
IronPython test case script is edited for user, according to the customized modification IronPython of the user received
The instruction for testing case script modifies to IronPython test case script.
Transmission module 540 is coupled with the second modified module 530, is suitable for passing through test case enforcement engine for the test case
Parameter information is transmitted to the IronPython test case script;
Execution module 550 is coupled with transmission module 540, suitable for being executed according to the test case parameter information received
The IronPython test case script is to execute the test case.
Based on the test device provided in this embodiment based on customized test script, user can be according to itself to test
The customized IronPython of the demand of process tests case script, substantially increases the flexibility of test case script, ease for use.
Fig. 6 is the test device structural representation based on customized test script of an alternative embodiment according to the present invention
Figure, as shown in fig. 6, in an alternate embodiment of the present invention, above-mentioned first modified module 520, comprising:
Searching unit 521 is coupled with loading module 510, under the catalogue suitable for searching the current program for executing test
Script file, traversal read the Json file of test case preset under the script file, obtain the Json text
Test case information and test case parameter information in part;
Adding unit 522 is coupled with searching unit 521, suitable for the title according to the test case in the test case information
The test case is successively added in test case list by information;
Storage unit 523 is modified, is coupled with adding unit 522, is suitable for receiving user by user interface and modifies institute
The instruction of parameter configuration is stated, and the test case parameter information in each Json file is modified according to described instruction and is saved.
In one alternate embodiment, above-mentioned modification storage unit 523 is particularly adapted to: for the corresponding Json text of each test case
Test case parameter information dynamic in part increases control, and initializes the control;
The instruction that user modifies the parameter configuration is received by the control in the user interface, according to the finger
It enables and modifies the test case parameter information and save.
Fig. 7 is the test device structural representation based on customized test script of another alternative embodiment according to the present invention
Figure, as shown in fig. 7, in one alternate embodiment, above-mentioned second modified module 530 includes:
Selection unit 531 is coupled with the first modified module 520, suitable for choosing any one in the test case list
Test case;
Acquiring unit 532 is searched, is coupled with selection unit 531, suitable for searching and choosing under the Script file
The corresponding Json file of the test case, according to the Json file search and obtains corresponding IronPython test case foot
This;
Unit 533 is modified, is coupled with acquiring unit 532 is searched, suitable for according to the customized modification institute of user received
The instruction for stating IronPython test case script modifies to IronPython test case script.
In one alternate embodiment, above-mentioned lookup acquiring unit 532 is particularly adapted to: looking under the Script file
It looks for and chooses the corresponding Json file of the test case, the method read under measureItem in the Json file belongs to
Property value;
According to the method attribute value, is searched in method file and obtain the entitled method attribute of file
Value extends the IronPython test case script of entitled py.
In one alternate embodiment, above-mentioned execution module 550 is particularly adapted to: the communication interface and measurement encapsulated by C#
Module, equipment under test are communicated;
According to the test case parameter information received, the measurement module is controlled to described by the communication interface
Equipment under test executes the IronPython test case script and is measured with executing the test case, and reads measurement data.
In one alternate embodiment, above-mentioned execution module 550 is specifically further adapted for: the communication interface encapsulated by the C#
Verify the connection status of the measurement module and equipment under test;
Determine the state between the measurement module and the equipment under test for connection.
In one alternate embodiment, above-mentioned transmission module 540 is further adapted for: being initialized by the test case enforcement engine
The running environment of the IronPython test case script.
Another aspect according to the present invention additionally provides a kind of computer storage medium, computer storage medium storage
There is computer program code, when computer program code is run on the computing device, causes calculating equipment to execute above-mentioned any
The test method based on customized test script in embodiment.
The embodiment of the invention provides a kind of test method and device based on customized test script, are mentioned based on the present invention
The method of confession describes the parameter configuration of test case based on Json document, and the parameter configuration is dynamically loaded into user's interaction circle
In face;So that can receive the instruction that user modifies the parameter configuration by the user interface, and according to described
Instruction carries out visualization modification to the parameter information of the test case;There is provided the test case corresponding IronPython test case
Script is edited for user, according to the finger of the user received the customized modification IronPython test case script
It enables, modifies to IronPython test case script, allow the customized test case script of user, substantially increase
Test the flexibility of case script, ease for use;It is communicated by the communication interface that C# is encapsulated with measurement module, equipment under test, nothing
New communication module need to be increased, without carrying out adaptation exploitation to new module, save corresponding personnel's investment, in addition only open test
Case script source code, so that entire software version is able to maintain unanimously.On it is apparent to those skilled in the art that
The system of description, the specific work process of device and unit are stated, can refer to corresponding processes in the foregoing method embodiment, for letter
For the sake of clean, this will not be repeated here.
In addition, each functional unit in each embodiment of the present invention can be physically independent, can also two or
More than two functional units integrate, and can be all integrated in a processing unit with all functional units.It is above-mentioned integrated
Functional unit both can take the form of hardware realization, can also be realized in the form of software or firmware.
Those of ordinary skill in the art will appreciate that: if the integrated functional unit is realized and is made in the form of software
It is independent product when selling or using, can store in a computer readable storage medium.Based on this understanding,
Technical solution of the present invention is substantially or all or part of the technical solution can be embodied in the form of software products,
The computer software product is stored in a storage medium comprising some instructions, with so that calculating equipment (such as
Personal computer, server or network equipment etc.) various embodiments of the present invention the method is executed when running described instruction
All or part of the steps.And storage medium above-mentioned includes: USB flash disk, mobile hard disk, read-only memory (ROM), random access memory
Device (RAM), the various media that can store program code such as magnetic or disk.
Alternatively, realizing that all or part of the steps of preceding method embodiment can be (all by the relevant hardware of program instruction
Such as personal computer, the calculating equipment of server or network equipment etc.) it completes, described program instruction can store in one
In computer-readable storage medium, when described program instruction is executed by the processor of calculating equipment, the calculating equipment is held
The all or part of the steps of row various embodiments of the present invention the method.
Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention., rather than its limitations;To the greatest extent
Present invention has been described in detail with reference to the aforementioned embodiments for pipe, those skilled in the art should understand that: at this
Within the spirit and principle of invention, it is still possible to modify the technical solutions described in the foregoing embodiments or right
Some or all of the technical features are equivalently replaced;And these are modified or replaceed, and do not make corresponding technical solution de-
From protection scope of the present invention.