test: extract common codes into setup