我試圖編寫一個自定義的Runner,它只是按隨機順序執行測試。亞軍:JUnit自定義亞軍不工作?
public class TestClassRunnerForParameters extends BlockJUnit4ClassRunner {
public TestClassRunnerForParameters(Class<?> type) throws Exception {
super(type);
}
protected java.util.List<org.junit.runners.model.FrameworkMethod> computeTestMethods() {
java.util.List<org.junit.runners.model.FrameworkMethod> methods = super
.computeTestMethods();
Collections.shuffle(methods);
return methods;
}
}
現在這工作正常,如果它不是參數化測試。使用參數測試可以做到這一點嗎?實現參數化接口?
我做了同樣的錯誤:java.lang.Exception的:自定義亞軍類TestClassRunnerForParameters應該有簽名TestClassRunnerForParameters(類識別TestClass) \t在org.junit.runners.model.InitializationError公共構造<初始化 –
@HansEn編輯您的問題顯示您所做的更改。 –
你甚至閱讀錯誤信息說什麼? – carlspring