tests refactoring - extract common part to helper function
fail for file stream configured not to read files