Home > selenium > RSpec Reporting Tool

RSpec Reporting Tool

Reports play a vital role in software testing. It provides results and more information which is the basis of our analysis and recommendations as software quality assurance.

Rspec gem provides an easy way of generating a report in our Selenium tests. Here are important things to remember:

1. Include the following commands in your spec file.


2. Create a method in your session that will rename your selenium driver instance to “selenium_driver”. (See lines 22-24)


3. Run your spec in two ways:

Option 1: From the console, go to your spec folder and manually type below command right after you invoked “spec <spec_filename>.rb”

rspec command

e.g. spec user_spec.rb –require ‘rubygems,selenium/rspec/reporting/selenium_test_report_formatter’ –format=Selenium::RSpec::SeleniumTestReportFormatter:./reports/tests_report.html

where “user_spec.rb” is your spec filename

Option 2: Create a rake file  and require Rspec report formatter options, like the one below

rspec rakefile

From the console,

– go to the folder where you saved your rake file

– type rake -T or rake –tasks (this will display all the available tasks defined in your rakefile)

– invoked the task that will run your spec file by typing rake <task_name>, in my case ->> rake run:spec

Hint hint hint: Preferably intall ruby gem syntax to properly highlight the codes prior to running your tests.

And whalla! This setup will automatically generate an html report just like this everytime you run your spec files:

rspec report

Categories: selenium Tags: , , ,
  1. bhanu
    July 11, 2014 at 6:18 pm

    is there any way show the charts using rspec in ruby ??

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: