add conditions in code gen of tests