Improved debug test handling