refactor view test utility