reoganized testcase code