12 Useful Gems for Automation Software Testing
Everyone makes mistakes, and software development is not an exception.
That’s why testing should be an essential part of a developer’s work. You may not think about it in the process, but the truth is simple: while some mistakes in the code won't affect the functionality of the software, the others can have costly or even dangerous outcomes.
Software testing at Netguru
Software testing is an everyday practice at Netguru. Web and mobile developers as well as Quality Assurance (QA) specialists share the responsibility of test writing. The developers write unit and functional tests to check their own code and fix the bugs to prevent them from reappearing. Among other tasks, the QA team members write acceptance and integration tests to check if the app works well from the user's perspective. Their QA tests click through the app, focusing on crucial features and main business values. If these tests encounter a bug, a QA specialist reports the bug and creates a ticket in JIRA to let the developer know about needed fixtures. The developer fixes the bug, but s/he also has to write a test that will prevent the bug from reappearing in the future.
Since all new software must be thoroughly tested, you can find many tools to save your time and effort doing that. But which ones are worth trying? Our teams use the following gems for automation software testing. We hope these will make the process easier and more accurate for you, too!
Gems for software testing
1. Capybara Screenshot
The Capybara Screenshot gem captures a screenshot of each failure in a test suite. Having easy access to screen shots of each fail is very handy when trying to quickly identify problems in steps that failed. You can find this gem in Matthew O'Riordan’s repository.
2. Rspec Instafail
The Rspec Instafail gem shows you the failing specs instantly. Passing specs are shown with a green dot. Spot this in Michael Grosser’s repo.
The SitePrism gem gives you a simple, clean and semantic DSL that describes your site with the Page Object Model. It is used with Capybara for automated acceptance testing. SitePrism was started by Nat Ritmeyer.
4. Factory Girl
The Factory Girl gem is a fixtures replacement. It supports many build strategies as well as support for several factories. Factory Girl is stored in the repository by thoughtbot.
The Launchy gem is in the helper class, used to launch cross-platform applications. This means application concepts such as browsers and email clients that are common on a variety of platforms can be launched externally from within Ruby. Check out Launchy in Jeremy Hinegardner’s repository.
6. Shoulda Matchers
The Shoulda Matchers gem provides one-liners compatible with Rspec and Minitest that test the common functionality of Rails. Without Shoulda Matchers, these tests would be much longer, more complicated, and prone to errors. This is another gem from the minds of thoughtbot.
7. Database Cleaner
The Database Cleaner gem is a set of strategies that clean out your Ruby database. This gives you a clean state for better testing. This gem can be found in Ernesto Tagwerker’s repo.
The WebMock gem is a library for stubbing, setting up, and verifying expected HTTP results requested in Ruby. It features matching identical URLs and headers in different representations, and provides support for unit tests. You can find WebMock in Bartosz Blimke’s repo.
The Timecop gem provides "time traveling, freezing and acceleration" powers to make it easier to test code that relies on time. It doesn't have any dependencies, so you can use it with all Ruby projects. You can check out Timecop in Travis Jeffery’s repository.
This gem for Ruby analyses code coverage. SimpleCov provides a clean API to filter, group, merge, format, and display the coverage data gathered in Ruby's built-in coverage library. The gem automatically caches and merges the tests results while generating reports, so that you know the blank spots you should still test. You can spot this gem in Christoph Olszowka's repository.
11. Email Spec
The Email Spec gem is a collection of Rspec and Mini Test matchers, as well as Cucumber steps that help test email applications in Ruby apps with Pony or ActionMailer. Email Spec was created by Ben Mabey.
The Faker gem (check it out on Benjamin Curtis’ repo) is a library that generates fake data such as names, addresses and telephone numbers. It is a very handy tool for providing realistic test results and to help with web development.
Try these cool testing tools to ensure all of your web and mobile apps work perfectly before you launch. Are there any other tools you would add to that list? Share them in a comment - we’d love to try your suggestions!