标签: junit testng
鉴于以下内容:
class TestCase { @Test public void test(){ assertTrue(true); } }
有没有办法创建基础测试方法?我有一些重复的代码需要为每个测试发生。或者我也可以在每次测试开始时每次都写一个实用工具并调用它?
它不能出现在@beforeMethod中,因为我需要测试本身的信息。
答案 0 :(得分:3)
当然,只需将它放在基类中并扩展该类(至少对于TestNG)。