Python framework to test hardware and control various equipment
How is Python used in test automation in embedded systems?
Which Python versions does OpenHTF support?
How is OpenHTF different from pytest?
Is OpenHTF still maintained?
Hi,
I am looking for a Python framework to test hardware (boards or multiple of boards) and control various equipment (scope, thermal chamber, power supplies, etc...) via VISA, SSH, modbus, serial for a long time of time (up to 7 days) of running. During this time, I would like to make calls to make adjustment to both DUT and equipment based on triggers or time (every 1, 2, 3 hours, etc..)
I have looked at:
OpenHTF (by Google) supported Python3.7
https://github.com/google/openhtf
Spintop OpenHTF (by Tackv, a spin branch off from Google) supported Python3.7
https://spintop-openhtf.readthedocs.io/en/latest/
FastAPI
https://fastapi.tiangolo.com/
Make a new framework and use Celery
https://docs.celeryq.dev/en/stable/getting-started/introduction.html
OpenHTF does not seem to have a way to continuously run the tests for a long period of time nor a way to make async to DUT/equipment. It is more like a manufacturer test to QC the product on the production line.
FastAPI seems to be good not sure if it can handle all the async call based on triggers/time. Celery seems to be quiet complex but it can trigger calls based on time.
For database storage, I will use influxdb/grafana for collecting/viewing data and postgres for storing DUT/equipment/test config/final test results. They will all be dockerized.
Do you have any suggestions/comments?
Thanks!
The mock package exists for this very reason.
It's a standalone, pip-installable package for Python 2; it has been incorporated into the standard library for Python versions >= 3.3 (as unittest.mock).
Just use a mocking library from within your test code. This way you'd mask the external APIs (hardware calls in your case) and return predictable values. I would recommend flexmock https://pypi.python.org/pypi/flexmock it's super easy.
In the beginning of your test code, you'll write something like:
flexmock(SomeObject).should_receive('some_method').and_return('some', 'values')