GithubHelp home page GithubHelp logo

automation-test-capybara's Introduction

automation-test-capybara

BDD Software Automation Testing using capybara ruby, and cucumber.

Approach

The framework follows the following approach:

  1. Page Object Model (POM): The application's UI is divided into pages, and each page has its corresponding Page Object. This approach enhances code reusability and maintenance.

  2. Cucumber Features and Scenarios: Test scenarios are written using Gherkin syntax in feature files. Each scenario corresponds to a Cucumber step definition.

  3. Step Definitions: Step definitions are written using Capybara and Selenium to interact with the application and perform verifications.

  4. Assertions and Verifications: Assertions and verifications are placed within step definitions to ensure the application behaves as expected.

  5. Reporting: Cucumber generates human-readable HTML reports containing detailed test execution results.

Tech Stack

  1. Ruby (Programming Language)
  2. Capybara (Web Automation)
  3. Selenium (WebDriver)
  4. Cucumber (Behavior-Driven Development)
  5. Bundler (Dependency Management)

Minimum Prerequisites

  1. Ruby installed (version 3.2.2 is used for this repository)
  2. Chrome or Firefox browser installed

Installation

For more details how to install and setup

How to Setup (Mac)

  1. Install Homebrew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  1. Install RVM
curl -L get.rvm.io | bash -s stable
source ~/.bash_profile

Then run rvm requirements and follow the instructions

  1. Install Ruby 3.2.2
rvm install 3.2.2

And make sure you have used the right version

rvm list

To use the version 3.2.2

rvm use 3.2.2
  1. Clone the project
git clone [email protected]:fathirwafda/automation-test-capybara.git
cd automation-test-capybara
  1. Copy .env file
cp env.sample .env
  1. Install bundler
gem install bundler
  1. Run bundle install
bundle install # or `bundle` for simpler command
  1. Copy env (This .env can be used for store your value to be more flexible)
cp env.sample .env
  1. Go back to task_capybara_cucumber folder and run cucumber to make sure everything is installed

     bundle exec cucumber -p web-desktop --tag @purchase-product

Common Errors

  • JSON error when running bundle, update your XCode or run xcode-select --install

Running Tests

  1. Update the test data: Modify the test data, if required
  2. Run the tests using Cucumber:
bundle exec cucumber -p web-desktop --tag @purchase-product
  1. If you want to generate Cucumber reports:
bundle exec cucumber -p web-desktop --tag @purchase-product -f pretty -f html -o report.html -f json -o report.json

And open report.html by using a browser

Profiles

Profile configuration : config/cucumber.yml

Platform Command
Desktop bundle exec cucumber -p web-desktop

Folder Structure

├── config
├── features
│   ├── helper
│   ├── pages
│   │   
│   ├── scenarios
│   │   └── web
|   |
│   ├── step_definitions
│   ├── screenshots
|   ├── .env

automation-test-capybara's People

Contributors

fathirwafda avatar

Watchers

 avatar

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.