reduce testing code redundancy