问题描述
我正在编写junit5扩展,需要知道测试是在方法级别还是在类级别运行。
我需要根据测试的执行方式为用户提供不同的体验。
... implements BeforeAllCallback {
@Override
public void beforeAll(ExtensionContext context) {
// I found that this has the number of tests that will execute,which in my case
// will work for me as I can assume > 1 means class level. However it is `protected`.
// I realise that I can use reflection to access it but I want an official way of
// doing that won't break as I don't control the client junit5 version
// getTestDescriptor() is protected
context.getTestDescriptor().children.size();
}
顺便说一句-我也需要JUnit4的相同信息。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)