Ardesco / driver-binary-downloader-maven-plugin

A Maven plugin that will download the WebDriver stand alone server executables for use in your mavenised Selenium project.
Apache License 2.0
92 stars 52 forks source link

selenium-standalone-server-plugin + surefire plugin #43

Closed rromanik closed 7 years ago

rromanik commented 7 years ago

Hi,

I've got a question. Is it possible to use maven-surefire-plugin with driver-binary-downloader-maven-plugin?

In the examples here it is used with maven-failsafe-plugin only. And when command

$ mvn clean verify

is run, failsafe plugin has already got right system variables for drivers, i.e. webdriver.chrome.driver.

But if surefire plugin is used, and the command

$ mvn clean test

is run, the system variables for webdriver are still unknown, and one has to run the command

$ mvn clean webdriver-binary-downloader:selenium test

Thanks, Roma

Ardesco commented 7 years ago

Yup it should work fine, however you should really be using the failsafe plugin for Selenium tests. Surefire is for unit tests that run in the test phase (surefire and failsafe are the same thing really, they just run in different phases).

If you really want to get it running in surefire you would need to add configuration that looks like this:

                   <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <version>2.19.1</version>
                        <configuration>
                            <systemPropertyVariables>
                                <!--Set properties passed in by the driver binary downloader-->
                                <phantomjs.binary.path>${phantomjs.binary.path}</phantomjs.binary.path>
                                <webdriver.chrome.driver>${webdriver.chrome.driver}</webdriver.chrome.driver>
                                <webdriver.ie.driver>${webdriver.ie.driver}</webdriver.ie.driver>
                                <webdriver.opera.driver>${webdriver.opera.driver}</webdriver.opera.driver>
                                <webdriver.gecko.driver>${webdriver.gecko.driver}</webdriver.gecko.driver>
                                <webdriver.edge.driver>${webdriver.edge.driver}</webdriver.edge.driver>
                            </systemPropertyVariables>
                        </configuration>
                    </plugin>