added function to write test files