我使用Maven Failsafe + TestNG來運行Selenium測試。我知道這是可能通過在pom.xml中定義這樣的系統性能參數傳遞給我的TestNG的測試:在不使用testng.xml的情況下使用Selenium和TestNG進行並行跨瀏覽器測試
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.19.1</version>
<configuration>
<systemPropertyVariables>
<browser>firefox</browser>
</systemPropertyVariables>
</configuration>
</plugin>
我TestNG的測試是指該物業是這樣的:
@Parameters("browser")
public void setUpClass(@Optional("firefox") String browser)
{
...
}
不過,我是想知道是否可以並行運行跨瀏覽器測試而不需要指定testng.xml文件。我正在嘗試這樣的事情,但沒有奏效。感謝您能否提供幫助。
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.19.1</version>
<configuration>
<systemPropertyVariables>
<browser>firefox, chrome</browser>
</systemPropertyVariables>
<parallel>tests</parallel>
</configuration>
</plugin>
是否有可能通過pom.xml配置實現此目的?由於我的項目具有多模塊性質,我並不熱衷於使用testng.xml文件。
「我正在嘗試這樣的事情,但沒有奏效。」有什麼問題?在捕獲瀏覽器的價值之後,你在做什麼? –
我想在多個瀏覽器上並行運行硒測試。爲了清晰起見,我會更新我的問題。 –