Skip to content

caragpe/bdd_testing

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BDD Testing App

Overview

Automatic BDD testing tool for Com App.

Requisites

  • Ruby 2.4.1

  • Chromedriver-helper

    Installs the appropiate chromedriver executable in your gem path.

  • Capybara

    Simulates how a real user would interact with the app.

  • Cucumber

    Provides support for Behaviour-Driven Development. Executes specifications written using Gherkin syntax.

  • Site Prism

    DSL describing a web application using Page Object Model pattern, for use with Capybara in automated acceptance testing.

  • Selenium Webdriver

    Makes direct calls to the browser using each browser’s native support for automation.

  • Require_all

    Points to a directory and require all the requested files at once.

  • Dotenv

  • Minitest

  • Rake

Usage

The following rake task will execute the user_login cucumber profile:

user@localhost:~/bdd_project$ rake user_login

Setup

Create a copy of the file env.sample and name it .env. Modify the environmental variables accordingly.

Environmental variables

Mandatory

  • APP_URL
  • APP_USERNAME
  • APP_PASSWORD

Optional

n/a

Structure

The following tree represents the most important elements of this tool:

├── features
│   ├── pages
│   │   ├── sections/*.rb
│   │   └── *.rb
│   ├── step_definitions
│   │   └── *.rb
│   ├── support
│   │   ├── helpers/*.rb
│   │   └── env.rb
│   ├── *.feature
├── reports
├── .env
├── cucumber.yml
└── Rakefile

Features folder

Cucumber requires step_definitions/ folder, support/ folder and support/env.rb in order to execute the tests.

  • Pages folder : it will keep the page object models of our web application. Check out Site Prism in order to start defining these models.

  • Step_Definitions folder: implementation details of the steps the tool automates; they are written using Ruby & Capybara.

  • Support folder: contains env.rb, which will set up the testing environment. Capybara configuration will be set here.

If you are curious (and feel intreped) you can verify how cucumber create this skeleton:

user@localhost:~/bdd_project$ cucumber --init
  create features
  create features/step_definitions
  create features/support
  create features/support/env.rb

Please, do not do this on your current project unless you want to loose all your content.

Feature files

They provide a high-level description of the software features under test. For a complete reference, check Cucumber's Gherkin reference. As an example:

Feature: User can deposit money on his bank account

  Scenario: User makes a deposit of 100$
    Given the user has a bank account with 0$
    When the user deposits 100$ on his account
    Then the new balance of his account is 100$

Report folder

ToDo

Other files

.env

Enviromental variables used in the application

cucumber.yml

Contains cucumber profiles to be tested. The syntax is:

<profile_name>: -f pretty -f html -o reports/<html_output_file>.html --tags <profile_tag>

<profile_name> will be used in Rakefile to invoke the desired profile. Each one can have a different configuration.

<profile_tag> is the tag name given in the feature file, so you can group different test under a common tag. It starts with @ (for example, @user_login)

Rakefile

Describes which rake tasks are associated with the profiles previously defined on cucumber.yml . For example:

Cucumber::Rake::Task.new(:user_login) do |t|
  t.profile = 'all'
end

Contact

You can reach the author on github or by email [email protected]

License

TBD

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published