Installing ruby with cucumber on a windows machine
- Download the latest Ruby 2.6.x with devkit on http://rubyinstaller.org/downloads/.
- Accept the terms
- Install Ruby in the default directory
- For example Ruby version 2.6 (64 bit) will be installed in C:\Ruby26-x64
- Check all 3 checkboxes
- And complete the installation
Installing the plugins
Now the installation of Ruby is complete, we can start installing the necessary plugins. These are so called “Gems” in Ruby. (A ruby is a gem, so the creators decided to call their plugins gems)
Copy the code written below and paste it in the CMD (right click, paste). While it's installing do not copy something else.
gem update --system gem install lapis_lazuli
For executing the test framework you need to have the following browsers installed: Firefox and Chrome To let the framework communicate with the browsers you need to download 2 drivers and place them in the ruby directory .../ruby/bin
- Download the latest version of chromedriver
- Download the latest version of geckodriver
- Unzip the downloaded files to
C:\Ruby\bin\(Or where else you've installed Ruby)
When ANSICON is installed the test results in CMD will be colored. This will greatly improve the readability when working with Cucumber
- Download the latest version of ANSICON
- Unzip the file to
- Open CMD and navigate to the directory
- Navigate to x64 (if you have a 64 bit machine) otherwise navigate to x86
- To go to the directory write something like
ansicon.exe -iand ansicon will be installed.
- Ansicon does not give a notification about the installation completed.
More information can be found here source
That's it! You're now ready to start setting up your cucumber project. You can read more about this in Creating your first ta project
Information about the Ruby installation
This section is for you to have a better understanding of what is happening during the installation. And what the commands we're using in CMD actually mean.
When we installed ruby, we checked a checkbox saying "Add ruby executables to your PATH". What we did here, was making ruby commands globally accessible in the CMD.
Now because these commands are global, we can go to devkit folder and write "ruby dk.rb install". Where we are actually saying: "Hey Ruby! I want you to look at this file dk.rb I have here and install it".
Same thing happens with "gem install lapis_lazuli": "Hey Ruby, I want you to do something with a gem, which is installing and the name is lapis_lazuli". After which Ruby is going to look online in their software system looking for a gem called lapis_lazuli.
Information about gems
Later in this tutorial we will install all required gems for Lapis Lazuli. A quick explanation about the gems we use:
|More information about gems that were installed|
||Will update all default gems installed with Ruby (can be outdated, even though you've just installed Ruby)|
||Gem that allows communication with browsers|
||Layer on top of Selenium that simplifies browser interaction|
||Test automation gem that will enforce best practices, forcing the TA engineer to produce better code.|
||The software that will run the scripts from console.|
Information about drivers for different browsers
In our example we downloaded the drivers for Chrome and Firefox. However, there are many more browsers around like Safari, Internet Explorer, Opera, etc... By not installing the driver you would get a error message once you try to execute the project. Trying to run in Chrome without its driver results in the following error:
Unable to find chromedriver. Please download the server from http://chromedriver.storage.googleapis.com/index.html and place it somewhere on your PATH. More info at https://github. com/SeleniumHQ/selenium/wiki/ChromeDriver. (Selenium::WebDriver::Error::WebDriverError)
To make sure you can use this project in your preferred browser look for example on the internet for "<browser name> driver selenium"