With the last entry, we analyzed the App Under Test, Dave Haeffner's The-Internet and came up with some test specifications. With this entry, we will be setting up the Ruby environment that will be running the Capybara-Gauge tests.
Although I am developing this project on my Macbook with this example, it is possible to install Ruby, Gauge on a Windows Machine. See my article, Intro to setting up a BDD framework with VS Code + Gauge + Ruby.
Create a New Directory For Capybara-Gauge Project
Coding projects, I store in my Home directory, under the /src directory. Let's create a new folder for the project, called capybara-gauge. Firing up the Mac Terminal, I can go to Home by using the shortcut to change the directory to it: cd ~
- cd ~/src
- mkdir capybara-gauge
- cd capybara-gauge
Check If Ruby Is Installed
Do you already have Ruby installed? In the Mac Terminal:- ruby -v
No Ruby? Install It With RBENV!
Do you have the Homebrew package manager on your Macbook? It installs many helpful packages for the MacOS. Check to see if you have it by:- brew -v
- /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
- brew install rbenv
- rbenv install --list
- rbenv install 2.5.1
Bring on the Bundler!
Want an easy way to update all your Ruby dependencies? Bring on the Bundler! To install Bundler:- gem install bundler
What is a Ruby gem? From Guides.RubyGems.Org:
"The RubyGems software allows you to easily download, install, and use ruby software packages on your system. The software package is called a 'gem' which contains a packaged Ruby application or library.
"Gems can be used to extend or modify functionality in Ruby applications. Commonly they’re used to distribute reusable functionality that is shared with other Rubyists for use in their applications and libraries. Some gems provide command line utilities to help automate tasks and speed up your work".
... This is like how we used Maven to help build Java projects, storing items in the MvnRepository.com.
From Bundler's GitHub project:
"Bundler makes sure Ruby applications run the same code on every machine.
"It does this by managing the gems that the application depends on. Given a list of gems, it can automatically download and install those gems, as well as any other gems needed by the gems that are listed. Before installing gems, it checks the versions of every gem to make sure that they are compatible, and can all be loaded at the same time. After the gems have been installed, Bundler can help you update some or all of them when new versions become available. Finally, it records the exact versions that have been installed, so that others can install the exact same gems".
... If you also want to learn even more about Bundler, check their site and read, What is Bundler?
Install Gauge-Ruby
We've covered ThoughtWorks Gauge, a human readable way to set up tests, quite extensively on this blog:
- Chapter Excerpt: How To Gauge What Your Tests Are Doing
- A Brief Overview of Gauge, a BDD Automation Framework, brought to you by Thoughtworks!
We will be following the documentation in Docs.Gauge.Org for the Latest Installation:
To install Gauge via Homebrew:
- brew install gauge
- gauge install ruby
- gauge install html-report
- gauge install xml-report
- gauge install json-report
- html-report results, displayed through GitHub's HTML Preview
- xml-report results: Not very detailed
- json-report results: Very detailed!
Scaffold Initial Gauge-Ruby Project
To build out scaffolding for your first Gauge project:- gauge init ruby
Run the command:
- bundle exec gauge run specs/
It also runs two mock tests, checking that given a word, it can count vowels in single or multiple words. Need more information? Run the tests in verbose mode!
- bundle exec gauge run specs/ -v
View The Project
Open the project using your favorite IDE (Integrated Development Environment) or text editor such as RubyMine, Atom.io, VS Code or Sublime Text Editor... Though, at the time of this writing, only VS Code supports a Gauge debugger.
You will see a structure much like this: https://github.com/tjmaher/gauge_0.9.7_default_code
The important parts:
- Specs: The specifications for your application, used for testing purposes. This is where we will putting the test scenarios we came up with last time.
- Step Implementations: Joining the steps listed in the specs with code to act out what is needed in the tests.
- Reports: View what passed and what failed in the HTML Reports.
- Gemfile: Where we store our Ruby dependencies.
Happy Testing!
Basic Capybara-Gauge:
- Part One: Analyzing The-Internet
- Part Two: Setup Ruby Environment
- Part Three: Setup Capybara to Test Opening Chrome
- Part Four: Add Option For Chrome Headless
- Part Five: Add Test Steps and Spec Implementations
- Part Six: Setup Chrome and ChromeDriver Logging
- Part Seven: Rubocop Code Review
- Source Code: https://github.com/tjmaher/capybara-gauge
-T.J. Maher
Sr. QA Engineer, Software Engineer in Test
Meetup Organizer, Ministry of Testing - Boston
Twitter | YouTube | LinkedIn | Articles
24 comments:
this is a very good and interesting site thanks for sharing this with us showboxapk-official.com/showbox-apk-latest-version-5-35
Cool stuff you have and you keep overhaul every one of us
checkiqamaonline.com/iqama-application-family
If your looking for Online Illinois license plate sticker renewals then you have need to come to the right place mobdro apk for iphone
How may want to having no Internet have an effect on the general non-public individual?is it better to use online fax or email for documents
This blog has very distinct features. Thanks
successful solution method bonus
https://thebreakthroughreview.com/
I’m eager to find the valuable information and for me this is the right place to get the good stuff.
asfsafaffa
Extremely proactive and collaborative in their approach,best UI design team takes a genuine interest in the success of the company's products and goals.
Look long and hard at your marketing programs and be impartial about which ones are worth spending energy on and which ones need to be dropped. learn this here now
It is the way in which products or services are promoted and sold over the Internet. Internet marketing, also called web marketing, online-marketing and even "i" or "e" -Marketing uses the Internet to deliver all types of media to a global and even local market. Lead generation
dsf
this is the best website i love that "Dental Assistant Courses Near Me"
The soap packaging | soap packaging are as extraordinary as they are unique and work wonders for businesses Custom Printing Services.co.uk is aiming at creating boxes from extremely biodegradable material. They taking small stores to local domination, to national level brands to multi-national organization.
They also enjoyed the ability to think from the perspective of targeted users, and would highly recommend them.
branding firm in San Francisco
It is important to have a single point of contact for your project to ensure nothing gets lost in translation. A Project Manager should be assigned to all web projects. If you are working with a small web company, however, the Project Manager may also be the web designer and/or web developer himself. https://www.sandeepmehta.co.in/affordable-seo-services-delhi/
Immerse yourself in the goodness of our SEO services Delhi. Our offerings and discounts are one of a kind, without leaving any room for inconsistencies. Email or call us as soon as possible! Seo Services Delhi
Our designs speak volumes for your brand and act as a prolific medium of communication for your objectives.
https://thewebgross.com/graphic-designing-services-delhi-india/
Great work! This is the kind of information that should be shared across the internet.
Disgrace on the search engines for not positioning this put up upper!
content writing company in delhi
travel content writer in delhi
This blog post has very informative inspired my thought.
https://thewebgross.com/content-writing-services-delhi-india/
This project seems to be interesting..
I really enjoyed while reading your article, the information you have mentioned in this post is really good. I am waiting for your upcoming post.
Software Testing – Beginner to Advanced Online Course in Delhi
Excel & Advanced Excel Training Course in Delhi, NCR
Basic- Advanced MS Office Training Course in Delhi
Tally ERP.9 Training Course in Delhi, NCR
A frequent mistake that businesses make is hiring an internet marketing company too quickly -- primarily based on price. Your website is a visual representation of your business and a poorly designed site can frustrate visitors, misrepresent your products and even lose sales. Before you hire a internet marketing firm, research the answers to these questions: Melbourne SEO company
Hey, Nice Article Please Checkout my website Advertising Agency in Hyderabad
APTRON Solutions believes in the power of practical learning. Our Excel and Advanced Excel Training Institute in Noida include real-world case studies and projects that help you apply what you've learned. You'll gain experience in solving actual business problems, preparing you to handle data analysis and reporting tasks confidently in any professional setting.
Post a Comment