Factored out the common test code
Merge pull request #6 from curious-attempt-bunny/merlyn/test_code_refactored

Factored out the common test code