improve management of test directories

I would move this to be inside the `if (prop != null && !prop.isEmpty())` condition above, which avoids executing it for the default case where a directory will be generated.