Automation BDD

Dockerizing Cucumber-BDD and Ruby Friends

Docker

Docker is becoming incredibly popular in the recent days. Docker containers are lightweight and can be launched as required. Well, this post is about provisioning Cucumber-Capybara BDD framework inside docker in order to execute Cucumber scenario inside the containers. This will install all the supporting tools as mentioned in the BDDfire.

Docker-BDD on DockerHub

In order to setup, Ruby-Cucumber framework inside docker, I have created a Docker image on DockerHub, called ‘docker-bdd

docker-bdd

 

You can get click on image above to get to Docker-Hub and pull ‘docker-bdd‘.

Pulling Docker-BDD

Assuming you have Docker setup in your machine, you can launch docker vm. Please use docker docs in order to get you setup with docker.

Now, let’s pull the Docker image and let it provision

 

 

This  will pull Ruby docker image and start provisioning PhantomJS, RubyGems and BDDfire. You can find detailed build output on dockerhub. Build logs can be found here 

provision

Provisioning RubyGems

bddfire_gem_provision

 

Launch docker container

Assuming pull is success, we can now check that docker image is present. It should look something like this :

 

 

Now, We can launch container with following command:

Now that you should be inside the docker container and in the ‘/opt/bdd/cucumber’ directory with all the gems installed.

Now run BDDfire rake tasks inside containers using bundler.

You will see the cucumber scenario is passing with headless PhantomJS based driver Poltergeist.

passsing_test_container

You can add more scenarios and run them inside docker container.

Feel free to give it a try. Source code is on Github

Hook BDD into docker
https://github.com/Shashikant86/docker-bdd
3 forks.
2 stars.
0 open issues.
Recent commits:

Let me know if you got stuck !

Happy BDD !!

Watch Video Demo

 

  • Maria Morales

    Hi, I’m following this example but to execute bundle exec cucumber -p poltergeist

    I’ve the next error

    Then I should see “Sign in” # bddfire-1.9.4/lib/bddfire/web/web_steps.rb:10

    expected to find text “Sign in” in “Google+ Bu00FAsqueda Imu00E1genes Maps Play YouTube Noticias Gmail Mu00E1s Iniciar sesiu00F3n u00D7 Una forma mejor de navegar por la Web Descarga Google Chrome Espau00F1a Bu00FAsqueda avanzada Herramientas del idioma Google.es tambiu00E9n en: catalu00E0 galego euskara English Programas de publicidadSoluciones Empresariales+GoogleTodo acerca de GoogleGoogle.com u00A9 2016 – Privacidad – Condiciones” (RSpec::Expectations::ExpectationNotMetError)

    features/google.feature:7:in `Then I should see “Sign in”‘

    Failing Scenarios:

    cucumber -p poltergeist features/google.feature:4 # Scenario: View home page

    1 scenario (1 failed)

    3 steps (1 failed, 2 passed)

    Can you tell me, please?
    Thanks so much