Added automatic directory creation
Removed manual mkdir in test