Behat Vagrant install and local testing

Posted: 2014-03-03 09:25:00

Vagrant Setup

 

You can see the video here

 

This is a fork of Steve Power's work https://github.com/appnosteev

 

The goal here is to enable you to work locally in either Windows, Mac, Linux but using behat in an environment we can offer support in. After you are done with this install you will

  1. Have a working Vagrant install with behat working
  2. A website with the Behat Editor and integrated Report system
  3. Integration with Github so you can synchronize your work via the BehatEditor GUI
  4. Ability to trigger your Desktops browser from tests running in the Vagrant VM vai the website or command line.

 

Steps

 

Download and install Virtualbox

See the help info here https://www.virtualbox.org/

 

Download and install Vagrant

See the help here http://docs.vagrantup.com/v2/installation/index.html

You just need to get it installed so the executable works. The next steps will setup the VM

 

Download the Git Repo to a directory you will keep it in.

We will use this repo for now

https://github.com/alnutile/behat-vagrant

So go to the command line and type

 

git clone https://github.com/alnutile/behat-vagrant.git

 

then go into that folder

 

cd into that behat-vagrant directory

 

After you are in there type

 

vagrant up

 

And wait for about 5 minutes or so for it to build. It may ask you for a system password along the way.

 

Then update your host file for the new IP as seen in these docs

https://github.com/alnutile/behat-vagrant/blob/master/README.markdown

 

Linux and Mac

sudo vim /etc/hosts

 

Windows

http://www.howtogeek.com/howto/27350/beginner-geek-how-to-edit-your-hosts-file/

 

For any of these your IP will be

33.33.33.10 drupal.vbox.local

 

Once done you can visit the site http://drupal.vbox.local BUT still a few more steps.

 

Setting up your behat.yml file

Get your machines IP address

 

Then Edit your behat.yml file found in the folder you setup your Vagrant install

This file will assist you in running your local tests. Just find the file here

files.png

 

Then edit that file and add the lines seen here https://gist.github.com/alnutile/9273691 in the behat_after.yml

 

behatyml.png

Set that IP to your IP and set the browser to firefox or safari or chrome as needed.

 

Finally run the Selenium Server on your machine (not the vagrant box)

Got to https://code.google.com/p/selenium/downloads/detail?name=selenium-server-standalone-2.39.0.jar&can=2&q

 

Download and run by typing this in the folder you downloaded it to

 

java -jar selenium-server-standalone-2.39.0.jar

 

Now it will run in the background.

 

So now you can visit the website and run a test (not in Saucelabs yet)

 

Go to the URL http://drupal.vbox.local

log in admin/admin

Visit http://drupal.vbox.local/admin/behat/index

Click Add and for now just click

Screenshot 2014-02-28 12.53.36.png

to fill in a default wikipedia test. Then click “Run Test” and a new window should pop up on your computer for Firefox or Safari running the test. That is it!


Tags:

behat