Moved test boilerplate code into a separate file