Reusable test helpers

@tombu would you mind taking a look? I would appreciate your feedback :-)