A kind of automotive electronics test platform based on the Python script
Technical field
The present invention relates to a kind of Electronic Testing Technology, be specifically related to a kind of automotive electronics measuring technology.
Background technology
Automobile electronics have input, the miscellaneous characteristics of output signal, and the software logic complexity of product, and to real-time, reliability requirement is very high.
The automotive electronics test platform is the software and hardware system ensemble of automobile electronics being carried out integration test, is used for the automatic regression test of product development stage, thereby finds product software and hardware defective.The automotive electronics test platform is taken on the key player in product development process, be significant.
Outstanding automotive electronics test platform needs to possess following characteristics at least
1. can make things convenient for, control multiple external test facility quickly, as various digital quantities, analog acquisition equipment, radio frequency signal transceiver, CAN, LIN, MOST, simulated-bus equipment such as FLEXRAY, and oscillograph, power supply, AWG (Arbitrary Waveform Generator) etc.
2. development and testing use-case quickly and easily carries out automatically performing of test case, and can produce test report.
3. the characteristics that have software modularity, integrated new testing apparatus drives easily.
4. system has very high reliability.
Traditional automotive electronics test platform generally uses language such as LABVIEW, C++, VB, C# as the software language of automotive electronics test platform, test driving the development﹠ testing script write language, be responsible for execution when being moved by function software through compiling then.But because above these language exploitation itself, debugging is difficulty relatively, so generally expand difficulty based on the test platform of these language, the test case exploitation is very inconvenient, and carrying out needs compiling, inefficiency.
Summary of the invention
The present invention is directed to the existing existing problem of automotive electronics test platform, and a kind of automotive electronics test platform based on the Python script is provided.This platform can overcome the existing in prior technology shortcoming, automobile electronics is realized efficiently, efficiently test.
In order to achieve the above object, the present invention adopts following technical scheme:
A kind of automotive electronics test platform based on the Python script, described test platform adopt the Python script to control.
In preferred embodiment of the present invention, described test platform comprises:
The DLL that some testing apparatus driver modules, described testing apparatus driver module use related libraries among the Python to encapsulate product to be tested drives or utilizes VISA to carry out equipment control, thereby provides hardware driving interface based on Python for the upper strata test frame;
Test library, described test library are the RoboFramework test library, and the testing apparatus driver based on the hardware driving interface of Python that the testing apparatus driver module is provided goes on foot encapsulation, the test key word that formation can tested framework identification;
Test script, described test script drives to set up formation based on the key word that forms in the test library;
Test frame, described test frame is the RobotFramework test frame based on python, described test frame is resolved the test script content, go out the test key word that encapsulation forms in the test library according to key word content recognition in the test script that parses, the testing apparatus driver according to this test key word correspondence drives control product to be tested again; Described test frame operation test script is controlled product to be tested according to the content of test script and is finished test operation.
Further, described test frame record whole test process, and form journal file, the test result record is formed the report of XML form.
The automotive electronics test platform that forms according to such scheme has following useful effect:
1. the encapsulation of test products driving is very simple, utilizes the ctype storehouse of python can the DLL that general device provides be encapsulated, if VISA equipment, simply realization equipment control of the pyvisa storehouse that python has.
2. test frame also is based on the RobotFramework of python, and this framework has crosses the threshold simply system stability, the characteristics that real-time is good.
3. the exploitation of test script and simple, with traditional test platform relatively, efficient improves more than 30% at least, this is because it drives based on key word, namely need not to understand any programming language, only need get final product based on the key word that forms in the test frame.
4. the form of development and testing script is various, can use the TXT file layout, also can use the EXCEL formatted file, and test script need not compiling, exploitation, execution efficient height.
5. system can produce very exquisite test report, the test macro daily record.Test report adopts the XML form, can produce multiple form by XLST, as html, and pdf, word etc.Compare general test report, more flexible, easy to understand.
Description of drawings
Further specify the present invention below in conjunction with the drawings and specific embodiments.
Fig. 1 is principle of the invention block diagram.
Embodiment
For technological means, creation characteristic that the present invention is realized, reach purpose and effect is easy to understand, below in conjunction with concrete diagram, further set forth the present invention.
Referring to Fig. 1, it is depicted as the automotive electronics test platform based on the Python script provided by the invention.As seen from the figure, this test platform 100 mainly comprises testing apparatus driver module 101, test library 102, test frame 103 and test script 104 these four parts.
Testing apparatus driver module 101 in the platform provides the driver of corresponding product to be tested 200, and related libraries encapsulates the DLL driving of product to be tested among its use Python; If VISA equipment, utilize VISA to carry out equipment control, thereby provide hardware driving interface based on Python for the upper strata test frame.
In the specific implementation, this module is utilized storehouses such as pyVisa, pySerial, the ctyp of Python, at the corresponding driver of different test products (equipment) 200 exploitations.Generally need develop following device driver at automobile electronics:
1.CANCaseXL drive: the driving of the DLL that use ctype encapsulation CANCaseXL provides, thereby control CAN, the bus that automotive electronics such as LIN are commonly used;
2. AWG (Arbitrary Waveform Generator) drives: use pyVisa to carry out the visit of AWG (Arbitrary Waveform Generator);
3. programmable power supply drives: use pyVisa to control programmable power supply;
4. analog quantity, digital quantity input and output integrated circuit board: use ctype encapsulation dll form to drive;
5. wireless signal generator and radiofrequency signal resolver: use pyVisa to control;
6. relay matrix integrated circuit board: use ctype encapsulation dll form to drive;
7. multimeter able to programme: use pyVisa to control
8. universal serial port equipment: use pySerial to carry out serial ports control.
Test library 102 in the platform is the RoboFramework test library, at the test frame on upper strata, forms corresponding test key word.Itself and testing apparatus driver module data are joined, and the testing apparatus driver based on the hardware driving interface of Python that the testing apparatus driver module is provided goes on foot encapsulation, the test key word that formation can tested framework identification.
Can realize by Python for this test key word.
Test frame 103 in the platform adopts the RobotFramework test frame, because RobotFramework is the test frame of increasing income, can specifically reduce this framework, makes it be adapted to the test of automobile electronics more.
This test frame 103 will provide running environment for test script 104, and its scheduling and control test script move, and form the test products test operation of correspondence according to the content of test script; Test frame 103 is controlled concrete test products by the testing apparatus program of encapsulation in the test library 102 simultaneously, thereby encourages product to be measured, finishes test and the measurement of product to be measured according to the formed test operation of test script.
For all processes in the test run, this test frame 103 will carry out record, form journal file, and test result will be recorded the report that forms the XML form.This report can use XLST to carry out the form that format conversion forms forms such as html, pdf, word.
Test script 104 in the platform drives to develop formation based on the key word that forms in the test library.It adopts the key word method of driving, and the form of multiple test scripts such as TXT, Excel can be provided.This test script need not compiling, and the efficient height is carried out in exploitation.Defined the step of test in the test script 104, by condition, test data, variable etc., and the statement in the test script can resolve by tested framework 103, and moved by framework.
The test platform of Xing Chenging joins product 200 to be tested and the hardware driving interface data that testing apparatus driver module 101 provides when carrying out the automobile electronics test thus.
Testing apparatus driver module 101 forms corresponding testing apparatus driver at required product to be measured 200 exploitations, thereby provides hardware driving interface based on Python for the upper strata test frame.
At this moment, the RoboFramework test library goes on foot encapsulation with the testing apparatus driver based on the hardware driving interface of Python that the testing apparatus driver module provides, the test key word that formation can tested framework identification.
Simultaneously, drive to develop based on the key word that forms in the test library and form the test script that meets test request (as the step of test, by condition, test data, variable etc.).
After finishing test script, the test script operation will be dispatched and control to test frame, and product to be measured is finished test.Concrete, test frame is resolved the content of the test script of transferring, thereby parse corresponding key word, go out the test key word that encapsulation forms in the test library according to key word content recognition in the test script that parses, the testing apparatus driver according to this test key word correspondence drives control product to be tested again.This test frame test script that reruns forms corresponding test operation according to the content of test script, utilizes these test operations to control product to be tested and finishes corresponding test process.
Whole platform all adopts the Python script to control from bottom to up, has than general test platform good characteristic more, and be a kind of test platform scheme of very suitable automobile electronics.
More than show and described ultimate principle of the present invention, principal character and advantage of the present invention.The technician of the industry should understand; the present invention is not restricted to the described embodiments; that describes in above-described embodiment and the instructions just illustrates principle of the present invention; without departing from the spirit and scope of the present invention; the present invention also has various changes and modifications, and these changes and improvements all fall in the claimed scope of the invention.The claimed scope of the present invention is defined by appending claims and equivalent thereof.