Giter VIP home page Giter VIP logo

cucumber_analytics's Introduction

CucumberAnalytics

Gem Version Dependency Status


Attention: The purpose and functionality provided by this gem has largely been superseded by the cuke_modeler gem and other gems that have been built on top of that gem. The only functionality that these new gems do not cover is that which falls outside the scope of feature files and the Gherkin language itself, so you should only need to use this gem if you need the functionality that involves step definitions.


The intention of this gem is to provide a useful mechanism by which to answer all of the burning questions that one might have about their Cucumber test base.

  • Did old features get removed and leave dead step definitions behind? Or perhaps the other way around and half of the steps in the code base are undefined?

  • Are there duplicate scenarios strewn about everywhere that only differ in their step arguments and could be reduced into a single outline?

  • Just how many different tags are there in this thing?

These are the kinds of questions that this gem aims to make answering easy, either through directly providing the answer or by providing sufficient tools that determining the answer yourself is just a few straightforward object manipulations away.

Installation

Add this line to your application's Gemfile:

gem 'cucumber_analytics'

And then execute:

$ bundle

Or install it yourself as:

$ gem install cucumber_analytics

Usage

First things first. Load up the gem code.

require 'cucumber_analytics'

Next, let's generate a model for our Cucumber suite.

  directory = CucumberAnalytics::Directory.new('path/to/the/code_directory')
  world = CucumberAnalytics::World

Now it's time to take a look around and see what we can see.

  all_tags = world.tags_in(directory)
  puts all_tags
  #=> ["@Unit", "@Fragile", "@wip", "@wip", "@Critical", "@Unit", "@wip", "@Deprecated", "@wip", "@wip"]

  puts all_tags.uniq
  #=> ["@Unit", "@Fragile", "@wip", "@Critical", "@Deprecated"]

  wip_tags = all_tags.select{ |tag| tag == '@wip' }

  puts wip_tags.count.to_f / all_tags.count
  #=> 0.5


  all_steps = world.steps_in(directory)
  puts all_steps.collect{ |step| step.base}
  #=> ["some step", "the user logs in", "the user will log in", "another step", "the user \"Bob\" logs in"]

So with a few simple commands we have discovered that there are five different tags in our codebase and that @wip tags account for half of all usages. We have also discovered that our team is creating several redundant steps that could be rewritten into a single, reusable step.

Other usages

And why stop there? There are so many other tools that can be built with a little analysis!

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

I'm always looking for new ways to poke at a testbase. Feature requests are welcome.

cucumber_analytics's People

Contributors

enkessler avatar

Watchers

 avatar  avatar  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.