Back To Normal

Subscribe To Our E-Mail Newsletter

Showing posts with label capybara. Show all posts
Showing posts with label capybara. Show all posts

Sunday, June 22, 2014

Set TestData By Using Active Record


1. Create gem file(under test directory ) and add active record , Postgres and database cleaner gems, it will helpful to maintain consistent version.




2. Create database.rb file under support directory




Read More


Friday, June 20, 2014

Capybara methods

Read More


How to setup capybara with cucumber in 5 mins?


  •  create test directory  (mkdir  test)
  •  \curl -L https://get.rvm.io | bash -s stable —ruby 
  •  gem install cucumber
  •  gem install capybara
  •  mkdir features\support
  •  mkdir features\step_definitions

Capybara settings 

Create env.rb file under support folder with following content

require 'capybara/cucumber'
Capybara.default_driver = :selenium


Cucumber scenarios

 Create test.feature file under features folder 

Feature: Find the automationhints blog

  Scenario: Search for the blog
    Given I am on the Google homepage
    Then I will search for "automationhints.blogspot"
    Then I should see "Vijay Ragavan"


Step definitions for cucumber steps

Create my_steps.rb file under step_definitions directory.

Given(/^I am on the Google homepage$/) do
  visit 'http://www.google.co.in'
end

Then(/^I will search for "([^"]*)"$/) do |arg|
 fill_in 'gbqfq', :with => arg + "\n"

end

Then(/^I should see "([^"]*)"$/) do |text|
  page.should have_content(text)
end



RUN


Navigate to test folder in console and type command as "cucumber". it will run all scenarios which is part of feature files.




Read More


560 Free Online Courses

Top 200 universities launched 500 free online courses.  Please find the list here .