我有以下的testng.xmlTestNG的BeforeSuite只運行一個測試類
<test name="CommonReportingTests" preserve-order="true">
<classes>
<class name="com.blah.ReportRunTests">
<methods>
<include name="login" />
<include name="checkHomeTab" />
<include name="checkReportsTab" />
<include name="checkReportsExist" />
<include name="reportsCleanup" />
</methods>
</class>
<class name="com.blah.RestoreActivityTests">
<methods>
<include name="login" />
<include name="checkHomeTab" />
<include name="checkReportsTab" />
<include name="checkReportsExist" />
<include name="expandReportsTabAndClickRestoreActivity" />
</methods>
</class>
</classes>
我TestBase類有這樣的:
@Parameters({ "webconsoleStartupURL" })
@BeforeSuite(description = "Perform class setup tasks")
public void beforeClass(final String webconsoleStartupURL)
throws ClassNotFoundException, InstantiationException,
IllegalAccessException {
sm = new SeleniumMgr(webconsoleStartupURL);
sm.startSelenium();
}
@AfterSuite(description = "Perform class teardown tasks")
public void afterClass() {
sm.stopSelenium();
}
當我執行測試,只有在xml中的第二個測試,即RestoreActivityTests似乎運行和t當它退出套件時。第一個類沒有執行,我在第一個測試中看到了NullPointerException。
我只想要瀏覽器的一個實例並執行多個測試。 testng文檔建議我上面使用的xml版本實際上是正確的。這裏有什麼問題?
這是使用Selenium 2.0嗎? – LarsH