Protractor: Data driven testing

We can iterate jasmine "it" blocks with custom data easily by passing  some array or some other external objects as follows:

var testParams = testConfig.testArray; { it('write your test here', function() { //test code here }); });
Here we are using javascript map function without using any foreach loops as map function internally iterates over the passed array values the given "it"  block.

How to write custom failure messages for expect in Protractor/Jasmine reports

In Protractor ,We can override the error messaging in the Jasmine reporter by defining the custom matcher in the global scope and overrding the default message variable as follows:

beforeEach(function () { jasmine.addMatchers({ toReport: function () { return { compare: function (actual, expected, msg) { var result = {pass: actual == expected}; result.message = msg; return result; } } } }); });And it can be used in expect statements like below inside err function block:expect(false).toReport(true, "Unable to perform required operation because of " + err.message);

Simplified Test Automation Framework with Geb & Spock


Testing Webservice with SoapUI Having Windows Authentication

Sometims SoapUI doesn't seem to work directly with NTLM authentication, but you can use a proxy such as Burp Suite to do the auth for you.

Following are the steps you can perform:

Burp Suite Configuration
    Download Burp Suite from and set it up.
    On Burp's "Proxy : Intercept" tab, click the button to turn intercept off.
    On Burp's "Proxy : Options" tab, make sure it's set to an unused port, the default is 8081
    On Burp's "Options" tab, tick "do www authentication" and add a setting for the server you wish to hit. Also tick "prompt for credentials on authentication failure"
    Switch to Burp's "Proxy : History" tab so you can see requests going through.

SoapUI Settings
    In SoapUI, choose File > Preferences, then select "Proxy Settings". Enter Host "localhost" and port "8081".
    Use SoapUI as normal. It will send requests thro…

Cucumber and Capybara , How to Submit a Form Without a Button

Sometimes We run into  a problem where we need to submit a form after entering data but there is no specific button or link available on which we can perform operation to submit the I am going to suggest few solutions today for these situations in few different ways so that any one can use the solution depending on his specific situation.

Where we can hit "Enter" to submit the form:

We can access the selenium send_keys method to invoke a return event like
Using  java script:
 When /^I submit the form$/ do
Without Using java Script:
     we can handle this directly using Racktest(Capybara's default driver)
  When /^I submit the "([^\"]*)" form$/ do |form_id|
    element = find_by_id(form_id), element.native).submit :name => nil
Where we cannot hit "Enter" to submit :

  We can click…

How to Use Object Repository in Xml format In Selenium Webdriver

You can use XML as object repository like
 And you can use the code for retrieve the objects from xml below is the code:

How to Re-run Failed Scenarios in Cucumber

Usually we require to rerun the failed test cases again once they are fixed or for double verification.In cucumber we can do that easily without developing any customize code for it.

Cucumber directly supports the feature to re- run the failed test cases as following:

Run Cucumber with rerun formatter simply using :

cucumber -f rerun --out rerun.txt
It will output locations of all failed scenarios to the file.

Then you can rerun them by using

cucumber @rerun.txt
This can be further bundled as a rake task and can be run simply as :

require 'cucumber'
require 'cucumber/rake/task' do |t|
  cucumber -f rerun --out rerun.txt

  cucumber @rerun.txt

task :default => :jenkins_with_rerun
 And then can be run as simply "rake" inside the project folder: