You would need to have a multiple loops structure.
Personally, I used to code a program that allows four DUT being tested at the same time yet with different test cases (hence test time etc.)
Two loops for each DUT and a main loop for overall control.
Nevertheless, 32 DUT could be complex!