November 8, 2021

The Cheezy Internet: Composing tests using Cucumber and Gherkin

This is fourth in a series of blog posts. Care to go back to the beginning?

Following along with Jeff "Cheezy" Morgan's eBook, "Cucumber and Cheese: A Tester's Workshop" (2017), after setting up a development environment, we started creating in Ruby + Watir the basic building blocks for an automated test framework, as we saw in the last Adventures in Automation blog entry. 

Instead of going into great detail testing against the complex test site Jeff uses in Chapter 4: Cucumbers and Puppies of is book, with Sally's Puppy Adoption Agency, we are using the simpler test site, The-Internet https://the-internet.herokuapp.com/login, by Dave Haeffner. 

This blog post will explore scaffolding a site and composing acceptance tests using Cucumber and Gherkin. 

Scaffolding a Site Using TestGen

It's always a challenge for me when creating a new project to figure out where everything should go. What should the folder and file structure be? Luckily, Jeff Morgan created a Ruby gem called "testgen" which solves all of these problems. 
  • Change the directory to the src folder in your home directory: cd ~/src
  • Pick a name for your project, such as "cheezy_internet"
  • Install Jeff Morgan's Ruby gem testgen on your local machine: gem install testgen 
  • Use the Ruby gem testgen to create a new file hierarchy: testgen project cheezy_internet 

November 7, 2021

The Cheezy Internet: Writing Ruby + Watir tests for The-Internet

This is third in a series of blog posts. Care to go back to the beginning?

Last blog entry, based on Jeff "Cheezy" Morgan's LeanPub book, "Cucumbers and Cheese: A Tester's Workshop", we set up our local machine, wrote and executed our first Watir program. 

Based on his book, we are going to attempt to sketch out and write our first test against Dave Haeffner's sample login page on The-Internet at https://the-internet.herokuapp.com/login.

The-Internet / Login Page


Drafting a Test 

A sample test for The-Internet / Login could be:
  • Go to https://the-internet.herokuapp.com/login
  • Enter tomsmith into the username textbox.
  • Enter SuperSecretPassword! into the password textbox. 
  • Press the Login button. 
  • If the Secure Area page does not show "'Welcome to the Secure Area", fail the test.

November 6, 2021

The Cheezy Internet: Installing Ruby + Watir + Chromedriver + VS Code on Windows 10

This is second in a series of blog posts. Care to go back to the beginning?

For this exercise, we will be setting up a Windows 10 box for use as a development machine.

Macbooks are amazing machines. I love coding on them. Using the Mac Terminal in Homebrew. Dressing them up with decals, such as the glasses-and-tie decal my wife bought for my very first work laptop back at Fitbit-Boston.

Apple Logo Dressed in glasses and a tie
Love dressing up the Apple logo!

I definitely would not recommend using your work machine, if you have one, for anything but work and work-related activities. 

The problem is that when it comes to non-work related programming activities, it can leave for me, well, less glamourous and sparkly alternatives.  

My home computer always has been a Windows Desktop, a big ole workhorse to store the family photos and videos, ancient video games like the original StarCraft, old blog posts, articles, and essays. But they can be so hard to set up sometimes with the toolsets I need to put together an automation framework. 

Based on the information in Jeff "Cheezy" Morgan's LeanPub book, "Cucumbers and Cheese: A Tester's Workshop" (2017), we will start setting up our local machine. 

November 5, 2021

The Cheezy Internet: Creating a Ruby + Watir + Cucumber automation framework with Jeff Morgan's Page-Object gem

Greenfield projects have been rare in my automation development career. The programming language, the toolsets that help craft the automation frameworks, the methods that interact with the pages of the web  application under test, all have been selected long before I joined the software development team. 

My job as an automation developer is to get up to speed on the automation framework as fast as possible. To climb the steep learning curves quickly, I have been creating little toy projects, ever since my first automation development job at Fitbit-Boston back in 2015. Doing this, I get explore the tools and technologies used for automated testing, using similar source material testing against a simple test site.

Our source material for this current exercise will be Jeff "Cheezy" Morgan's LeanPub book, "Cucumbers and Cheese: A Tester's Workshop". Even though "Cucumbers and Cheese" was written in 2012 and last updated in 2017, it contains a treasure trove of information for beginning automation developers, walking the reader through building an automation framework in Ruby + Cucumber + Watir + Jeff's page-object Ruby gem. Jeff's application under test is a mock site, the Puppy Adoption Agency at http://puppies.herokuapp.com/

Our application under test for this project will be an old favorite of mine: The-Internet at https://the-internet.herokuapp.com/, created by Dave Haeffner. Dave Haeffner is the author of the SeleniumGuidebook.com -- which comes in C#, Java, JavaScript, Python, and Ruby editions -- and the very helpful blog ElementalSelenium.com.

Next week, we will start using the information in "Cucumbers and Cheese" to start building an automation framework, starting with setting up a test environment. 


Happy Testing!

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

Twitter | YouTubeLinkedIn | Articles

November 4, 2021

Just purchased a new automation development book, Cucumbers and Cheese: A Tester's Workshop

This morning, I just purchased Jeff "Cheezy" Morgan's LeanPub book, "Cucumbers and Cheese: A Tester's Workshophttps://leanpub.com/cucumber_and_cheese . 

Although this book came out in 2012 and was last updated in 2017, the Gherkin + Ruby + Watir + Page-Object Ruby Gem framework described was the basis of the initial framework my workplace uses. 

Related Links: 
... Can't wait to read it! 

About the Book:

"In Cucumber and Cheese, Cheezy shares the concepts that help teams succeed with ATDD (aka
BDD, story test-driven development, specification by example, business-facing tests that guide
development, take your pick). And he does this the best possible way - with examples. You can
work the examples along with Cheezy, who makes them accessible even to people with not-so-much
coding experience.

"Cucumber and Cheese isn’t just for web developers. The book works through examples for web
services, mobile apps, XML, native windows apps. You’ll even learn how to create test data by
example.

"The book includes essential seekrits such as how to handle Ajax and that pesky waiting for events
to occur. Cucumber and Cheese is soup to nuts, from general principles like page objects and Don’t
Repeat Yourself, to specifics for Rails developers on RSpec matchers and ActiveRecord reference
material.

"Cheezy has a gift for making you enjoy yourself so much, you might forget you’re learning
something you thought would be hard. Lots of examples! And puppies!"



About the Author: 

"Jeff “Cheezy” Morgan has been teaching classes and coaching teams on agile and lean techniques since early 2004. Most of his work has focused on the engineering practices used by developers and testers. For the past few years, he has experienced great success and recognition for his work in the area of Continuous Delivery.

"He is based out of Toronto and focused on bringing Industrial Logic’s passion for technical excellence, modern agile, and lean product management to the Canadian market. He is the author of Cucumber and Cheese, A Testers Workshop.

"You can meet him at most of the conferences around North America during the year or follow him on Twitter @chzy".


Happy Testing!

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

Twitter | YouTubeLinkedIn | Articles