I will be writing a python app that will read some GPIO pins on a Raspberry Pi and store data on an Azure SQL server. On the field, the signals will come from switches in a factory. For testing the functionality, I want to write a unit/stress test app that will simulate these signals.
Since each pin has a global input/output mode, the test app cannot be setting the pins while the tested app will be reading them. The simplest method I could think of was to set a mirror set of pins to output mode, connect them to the input pins, and have the test app drive the output pins to simulate real world conditions. So as an example, say the actual app read pins 2-11. For testing, I would physically connect pins 2-11 to pins 12-21 (each over a 1K resistor just to be safe), and run a test app which sets pins 12-21 to output mode and drive them as needed for the test.
Is this a good way to test such apps? Or is there a better way to do this? A way to intercept GPIO.input calls in the actual app from the test app could be a better solution (as it doesn't include physical intervention), but is this easy to do in python, and will it correctly test all potential hardware problems? The answer probably exists in a guide, but i couldn't find it online so far. Thanks for any comments.