refactor test_case generator