1

I have a project built from the thucydides-jbehave-archetype

I'm trying to follow these steps to change the browser that Thucydides is running with when I run my projectL http://thucydides.info/docs/thucydides/_running_thucydides_in_different_browsers.html

In the pom.xml I had this (which is from the thucydides archetype):

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.11</version>
            <configuration>
                <skip>true</skip>
            </configuration>
        </plugin>

and per the instructions, I have changed this to:

        <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>

and I also changed the value in my properties section:

<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>

but my tests are still running with the default browser (firefox). What am I doing wrong here?

Dave
  • 6,141
  • 2
  • 38
  • 65

1 Answers1

2

I've had the same problem with systemPropertyVariables and I've decided don't use pom.xml for this.

You need to create class *TestSuite and to extend it from class ThucydidesJUnitStories. In constructor you just set properties which you need.

import net.thucydides.core.ThucydidesSystemProperty;
import net.thucydides.jbehave.ThucydidesJUnitStories;

public class PremiumTestSuite extends 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"); } }

I hope it will help you :)

Sergii Tanchenko
  • 702
  • 6
  • 18