Some refactoring of tests