A kind of automotive electronics test platform based on 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, output signal miscellaneous feature, and the software logic of product is complicated, and to real-time, reliability requirement is very high.
Automotive electronics test platform is the software and hardware system ensemble of automobile electronics being carried out to integration test, for the automatic regression test of product development stage, thus finds product software and hardware defect.Automotive electronics test platform takes on key player in product development process, is significant.
Outstanding automotive electronics test platform at least needs to possess following features
1. can facilitate, control multiple external test facility quickly, as various digital quantity, analog acquisition equipment, radio frequency signal transceiver, the simulated-bus equipment such as CAN, LIN, MOST, FLEXRAY, and oscillograph, power supply, AWG (Arbitrary Waveform Generator) etc.
2. can development and testing use-case quickly and easily, carry out automatically performing of test case, and can test report be produced.
3. there is the feature of software modularity, can integrated new testing apparatus drive easily.
4. system has very high reliability.
Traditional automotive electronics test platform generally uses the language such as LABVIEW, C++, VB, C# as the software language of automotive electronics test platform, that carries out the development& testing script of Test driver writes language, then when compiling is run by function software, is responsible for execution.But due to above these language exploitation itself, debug more difficult, so generally expand difficulty based on the test platform of these language, test case exploitation is very inconvenient, performs and needs compiling, inefficiency.
Summary of the invention
The present invention is directed to the problem existing for existing automotive electronics test platform, and a kind of automotive electronics test platform based on Python script is provided.This platform can overcome the shortcoming existing for prior art, realizes efficient, test efficiently automobile electronics.
In order to achieve the above object, the present invention adopts following technical scheme:
Based on an automotive electronics test platform for Python script, described test platform adopts Python script to control.
In preferred embodiment of the present invention, described test platform comprises:
Some testing apparatus driver modules, the DLL that described testing apparatus driver module uses related libraries in Python to encapsulate product to be tested drives or utilizes VISA to carry out equipment control, thus provides the hardware driving interface based on Python for upper strata test frame;
Test library, described test library is RoboFramework test library, and the testing apparatus driver of the hardware driving interface based on Python provided by testing apparatus driver module carries out step encapsulation, and being formed can the test key word of tested framework identification;
Test script, described test script drives based on the key word formed in test library and sets up formation;
Test frame, described test frame is the RobotFramework test frame based on python, described test frame resolves test script content, go out in test library to encapsulate the test key word of formation according to key word content recognition in the test script parsed, then the testing apparatus driver corresponding according to this test key word carrys out drived control product to be tested; Described test frame testing results script, completes test operation according to the content-control of test script product to be tested.
Further, the whole test process of described test frame record, and form journal file, test result record is formed the report of XML format.
According to the automotive electronics test platform that such scheme is formed, there is following useful effect:
1. the encapsulation of test products driving is very simple, utilizes the ctype storehouse of python can to encapsulate the DLL that general device provides, if VISA equipment, the pyvisa storehouse that python has simply can realize equipment and control.
2. test frame is also the RobotFramework based on python, and it is simple that this framework has introduction, system stability, the feature that real-time is good.
3. the exploitation of test script and simple, compare with traditional test platform, efficiency improves more than at least 30%, and this is because it drives based on key word, namely without the need to understanding any programming language, only need based on the key word formed in test frame.
4. the form of development and testing script is various, can use TXT file layout, also can use EXCEL formatted file, and test script is without the need to compiling, and exploitation, execution efficiency is high.
5. system can produce very exquisite test report, test macro daily record.Test report adopts XML format, can produce multiple format, as html, pdf, word etc. by XLST.Compare general test report, more flexibly, easy to understand.
Accompanying drawing explanation
The present invention is further illustrated below in conjunction with the drawings and specific embodiments.
Fig. 1 is principle of the invention block diagram.
Embodiment
The technological means realized to make the present invention, creation characteristic, reaching object and effect is easy to understand, below in conjunction with concrete diagram, setting forth the present invention further.
See Fig. 1, it is depicted as the automotive electronics test platform based on Python script provided by the invention.As seen from the figure, this test platform 100 mainly comprises these four parts of testing apparatus driver module 101, test library 102, test frame 103 and test script 104.
Testing apparatus driver module 101 in platform provides the driver of corresponding product to be tested 200, and its DLL using related libraries in Python to encapsulate product to be tested drives; If VISA equipment, utilize VISA to carry out equipment control, thus provide the hardware driving interface based on Python for upper strata test frame.
In the specific implementation, this module utilizes the storehouses such as pyVisa, pySerial, ctyp of Python, for the driver that the exploitation of different test products (equipment) 200 is corresponding.Generally need exploitation with device Driver for automobile electronics:
1.CANCaseXL drives: use ctype to encapsulate the driving of the DLL that CANCaseXL provides, thus control CAN, the bus that the automotive electronics such as LIN are conventional;
2. AWG (Arbitrary Waveform Generator) drives: use pyVisa to carry out the access of AWG (Arbitrary Waveform Generator);
3. programmable power supply drives: use pyVisa to carry out control programmable power supply;
4. analog quantity, number connect test board: use ctype to encapsulate dll form and drive;
5. wireless signal generator and radiofrequency signal resolver: use pyVisa to control;
6. relay matrix board: use ctype to encapsulate dll form and 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 platform is RoboFramework test library, for the test frame on upper strata, is formed and tests key word accordingly.It connects with testing apparatus driver module data, and the testing apparatus driver of the hardware driving interface based on Python provided by testing apparatus driver module carries out step encapsulation, and being formed can the test key word of tested framework identification.
This test key word is realized by Python.
Test frame 103 in platform adopts RobotFramework test frame, because RobotFramework is the test frame of increasing income, specifically can reduce this framework, make it more be adapted to the test of automobile electronics.
This test frame 103 will provide running environment for test script 104, and its scheduling and controlling test script runs, and form corresponding test products test operation according to the content of test script; Simultaneously test frame 103 controls concrete test products by the testing apparatus program of encapsulation in test library 102, thus carries out encouraging product to be measured, and the test operation formed according to test script completes test and the measurement of product to be measured.
For all processes in test run, this test frame 103 will carry out record, form journal file, and test result will be recorded the report forming XML format.This report can use XLST to carry out the form of the forms such as format conversion formation html, pdf, word.
Test script 104 in platform drives based on the key word formed in test library and develops formation.Its method adopting key word to drive, can provide the form of multiple test script such as TXT, Excel.This test script is without the need to compiling, and exploitation, execution efficiency is high.The step of test is defined in test script 104, by condition, test data, variable etc., and the statement in test script can be resolved by tested framework 103, and run by framework.
The hardware driving interface data that product 200 to be tested and testing apparatus driver module 101 provide, when carrying out automobile electronics test, connects by the test platform formed thus.
Testing apparatus driver module 101 forms corresponding testing apparatus driver for the exploitation of required product 200 to be measured, thus provides the hardware driving interface based on Python for upper strata test frame.
Now, the testing apparatus driver of the hardware driving interface based on Python that testing apparatus driver module provides by RoboFramework test library carries out step encapsulation, and being formed can the test key word of tested framework identification.
Meanwhile, the test script developed formation and meet test request (as the step of test, by condition, test data, variable etc.) is driven based on the key word formed in test library.
After completing test script, scheduling and controlling test script runs by test frame, completes test to product to be measured.Concrete, test frame resolves the content of the test script transferred, thus parse corresponding key word, go out in test library to encapsulate the test key word of formation according to key word content recognition in the test script parsed, then the testing apparatus driver corresponding according to this test key word carrys out drived control product to be tested.This test frame reruns test script, forms corresponding test operation, utilize these test operations to control product to be tested and complete corresponding test process according to the content of test script.
Whole platform all adopts Python script to control from bottom to up, and having than general test platform more good characteristic, is a kind of test platform scheme of very applicable automobile electronics.
More than show and describe 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; what describe in above-described embodiment and 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.Application claims protection domain is defined by appending claims and equivalent thereof.