I'm running some serial commands to test connected devices under test (DUTs), & we have a need to run these in parallel/concurrently to speed up our tests. I would like some feedback on which model would be most appropriate for this use case.
We're currently using Python to run our tests, so I've been reading up on async and multithreading. These are our current requirements.
- Individual tests are run on a DUT. The steps within the test must be run sequentially, but multiple DUTs may be tested in parallel - this suggests that tests are the unit of work to be run in parallel
- Tests may use other resources (connections to servers/databases, other supporting hardware) that may be blocking/not thread safe - need to manage access to blocking resources
- The main source of slowdown is the issuing of commands to DUTs. Often we send a command & wait for a response, or poll the DUT until it reaches a certain state. During this time, we would be able to send commands to other DUTs/perform other computations - need to leverage concurrency between waiting for response from DUTs
Based on these requirements, I'm leaning more towards a threading model. Based on my research & experience, using async would require developing an async API for issuing commands to DUTs. Additionally, there's little need for synchronization between threads - aside from shared resources, the only thing required from parallel tests is the end result & no cross-thread communication is required.
The solution I'm thinking of looks like:
- A test plan can be broken down into sequential steps
- A test step can be broken down into parallel tests, which can be run on individual threads
- Shared resources can be made thread safe using locks & mutexes
I'd welcome feedback on my reasoning if I've missed out any other drawbacks or considerations, & I'd also welcome someone making the case for an async model too!