Run your Selenium driven tests in parallel using TestNG.

Sometime ago I came across this post:
http://rationaleemotions.wordpress.com/2013/07/31/parallel-webdriver-executions-using-testng/
And I thought it’d be good to have it in a repo to save you time setting up your own project.

Basically this example project runs JUnit tests in parallel using TestNG.
Tests are grouped by the browser in which they’re going to be executed (have a look at the TestNG XML Suite files in src/test/resources).
As you might have guessed to drive the browsers we use Selenium WebDriver 🙂
And of course you can run your tests locally or remotely using Selenium GRID.

You can find the repo here: https://github.com/kowalcj0/parallel-selenium-with-testng

And here’s a video showing this project in action 🙂

Replacing FF driver with Chrome in JBehave’s tutorial project

Hi All,

Recently I’ve started playing with JBehave or rather with their interesting extension JBehave-web

JBehave-Web is a collection of extension for JBehave that extend its capabilities in ways related to HTTP and the web.

As a starting point I tried running an example project available here: https://github.com/jbehave/jbehave-tutorial.
After getting bored with running all the tests in FF, I’ve decided to replace it with Chrome. Below is the short tut. describing how to do that 🙂

Steps to get you there:

  1. Download chrome driver
  2. Change the webDriver to a PropertyWebDriverProvider
  3. Set System Properties

Step 1)
Download chrome driver that suits your needs: http://code.google.com/p/chromedriver/downloads/list
Extract it wherever you want.

Step 2)
Change the webDriver from FirefoxWebDriverProvider to a PropertyWebDriverProvider that allows running your tests with Google Chrome.
Edit etsy-steps.xml located […]/jbehave-tutorial/etsy-stories-java-spring/src/main/resources/etsy-steps.xml
and replace a FirefoxWebDriverProvider bean with a PropertyWebDriverProvider:

<bean id="driverProvider" class="org.jbehave.web.selenium.PropertyWebDriverProvider" >
</bean>

Step 3)
To set System Properties, edit Maven’s etsy-stories-java-spring module config file: […]/jbehave-tutorial/etsy-stories-java-spring/pom.xml
Follow this xpath to add the new props in the right place:

/pom:project pom:build/pom:plugins/pom:plugin/ pom:executions/pom:execution[2]/pom:configuration

                <systemProperties>
                    <property>
                        <name>browser</name>
                        <value>chrome</value>
                    </property>
                    <property>
                        <name>webdriver.chrome.driver</name>
                        <value>filepath/to/the/chromedriver/you/extracted/in/step1</value>
                    </property>
                </systemProperties>

ps. in case you’ll encounter problems solving all the dependencies while running the demo project, just add repos listed below to your main project Maven config file: ([…]/jbehave-tutorial/pom.xml)

  <repositories>
    <repository>
      <id>jbehave-web-repo</id>
      <name>jbehave web repo</name>
      <url>https://nexus.codehaus.org/content/groups/snapshots-group</url>
    </repository>
  </repositories>

  <pluginRepositories>
    <pluginRepository>
      <id>codehausSnapshots</id>
      <name>Codehaus Snapshots</name>
      <releases>
        <enabled>false</enabled>
        <updatePolicy>always</updatePolicy>
        <checksumPolicy>warn</checksumPolicy>
      </releases>
      <snapshots>
        <enabled>true</enabled>
        <updatePolicy>never</updatePolicy>
        <checksumPolicy>fail</checksumPolicy>
      </snapshots>
      <url>https://nexus.codehaus.org/content/groups/snapshots-group</url>
      <layout>default</layout>
    </pluginRepository>
  </pluginRepositories>

Cheers,
J