Add more advanced test script for device handling