【问题标题】:Thucydides not respecting browser specified in pom.xml for project built from thucydides-jbehave-archetypeThucydides 不尊重 pom.xml 中为从 thucydides-jbehave-archetype 构建的项目指定的浏览器
【发布时间】:2014-12-11 20:39:20
【问题描述】:

我有一个从 thucydides-jbehave-archetype 构建的项目

我正在尝试按照这些步骤更改运行我的项目时运行 Thucydides 的浏览器L http://thucydides.info/docs/thucydides/_running_thucydides_in_different_browsers.html

在 pom.xml 中我有这个(来自 thucydides 原型):

        <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) 运行。我在这里做错了什么?

【问题讨论】:

    标签: webdriver thucydides


    【解决方案1】:

    我在 systemPropertyVariables 上遇到了同样的问题,我决定不为此使用 pom.xml。

    您需要创建类 *TestSuite 并从类 ThucydidesJUnitStories 扩展它。 在构造函数中,您只需设置所需的属性。

    导入 net.thucydides.core.ThucydidesSystemProperty;
    导入 net.thucydides.jbehave.ThucydidesJUnitStories;
    
    

    公共类 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"); } }

    希望对你有帮助:)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-04-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-27
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多