purge before loading module for running test cases + some code refactoring
Merge pull request #512 from boegel/purge_before_test_cases

purge before loading module for running test cases + some code refactoring