Coder Social home page Coder Social logo

kaminrunde / bdd-acceptance-test-suite-stub Goto Github PK

View Code? Open in Web Editor NEW

This project forked from openwebcraft/bdd-acceptance-test-suite-stub

0.0 3.0 1.0 144 KB

The stub for a Behavior Driven Development (BDD) Acceptance Test Suite using Cucumber + Capybara + Selenium WebDriver.

Ruby 100.00%

bdd-acceptance-test-suite-stub's Introduction

bdd-acceptance-test-suite-stub

The stub for a Behavior Driven Development (BDD) Acceptance Test Suite using Cucumber + Capybara + Selenium WebDriver + RSpec [+ Sauce Labs, optional].

Prerequisits

You need Ruby and Bundler installed.

Note: If you're using a ruby manager (e.g. Ruby Version Manager (RVM)): the project ships with .ruby-version and .ruby-gemset files that will require ruby-1.9.3-p448 and assures that a project-specific gemset (bdd-acceptance-test-suite-stub) exists.

In order to run your tests on the Sauce Labs Cloud Testing Platform you need to have a Sauce Labs account.

Usage

Initial Setup (one-time)

git clone [email protected]:openwebcraft/bdd-acceptance-test-suite-stub.git
cd bdd-acceptance-test-suite-stub
bundle install

Writing your tests

  1. Describe behaviour in plain text, e.g. features/google/google_search.feature.
  2. Write a step definition in Ruby, e.g. features(step_definitions/google_steps.rb). Good starting point for newbies: Step Definitions (Cucumber Wiki).
  3. Run and watch it fail...
  4. Write code to make the step pass...
  5. Run again and see the step pass
  6. Repeat 2-5 until all green. :-)

Running your tests locally

Run your tests with:

bundle exec cucumber

The above should produce an output that looks like this:

Feature: Google Search
  As a user of Google Search
  I want to be able to get relevant results for my search query
  In order to find what I'm looking for

  Scenario: Searching for a term                      # features/google/google_search.feature:6
    Given I am on google.com                          # features/step_definitions/google_steps.rb:1
    When I enter "the answer to the question of life" # features/step_definitions/google_steps.rb:5
    Then I should see a list of results               # features/step_definitions/google_steps.rb:9
    And I should see "42" in the results              # features/step_definitions/google_steps.rb:13

1 scenario (1 passed)
4 steps (4 passed)
0m9.440s

Running your tests on Sauce Labs

The project ships with a ready to use integration with Sauce Labs - a Mobile and Web App Cloud Testing Platform.

In order to run your tests on Sauce Labs you need to set up the Sauce Gem.

By adding the Sauce Labs credentials as environment variables your keeping them out of your repositories and available to all your Sauce Labs tools using projects.

Open ~/.bash_profile and add the following lines:

export SAUCE_USERNAME= export SAUCE_ACCESS_KEY=<access_key>

You'll then need to re-load that profile with source ~/.bash_profile.

The integration is enabled by way of the @selenium tag in Cucumber. So edit your *.features files and add the tag to each of the Features you would like to test using Sauce Labs. E.g. for the Feature: Google Search in features/google/google_search.feature:

@selenium
Feature: Google Search
  As a user of Google Search 
  I want to be able to get relevant results for my search query
  In order to find what I'm looking for

    Scenario: Searching for a term
      Given I am on google.com
      When I enter "the answer to the question of life"
      Then I should see a list of results
      And I should see "42" in the results 

Run your tests with:

bundle exec cucumber

The above should then produce an output that looks like this:

@selenium
Feature: Google Search
  As a user of Google Search
  I want to be able to get relevant results for my search query
  In order to find what I'm looking for

  Scenario: Searching for a term                      # features/google/google_search.feature:7
[Connecting to Sauce Labs...]
    Given I am on google.com                          # features/step_definitions/google_steps.rb:1
    When I enter "the answer to the question of life" # features/step_definitions/google_steps.rb:5
    Then I should see a list of results               # features/step_definitions/google_steps.rb:9
    And I should see "42" in the results              # features/step_definitions/google_steps.rb:13
    Given I am on google.com                          # features/step_definitions/google_steps.rb:1
    When I enter "the answer to the question of life" # features/step_definitions/google_steps.rb:5
    Then I should see a list of results               # features/step_definitions/google_steps.rb:9
    And I should see "42" in the results              # features/step_definitions/google_steps.rb:13
    Given I am on google.com                          # features/step_definitions/google_steps.rb:1
    When I enter "the answer to the question of life" # features/step_definitions/google_steps.rb:5
    Then I should see a list of results               # features/step_definitions/google_steps.rb:9
    And I should see "42" in the results              # features/step_definitions/google_steps.rb:13
    Given I am on google.com                          # features/step_definitions/google_steps.rb:1
    When I enter "the answer to the question of life" # features/step_definitions/google_steps.rb:5
    Then I should see a list of results               # features/step_definitions/google_steps.rb:9
    And I should see "42" in the results              # features/step_definitions/google_steps.rb:13

1 scenario (1 passed)Sauce Labs: Supported Device, OS, and Browser Platforms
2m32.169s

You can configure your desired test platforms in the file spec/sauce_helper.rb.

For available platforms check out Sauce Labs: Supported Device, OS, and Browser Platforms.

bdd-acceptance-test-suite-stub's People

Contributors

semanticdreamer avatar reiner23fx avatar

Watchers

 avatar James Cloos avatar  avatar

Forkers

reiner23fx

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.