Refactor to fix path resolution when loading config file and remove duplication

Thanks for taking my previous pull request. Unfortunately, I forgot to fix the file path in `getConfig`. These changes include the fix as well as a minor refactor to remove the duplication in `getConfig` and `getTestData`.