简体   繁体   English

通过pom.xml配置serenity

[英]serenity configuration via pom.xml

I have a java project contains some serenity tests. 我有一个java项目包含一些宁静测试。 When I execute mvn test verify -Dwebdriver.chrome.driver=c:\\dev\\applications\\chrome\\chromedriver-2.29.exe -Dwebdriver.driver=chrome then my build works fine. 当我执行mvn test verify -Dwebdriver.chrome.driver=c:\\dev\\applications\\chrome\\chromedriver-2.29.exe -Dwebdriver.driver=chrome我的构建工作正常。

I would like to add the two -D properties to maven pom.xml as a profile as it is written in the serenity documentation but the following code snippet does not work: 我想将两个-D属性添加到maven pom.xml作为配置文件,因为它是在serenity文档中编写的,但以下代码片段不起作用:

<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 command what I used: mvn clean test verify -Pchrome Maven命令我用过的: mvn clean test verify -Pchrome

I also tried to add the variables to my pom.xml as system variables but it did not work: 我还尝试将变量添加到我的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>

What is wrong with my pom file? 我的pom文件出了什么问题?

I do not know what was wrong but it is working now after restarting my IDE. 我不知道出了什么问题,但现在重启我的IDE后它正在运行。 My IDE was running for a while (more then a week). 我的IDE运行了一段时间(超过一周)。

I created a simple "hello-world" application to demonstrate how Serenity and JBehave work together. 我创建了一个简单的“hello-world”应用程序来演示Serenity和JBehave如何协同工作。 Link to the java project . 链接到java项目

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM