Background:
Libraries in programming language offer various capabilities. Jar in Java is equivalent to gem in Ruby. Often when people choose Ruby for Test Automation, there are open questions if Ruby can address the Test Automation needs/capabilities. Below is a list of capabilities that most Test Automation frameworks require. All of the capabilities have been done in Java for years, however due to the benefits of Ruby (growth phase, both script and oops, readable code, meta programming etc.), companies are adopting Ruby in many instances, especially for the Testing function.
The below capability matrix gives us a starting point to talk, does NOT necessarily mean that it is exhaustive and answers all questions. What I have experienced over years is the below matrix gives confidence to move forward with Ruby. I strongly advocate JRuby over MRI/Yarv if your environment already uses Java, because there is lots to leverage from Java World and JRuby helps you leverage/bride with Java world too. As always, there are no absolute answers for all problems (one size fits all) , however risk is minimized with JRuby than MRI/Yarv
Capability Matrix:
S.No | Functionality/Business value | Gem Name | Reference |
1 | Gherkin/ ATDD English like language | Cucumber | Reference |
2 | Web Browser Automation/ layer over selenium | Watir-webdriver | Reference |
3 | Web Browser Automation (the real one) / saucelabs | selenium-webdriver/saucelabs | Reference/Reference |
4 | Mainframe Automation | mainframe-client (te3270-jruby) | Reference |
5 | Mobile apps automation/ Object based identification | appium/frank/Calabash/Selenium/cloud platforms | Reference |
6 | Manage gem versions and dependencies | bundler | Reference |
7 | Ruby make / Define tasks much like Ant | Rake | Reference |
8 | Xml/html parser with xpath or css | Nokogiri | Reference |
9 | HTML Reports / Test Execution Reports | cucumber reports/dynamic_reports | Reference |
10 | Json/xml / surrogate services | json/multi_json/pinch_hitter | Reference |
11 | REST web service calls | rest-client/Net-http-client | Reference |
12 | SOAP web service handler | savon/Net-http-client | Reference |
13 | Parallel execution of tests on Selenium GRID | parallel-tests | Reference |
14 | Fake smtp email server to test emails | rumbster | Reference |
15 | Page object model design pattern | <define your own> | Reference |
16 | create cucumber project structure and directories | Download template or create with hand | Reference |
17 | Test Data | YAML | In built with Ruby |
18 | Randomize test data | faker | Reference |
19 | Debugging in RubyMine | debase | Reference |
20 | Logger for creating log files | log4jruby/logging | Reference |
21 | Access oracle database | ruby-oci8 | Reference |
22 | Run your own Gem server | Multiple options – open the reference link | Reference |
23 | Maintain your own gem repository | Geminabox | Reference |