停止@Before方法中的 JUnit 测试而不会失败
这些是我的测试用例
class Mother {
    @Before
    public void setUp() {
        if (!this.getClass().isAnnotatedWith("Version20")) { // pseudo code
            /*
             * stop this test without failing!
             */
        }
        // further setup
    }
}
@Version20
class Child extends Mother {
    @Test
    public void test() {
        // run only when Version == 20
    }
}
有没有可能以母亲@Before方法停止儿童测试而不失败或断言True(false)?
编辑:我有更多的版本@Version19,@Version18等,我的软件正在读取配置文件并输出结果,一些测试仅适用于特殊版本。我不想在测试方法中进行版本检查,因为我有很多小测试,不喜欢代码重复
 
					 
				 
				    		 
				    		 
				    		 
				    		