![](/img/trans.png)
[英]junit @RunWith(Parameterized.class) annotation is throwing null
[英]How to use an object to instantiate JUnit class with Runwith annotation?
我正在使用Junit。 要求是將許多測試套件合為一體。 所以我用
@Runwith(Suite.class)
@Suite.SuiteClasses({a.class,b.class})
class SuiteRunner{}
成功的條件是一定的,我需要叫這個課。 我需要在同一包中從不同的Java文件實例化此類的對象。 就像是:
SuiteRunner suite=new SuiteRunner();
。
但這行不通。
提前致謝。
您可以在SuiteRunner
放置一個@AfterClass
方法,然后使用它使用所需的信息更新靜態字段。 然后,您可以從其他類訪問此靜態字段。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.