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_implementations/step_implementations.rb 
 step 'Vowels in English language are <vowels>.' do |vowels|  
  @vowels = vowels.scan(/./)  
 end  

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

251 comments:

«Oldest   ‹Older   201 – 251 of 251
Nick said...

If you need help on how to fix prescitech wifi extender setup So no need to worry, know our article on our website.

Nick said...

Thanks for sharing the most important information. we provide technical support. If you need any issues regarding find.synology.nas visit our website. Our technician 24 hours available.

olivia said...

To initiate the Netgear Router login, type your default gateway Routerlogin.net in the address bar of any browser compatible and then press enter. You may also sign in with an IP address. After logging in, users can set the router's wireless settings and alter them as needed. Contact us if you encounter issues with registration or setup procedure.

olivia said...

If you wish to access the administration page for Tp-Link routers, you can perform the tplinklogin process. Open any compatible browser, type in one of the gateways in the address bar and press enter. The login screen will appear, type in the default credentials and click login. The user will then be taken to the management website for the router. We have experts on call if you'd like to learn more about the procedure for logging into the router.
tplinklogin.net

oncasino said...

oncasino

edimaxext.setup said...

Thanks so much, for sharing the important information. we provide technical support. If you need any issues regarding edimaxext.setup visit our website. Our technician 24 hours available.

tplinkrepeater.net password said...

If you need help regarding how to fix tplinkrepeater.net password issue ? Then no need to worry, learn our article on our website.

Anonymous said...


Thanks so much for sharing this nice site.
tplinkrepeater password reset

Anonymous said...

Our team will provide you with a high-end solution for complex and irritating setup problems in
find my synology setup.

duoboost said...

Don't know how to set up a duoboost repeater ? We are here to help you. Just go through the website and complete your duoboost repeater login setup.

asus router setup said...

If you are searching for the asus router setup in an easy way ,then you can use the asus router app for the setup. The ASUS Router App scans automatically for nearby ASUS routers.So, you’ll enjoy fast, secure Wi-Fi without worrying about complex setup!

dlinkap said...

D-LINK N300 DAP-1330 comes with a smart signal indicator. Use it to find the best location to set it up. the Gigabit port will let you connect a wired device to it.You can easily set up your extender using the WPS button.

pranaytc said...

Itechmanthra is a digital marketing firm that takes a creative approach to its work. Each business must take its own method to succeed in today's digital world. With the support of a global team of professionals, we design tailored digital solutions for each of our clients in order to assist them in achieving their business goals. It also provides SEO Services

ascrack.org said...

Amazing blog! I really like the way you explained such information about this post to us. And the blog is really helpful for us on this website.

Extender Linksys said...

You can execute the Arris Router Login process with the help of the default IP address. After opening any compatible browser, fill in the default gateway in the browser's address bar and press enter. When the login window pops up, you will be prompted to key in the default login credentials and hit the Login button. If you have any doubts or confusion anywhere, chat with our experts at the end.
Arris Login

Extender Linksys said...

To begin with, the Netgear Orbi Login process, use the default gateway orbilogin.net. You can also take the help of the default IP address. You must use a compatible browser only and check if the devices are receiving a sufficient power supply. Got any doubts or confusion? Have a chat with our tech support team now.

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

192.168.10.1 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.
192.168.10.1 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...



ap.setup

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
MY.ARLO.COM

Mywifiext.local said...

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

myrepeater said...

If you want you can use the web browser TP-Link Deco M4 AC1200 Setup , to connect to a wireless network. This will be the network that was configured by you during the setup of the internet. Enter http://tplinkdeco.net or the LAN IP address which is shown on the Deco app in the address bar for logging into the web management page.

192.168.100.100 default said...

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

samsung TV said...

In оrder tо аvоid рerfоrming а hаrd reset withоut first аttemрting а sоft reset, yоu must first аttemрt tо resоlve the issue using а sоft reset.
samsung TV

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 .

Anonymous said...

To connect this wireless router with the internet, fix this WiFi system LAN port with the RJ45 cable and let’s enjoy its capable connection to the network. You can use this Rogers WIFi Router very perfectly with any standard home router.

Mywifiext.local said...

Thanku for sharing For more information visit
How do i connect with mywifiext.net setup page?

Nick said...

Unser Team bietet Ihnen eine High-End-Lösung für komplexe und lästige Einrichtungsprobleme bei der http //192.168.o.178.1

Alberto Thomas said...

For Dlink router login, connect your router to the computer through WiFi or an Ethernet cable. Launch a web browser and type the default dlinkrouter.local address in the address bar. After that, you will reach the Dlink router login page where you need to put down the default username and password to finally login to the router.

Alberto Thomas said...

The Asus router login process is very easy and simple. Type router.asus.com in the address bar of the web browser. Make sure you open the web browser on a device connected to your Asus router’s network. After that, you will see the Asus router login page requesting you to share the login username and password of the router.

Linksys RE6300 wifi Extender Setup said...

Thanku for sharing For more information visit 192.168.1.1

Mywifiext said...

To log in to your extender, enter mywifiext.net in your web browser. For more information, visit Netgear EAX15 Setup

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
MY.ARLO.COM

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