I work for automotive's and currently i am working on MPC57XX (freescale) micro controller .. There are some test case which needs to be tested.. i was interested in making them into AUTOMATED test case using python. Does any one have idea on how can i make python interact with microcontrollers directly with out any interface(any other S/w or H/w) is it possible to that make automated test case which will fetch the value directly from microcontrollers ?? i Have not tried with this yet !!
1 Answers
I believe that there is not a very easy way of doing that. What you are asking seems to be a type of 'black-box' or integration testing. We usually refer to this as verification & validation testing and can affect different levels of system engineering:
- Validation that the design responds to client requirements
- Verification of design against requirements (output power, battery lifetime, temperature extremes)
- Verification of unit against design (verification of assembly, calibration, bringup)
You will need custom 'hooks' in your microcontroller software to control and measure inputs and ouputs, which is the biggest part of the job. For python to interact with the microcontroller, you will need some sort of hardware interface: COM port, ethernet, etc; we usually go with an interface already available on the product.
Once you have that, then you can write your tests in python that will run on a separate machine. We use Google's OpenHTF framework to structure and execute tests. Check it out: https://github.com/google/openhtf
At this point, the answers to the following question might help: Test framework for testing embedded systems in Python
If using OpenHTF, you would then write a Plug for your microcontroller that abstracts away the interface you have chosen and exposes functions such as 'activate_led()', 'read_input_signal()' with names related to the features of your product.
Your tests could then use your plug to interact with your micrcontroller and use python to capture measurements, validate thresholds, ask the user for input (i.e. is the LED on ?) and more.
In short, this is not a plug-and-play endeavour and requires custom hooks into your microcontroller. I'd therefore say that no, python cannot interact directly with microcontrollers without any interfaces, and no it cannot (without some software you control on both end) fetch values directly from microcontrollers.

- 131
- 8