通过 pom.xml 进行宁静配置
serenity configuration via pom.xml
我有一个 java 项目包含一些宁静测试。当我执行 mvn test verify -Dwebdriver.chrome.driver=c:\dev\applications\chrome\chromedriver-2.29.exe -Dwebdriver.driver=chrome
时,我的构建工作正常。
我想将两个 -D 属性添加到 Maven pom.xml 作为配置文件,因为它写在宁静文档中,但以下代码片段不起作用:
<profiles>
<profile>
<id>firefox</id>
<properties>
<webdriver.driver>firefox</webdriver.driver>
</properties>
</profile>
<profile>
<id>chrome</id>
<properties>
<webdriver.driver>chrome</webdriver.driver>
<webdriver.chrome.driver>c:\dev\applications\chrome\chromedriver-2.29.exe</webdriver.chrome.driver>
</properties>
</profile>
</profiles>
我使用的 Maven 命令:mvn clean test verify -Pchrome
我也尝试将变量添加到我的 pom.xml 作为系统变量,但它不起作用:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.20</version>
<configuration>
<systemPropertyVariables>
<webdriver.driver>chrome</webdriver.driver>
<webdriver.chrome.driver>c:/dev/applications/chrome/chromedriver-2.29.exe</webdriver.chrome.driver>
</systemPropertyVariables>
</configuration>
</plugin>
我的 pom 文件有什么问题?
我不知道出了什么问题,但在重新启动我的 IDE 后它现在可以正常工作了。我的 IDE 有一段时间是 运行(超过一周)。
我创建了一个简单的 "hello-world" 应用程序来演示 Serenity 和 JBehave 如何协同工作。 Link to the java project.
我有一个 java 项目包含一些宁静测试。当我执行 mvn test verify -Dwebdriver.chrome.driver=c:\dev\applications\chrome\chromedriver-2.29.exe -Dwebdriver.driver=chrome
时,我的构建工作正常。
我想将两个 -D 属性添加到 Maven pom.xml 作为配置文件,因为它写在宁静文档中,但以下代码片段不起作用:
<profiles>
<profile>
<id>firefox</id>
<properties>
<webdriver.driver>firefox</webdriver.driver>
</properties>
</profile>
<profile>
<id>chrome</id>
<properties>
<webdriver.driver>chrome</webdriver.driver>
<webdriver.chrome.driver>c:\dev\applications\chrome\chromedriver-2.29.exe</webdriver.chrome.driver>
</properties>
</profile>
</profiles>
我使用的 Maven 命令:mvn clean test verify -Pchrome
我也尝试将变量添加到我的 pom.xml 作为系统变量,但它不起作用:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.20</version>
<configuration>
<systemPropertyVariables>
<webdriver.driver>chrome</webdriver.driver>
<webdriver.chrome.driver>c:/dev/applications/chrome/chromedriver-2.29.exe</webdriver.chrome.driver>
</systemPropertyVariables>
</configuration>
</plugin>
我的 pom 文件有什么问题?
我不知道出了什么问题,但在重新启动我的 IDE 后它现在可以正常工作了。我的 IDE 有一段时间是 运行(超过一周)。
我创建了一个简单的 "hello-world" 应用程序来演示 Serenity 和 JBehave 如何协同工作。 Link to the java project.