(GH-506) Refactored test. Moved code to delete testDirectory to separate function as this is required for other test as well and to avoid code duplication
(GH-473) Function to delete test directories created