现在,我有这个简单的测试套件:
@RunWith(Suite.class)
@Suite.SuiteClasses({
CommentingTest.class,
SubscriptionsTest.class,
EditingTest.class,
BasicOperationsTest.class
})
public class WebTestSuite { }
但是现在我想将参数传递给这些测试类,告诉他们是否使用管理员帐户进行测试,是否在视图模式 A 或 B 下进行测试等。我希望我能做这样的事情:
@RunWith(Suite.class)
public class WebTestSuite {
public WebTestSuite() {
this.addTest(new CommentingTest(Accounts.ADMIN, ViewMode.A));
this.addTest(new CommentingTest(Accounts.ADMIN, ViewMode.B));
this.addTest(new CommentingTest(Accounts.GUEST, ViewMode.B));
this.addTest(new SubscriptionsTest(Accounts.ADMIN, ViewMode.A));
this.addTest(new SubscriptionsTest(Accounts.ADMIN, ViewMode.B));
this.addTest(new SubscriptionsTest(Accounts.GUEST, ViewMode.B));
this.addTest(new EditingTest(Accounts.ADMIN, ViewMode.A));
this.addTest(new EditingTest(Accounts.ADMIN, ViewMode.B));
this.addTest(new EditingTest(Accounts.GUEST, ViewMode.B));
this.addTest(new BasicOperationsTest(Accounts.ADMIN, ViewMode.A));
this.addTest(new BasicOperationsTest(Accounts.ADMIN, ViewMode.B));
this.addTest(new BasicOperationsTest(Accounts.GUEST, ViewMode.B));
}
}
但我不知道如何做这样的事情。有任何想法吗?谢谢!