Refactor functional tests: DRY.