June 18, 2018

Intro to setting up a BDD framework with VS Code + Gauge + Ruby

With Integrated Development Environments (IDE), I am quick to adopt whatever the rest of the developers on the team use. For Java development, I like IntelliJ IDEA Ultimate Edition. For JavaScript, Atom.io. And for writing the Capybara + Ruby framework, I have also been using Atom. The problem is that the BDD framework we are using at work -- Gauge -- has plugins that help refactor Gauge tests written in Java, but hasn't had anything for refactoring Gauge tests written in Ruby... until now.

With this blog article, I will be investigating Visual Studio Code -- commonly known as VS Code -- and how it helps refactor tests.

Why am I currently using Ruby for my automation framework if the BDD Framework hasn't supported it? Both Chef.io -- what I use to spin up virtual environments -- and GitLab.com -- the code storage / continuous integration environment also uses Ruby.

I've written a bit about Gauge and drafted a quick-and-dirty Gauge + Ruby + Selenium project, on this blog. With this experiment, we will be editing Gauge's built in project, setting up everything on my Windows 10 machine at home.

If you want to view a summary what the gauge-vscode can do, view the official docs on GitHub.

Setting Up VS Code + Ruby + Gauge

Setting up Ruby:

  • To set up the Ruby programming language on a Windows environment, follow the directions on RubyInstaller.org.
  • Note, there are many ways of installing Ruby. Here are a few examples.
  • Make sure to install the bundler gem from Bundle.iogem install bundler

Using Windows? Install Chocolatey:

  • Open the Command Prompt as Administrator
  • Follow instructions for  Install Chocolatey.org, the Windows Package Manager, copying the command text, and pasting it in the Windows command shell. 
  • Close and reopen your command prompt, running, again, as an administrator. 
Install Gauge:
  • Follow the prompts for installing Gauge at https://gauge.org/get-started.html
  • Once you have Chocolatey installed, it is: choco install gauge
  • Is gauge working? Type: gauge -v
Create New Gauge-Ruby project:
  • Create the subfolder where you want to keep the project. For this project, I went to C:\Users\tmaher\ and created a new folder, gauge-ruby. Enter the subfolder.
  • Initialize a new Gauge-Ruby project: gauge init ruby. 
  • After all project dependencies are downloaded and installed from Rubygems.org, make sure you can run the test project: bundle exec gauge run specs/
  • Want to see exactly what is happening? Run the project in verbose mode with -v: bundle exec gauge run specs/ -v
  • Are updates available?: gauge-update ruby
As you can see below, the sample project tallies up vowels "aeiou" (leaving out 'y'), in words such as "Gauge", "Mingle", "Snap", etc.

Output of the Gauge Sample Project.
... If you want to see what the code is doing, and don't feel like setting up a project, you can check out the code produced in the Gauge 0.9.7 project on my GitHub site

Setting up VS Code:

  • Downloads for Windows, Mac, or Linux is on the Code.VisualStudio.com Downloads page. 
  • VS Code wanted me to immediately wanted me to Download Git. I had uninstalled it since I wanted to upgrade to the new version. It provided a handy link to download, and I could set up VS Code as an editor. 
Install the Ruby plugin:
  • The Welcome page displayed a Customize widget that I was able to click in order to see the Exentions: Marketplace. I was able to scroll down to "Ruby" and click to install it. This is from Rubyide's vscode-ruby project. Like Atom.io, VS Code seems fast, lightweight, and able to be customized with various plugins. 
Welcome to VS Code!
Install the VS Code Gauge Plugin:

  • See the square thingy on the bottom? Hover your cursor over it, and it should tell you that it is Extensions. Select that, and search for the keyword "gauge". Select to install it. 

VS Code Welcome Screen

Now that we have everything set up, let's give everything a whirl!

  • Open up VS Code
  • Select File -> Open Folder, and open up your project. Mine was in C:\Users\tmaher\gauge-ruby
What a nice touch, ThoughtWorks! To help get us started, we are presented with a new dashboard. 

The Gauge Dashboard
  • Apply & Reload recommended changes. Add a workspace folder by going to File -> Add Folder to Workspace
  • Open the Command Palette: In VS Code, select View -> Command Palette, type in "Gauge" then select Gauge: Welcome, to go back to the Welcome screen.   
On the Welcome Screen, it provides:
  • Ways to learn the Gauge toolset by providing links to help you learn the Gauge terminologies, and how Gauge uses Markdown.
  • "Run All Specifications" runs the tests from inside VS Code. 
  • How to Report an Issue, Ask a Qustion, Chat, or go the the Google Group forum. 

Running Gauge Tests in VS Code

  • From UI: Opening the Command Palette, typing in "Gauge" and selecting "Gauge: Run All Specifications". You may need to raise the output panel to see the results. By default it only showed one or two lines of output. 
  • From Terminal: On the panel at the bottom, listing Problems, Output, Debug Console, and Terminal, select the Terminal tab. This will show either the Windows PowerShell or the Mac Terminal. Enter: bundle exec gauge run specs/

View Reports
  • Want to see reports? Select where it says "Successfully generated html-report", and it will output the location to the command line. Go there, press the Enter key, and the reports will be entered into your browser. 

I highly advise you to get used to executing things through the Terminal in VS Code, especially if you are used to Windows environments, like I am. The main thing that had been holding me back in my automation development career had been my fear of using the command line. It's easier. It's quicker. And it will get you working in the same way the software developers on your team are working. 

Finding Previously Defined Steps

Let's say you defined a step:

 step 'Vowels in English language are <vowels>.' do |vowels|  
  @vowels = vowels.scan(/./)  

This readable step, full of detail, can be hard to remember, when trying to implement it in a spec file.

If we open up the spec file, specs/example.specs, from the very moment we type a bullet point to add a new step, a popup is displayed showing all the previously designed steps. Enter a few more words, such as "language" and it will filter down to the step "Vowels in English language are..." 

Previously defined specs are shown

Rephrase Test Steps

Gauge uses Markdown as a theme to write tests. Each specification has a heading. Each scenario has a subheading. And each step is captured as a bullet point, which corresponds to a step implementation. 

When a test is executing, the spec takes the language of the step and attempts to match it to a phrase in the step implementation. What happens if you want to make changes to the wording? If you do not find all areas in the specs that match the step definition, things will start failing. 

What if we wanted to rephrase the step definition "The word <word> has <count> vowels." to read as: "There are <count> vowels in the word <word>"?

We could easily do it through the command line! Just like on the command line, we could go to the Terminal and type in:

gauge refactor "The word <word> has <count> vowels." "There are <count> vowels in the word <word>"

... This is a really nice start on a much needed plugin. I hope they come up with one for IntelliJ IDEA + Ruby and RubyMine!

Happy Testing!

-T.J. Maher
Sr. QA Engineer, Software Engineer in Test
Meetup Organizer, Ministry of Testing - Boston

Twitter | YouTube | LinkedIn | Articles


«Oldest   ‹Older   201 – 236 of 236
Pantum P2502W’s wifi system said...

If you want to setup the Pantum P2502W’s wifi system you will need to follow a few steps.

nexar dash cam said...

Thanks for great posting.

nexar dash cam troubleshooting wifi repeater login said...

In case you are having trouble locating the document or label containing the default log-in details of the router, search for the model and serial number on the router. wifi repeater login

NEXTBOX wifi extender setup said...

NEXTBOX wifi extender setup can be easily done by by using the WPS button or by using a web browser.

pix-link wifi repeater said...

To access the extender login page, just type in the web browser URL pix-link wifi repeater ip address , if you are facing trouble , visite us.

Sophia Martin said...

Hello Friends , if you are looking for website from where you can translate the Morsecode language into English language, you need to just click on translate morse code .

Victony WiFi AC1200 Extender Setup said...


Wavlink AC1200 WiFi Extender Setup

Camila Jones said...

Hello friends I am Camila jones, I am web developer and recently I have created a website from where you can check IP location of your devices with just one click on instant ip address lookup .

Anonymous said...

에볼플레이 먹튀검증 안전노리터

LG soundbar sn9yg said...

Here we are provide guide of install system update LG soundbar sn9yg .

Hyzom WiFi repeater said...

The Hyzom WiFi repeater is helpful in making your existing device internet range buff up. Here are the steps to the 2022 Newest Hyzom WiFi Range Extender Signal Booster setup .

identify crystals said...

Natural crystals are hard and clear, they are defined beautifully through nature. By scratching the crystal, the hardness of the crystal can be tested and it be known if it is real.

reset skill points said...

If you want to reset skill points in the game Ark survival evolved , visite us to get the process.

Paleoer WiFi Extender said...

The booster may not respond due to multiple causes. Here are some keys if the booster is unresponsive.

fritz repeater 1200 said...

Der Fritz Wifi Amplifier dient mit hervorragender Performance des Internetzugangs. Sie können das Gerät mit den hier angegebenen Schritten selbst wiederherstellen.

orbilogin.com said...

You can access the Orbi login page at orbilogin.com . If you do not know the default password, you can reset the password using the default SSID and default password. For the default SSID, it is "orbilogin" without quotation marks. For the default password, it is "password" without quotation marks.  Hope it helps.

Nighthawk router login said...

outers and software firewalls overlap in some ways, but each has its own advantages. If you already use a router, you can enable Windows netgear Firewall for security benefits without compromising actual performance. It is therefore recommended that you do both.

khuram Shahzad said...
This comment has been removed by the author.
khuram Shahzad said...

Merry Christmas and Happy Holidays! This time of year is a truly wonderful and magical one and Christmas is a holiday with a beautiful spirit and traditions .

Romantic Christmas Cards Messages

Victony wifi extender setup said...

Thanku for sharing For more information visit Victony AC1200 WiFi Extender Setup

MY.ARLO.COM said...

To start setting up your Arlo account, connect the Arlo base station to your home Wi-Fi network. For more information visit

Mywifiext.local said...

Thanku for sharing For more information visit How do i connect with mywifiext.local? default said...

Get your device connected to the router or internet and open up the web browsing engine of your choice. Now enter default IP address in the search bar and enter.

Canary camera said...

This Canary is the best smart home camera to protect your home. Its configuration and settlement process is undoubtedly too easy. To obtain more information about it, visit us .

Linksys RE6300 wifi Extender Setup said...

Thanku for sharing For more information visit

my arlo login said...

Thanku for sharing For more information visit MY.ARLO.COM

Arlo camera login said...

Thanku for sharing For more information visit My arlo login

Anonymous said...

We will go over various setup options for the MSRM US302 extender in this article. A well-known manufacturer of Wi-Fi routers and extenders is MSRM.For more information visit Coredy Wi-Fi Extender Setup

Netgear Router Setup said...

Thanku for sharing for more information visit Routerlogin.net

asus router said...

If the setup was perfect and you still aren’t able to access the internet. Then make sure that that your ethernet cable is properly plug into your computer.

TpLinkrepeater said...

Sometimes TpLinkrepeater takes too much time to load and it shows times out due to the slow internet connection. You can check the internet connectivity or change the position of the devices to get a stable connection in your house.

MI home security camera said...

MI home security camera assured you that your family and home will stay watchful and unassailable when you are out for your venture.

Netgear router login page said...

Do you wish to install the WiFi device and do you possess a router? If so, you have landed on the right page.For more information visit the official website that is

Router Login Setup



Have you had problems logging into the Orbi app? If so, sign in to your Orbi gadget through a web browser. You must go to the Orbilogin.net website to do this.For more information visit NETGEAR ORBI SETUP

hgjgjgj said...

[url=https://mwifexty.net/]Mywifiext Setup[/url]
Mywifiext setup is a web-based installation process to connect the Netgear WIFI extender to the main router or modem. If you are unfamiliar with the Netgear extender installation process we will help to guide you through the step-by-step instruction.

hgjgjgj said...

Mywifiext Setup
Mywifiext setup is a web-based installation process to connect the Netgear WIFI extender to the main router or modem. If you are unfamiliar with the Netgear extender installation process we will help to guide you through the step-by-step instruction.

«Oldest ‹Older   201 – 236 of 236   Newer› Newest»