Information required on setting up the automated testing for Embedded system

Hello team, I could use your assistance with an embedded systems project. My responsibility involves automating or simulating the functionality of the actual device. I’ve decided to use Python for scripting the testing procedures. Could you please assist me in creating a block diagram for the test architecture? Additionally, I’m seeking guidance on simulating sensors and would appreciate advice on the overall approach. It’s worth mentioning that I’m more experienced with web applications and have limited familiarity with automating embedded systems. Your support would be greatly appreciated. Thank you.

1 Like

Hi @nubeintesting Welcome to the community. Good question, or actually a few questions all in one there.

I think, to try and help people give you more specific answers and not vague advice you need to tell us a bit more about the product and what it does. A lot of the same heuristics for desktop and web apps do apply to embedded, but it’s much harder to test most of the time, although the tests you can run are really a lot simpler. And as you know there are different kinds of risks to test for around provisioning and reliability with mission critical devices.

I’m assuming you want to simulate because the product communicates or interfaces with another thing as a big part of it’s workings. So, do tell us more about what the device does, and more about what simulation ideas you have.

Hi @conrad.connected. Thank you for the friendly reception.
This is an embedded IoT project with sensors designed to detect motion in doors and windows. The sensor data is transmitted to the MQTT broker through the unify SDK and then forwarded to the AWS server. I am tasked with creating a test framework to simulate this system using Python, and I plan to implement it with pytest.

oh an iOT product.
So you are wanting to simulate the device and it’s interactions with the message queue server to validate the Cloud side, and also then install some hooks in a test environment and test the real provisioned device in that environment. I’m guessing it’s an arm platform, what is the provisioning mechanism like?

Step 1 will be deciding which to do first, and then step 2 to extract the bootstrap configuration so that you can modify and switch between the live and integration environments easily. I’m guessing the bootstrap will probably be a signed file?
Personally I would start with testing the real device in a sandbox environment, and automating that. It’s usually not a concern to worry about wearing out flash on devices especially if the device is cheap. Then I would look at the simulation task, and try to palm that of on one of the developers. They may even have some starter code in whatever language the platform is compiled, and just port that to run under linux on intel in a way that you can build it yourself. Most simulators use an RPC (a socket or pipe) as an input/output emulation, you can even build a TTY type remotecontrol protocol for ease and flexibility of testing the sim or even for testing the real device.

Hope that gives you some ideas - normally you will find that your tools constrain you most, so having a dev who can find or write some tools for you will help. As for PyTest, it’s well, a very basic testing framework, so do expect to have to extend on it quite a lot before you are done. It’s a great workhorse, but everyone ends up modding it.

@conrad.connected No validating the cloud is not a priority for now. The task at hand is to simulate the embedded system that consists of these sensors which send the data to UnifySDK and then to MQTT broker and then to the bridge.
I need to figure out a way in which I can simulate it.

Ah, a full blown device emulator. Normally I start with finding out if there is anything like a simulator for the host device. If anything at least to use it for inspiration. I suspect that if you want to implement a simulator in Python, you will be looking at an insignificant task, and a lot of lead time. I wrote a sim once it’s still available on the web but I broke the DNS I think it’s here for now https://sites.google.com/site/plcsimulator/Home . Which I implemented in C++ which was before I learned any Python. And it turned out to be a task for many weekends to get working. It was easy for me because I already understood all of the protocols pretty well. So stating with an app that consumes the UnifySDK in Python would be my starting off point, maybe implement it as a webserver using Flask, to make it easier to handle UI events and have a decent UI?

Hope that’s something that either confirms what you are already thinking or inspires you. I don’t know your context, or skills but I am also assuming you have some help from the devs to learn how to use the web bindings and handle the authentication and ssl fun that will go with that Tajamul.

1 Like

Thank you for sharing your valuable information. However the link that you mentioned in your previous comment doesn’t work https://sites.google.com/site/plcsimulator/Home

Oh, yeah that link is my web editor link I think, I have to still fix the DNS after I upgraded the site - here is the git repo GitHub - zaphodikus/Mod-RsSim: This protocol simulator started one weekend as a test program while developing a SCADA/HMI with modbus RTU and TCP/IP and afterward came in useful testing an embedded gnu-Linux device too. It has worked so well for me, I decided to put a nice GUI onto it and release it for free. . I only included it to demonstrate a point more than anything. I’m just too tired to be fixing things lately.

1 Like