Git Product home page Git Product logo

behat-analysis-extension's Introduction

Behat analysis extension

Latest Stable Version Build Status

Introduction

Why?

Well, I always start asking "why?" when encoutering some crazy project. So, I will start by answering this trivial question.

I've simply realised that the more a project grows, the more its FeatureContext also grows! Some of the ones I've worked on have more than 1000 lines of code and it suffers from the same maintainability issues than any other huge class. Many great tools already exists to provide solution against this drawback: OOP, SubContexts, PageObjectContext, ...

But still, sometimes you need to look at your past and try to improve what you've done and that's why I've done this extension!

This extension provides some basic analysis about your step definitions. For the moment, it focuses on rarely used steps and similar ones.

Installation

  1. Define dependencies in your composer.json:
{
    "require": {
        ...

            "gquemener/behat-analysis-extension": "~1.0"
    }
}
  1. Install/update your vendors:
    $ curl http://getcomposer.org/installer | php
    $ php composer.phar install
  1. Activate extension by specifying its class in your behat.yml:
    # behat.yml
    default:
        # ...
        extensions:
            Behat\AnalysisExtension\Extension: ~

Usage

After installation, a new analysis formatter should be available. Then, run your feature suite using it:

    $ bin/behat -fanalysis --dry-run

NB: It's recommended (but not mandatory) to run the analysis using the --dry-run option to accelerate the report generation.

Example

    $ bin/behat -fanalysis --dry-run
        ---------------------------------------------------------------------- 70
        ---------------------------------------------------------------------- 140
        ---------------------------------------------------------------------- 210
        ---------------------------------------------------------------------- 280
        ---------------------------------------------------------------------- 350
        ------------------------
        
        58 scenarios (58 skipped)
        374 steps (374 skipped)
        
        Behat Steps Analysis
        ====================
        40 steps were used once.
        The most used step is /^I am logged in as "([^"]*)"$/ with 58 calls.
        Some steps might be merged to reduce their implementation redundancy:
          - /^I am on the "([^"]*)" attribute page$/ and /^I am on the "([^"]*)" product page$/
          - /^I enable the product$/ and /^I disable the product$/
          - /^I enable the product$/ and /^I save the product$/
          - /^an enabled "([^"]*)" product$/ and /^a disabled "([^"]*)" product$/

Contribution

It is more than welcome as always!

Feel free to contact me on twitter @GildasQ or through the issue system.

behat-analysis-extension's People

Contributors

gquemener avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

tomslabs plamp

behat-analysis-extension's Issues

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.