我在TestNG中进行了一些测试,并使用Gradle运行它们。我在Spring bean中有一些我想在运行时选择的属性。将参数传递给TestNG运行 - Gradle
因此,为了选择这个不同的bean,我想将字符串参数传递给useTestNG调用。我的build.gradle看起来如下:
apply plugin: 'java'
dependencies {
compile fileTree(dir: 'lib', include: '*.jar')
}
test {
useTestNG()
}
的参数会像“bean1”,“bean2”,......并在Java代码中,我将选择什么豆使用。
ApplicationContext context = new FileSystemXmlApplicationContext("**/pathToXML.xml");
Locators obj = (Locators) context.getBean("bean1");
如果不解决这个问题的好办法,并采用不同的方法比较好,我会感激地知道它