write test to database in test file