write serialized string to file in test.