>我有一个从修昔底德-jbehave-原型构建的项目
我正在尝试按照以下步骤更改运行项目时运行修昔底德的浏览器L http://thucydides.info/docs/thucydides/_running_thucydides_in_different_browsers.html
在绒球中.xml我有这个(来自修昔底德原型):
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.11</version>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
根据说明,我已将其更改为:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.11</version>
<!--
<configuration>
<skip>true</skip>
</configuration>
-->
<configuration>
<systemPropertyVariables>
<webdriver.driver>${webdriver.driver}</webdriver.driver>
</systemPropertyVariables>
</configuration>
</plugin>
我还更改了属性部分中的值:
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<thucydides.version>0.9.205</thucydides.version>
<thucydides.jbehave.version>0.9.205</thucydides.jbehave.version>
<!-- I have tried chrome too -->
<webdriver.driver>safari</webdriver.driver>
</properties>
但是我的测试仍在使用默认浏览器(Firefox)运行。 我在这里做错了什么?
我在systemPropertyVariables上遇到了同样的问题,我决定不要为此使用pom.xml。
您需要创建类 *TestSuite 并将其从类 ThucydidesJUnitStories 扩展。在构造函数中,您只需设置所需的属性。
import net.thucydides.core.ThucydidesSystemProperty;import net.thucydides.jbehave.ThucydidesJUnitStories;public class PremiumTestSuite 扩展了 ThucydidesJUnitStories {
public PremiumTestSuite() { System.setProperty("webdriver.chrome.driver", System.getProperty("user.home") + "/chromedriver"); getSystemConfiguration().setIfUndefined("webdriver.driver", "chrome"); getSystemConfiguration().setIfUndefined(ThucydidesSystemProperty.THUCYDIDES_STORE_HTML_SOURCE.getPropertyName(), "true"); getSystemConfiguration().setIfUndefined(ThucydidesSystemProperty.THUCYDIDES_TAKE_SCREENSHOTS.getPropertyName(), "FOR_FAILURES"); } }
我希望它能帮助你:)