injinia
  • Welcome
  • Blog
  • contact
  • links
  • Hire Me!

Cucumber or rspec... or something else?

14/7/2016

0 Comments

 
Just to be clear, cucumber is not a testing tool, it is a collaboration and analysis tool. Rspec is a specification runner. With that out of the way, here is how I choose what format to write my "tests" in.
To start my decision process, I first look at what my goal is and what I'm doing. Am I doing a characterization test (or a "Panda Test" -M.Smith) of an existing application? Am I starting a project from scratch with business/user involvement? Is this a "testing" project? Is it a development project? Are there reporting or integration requirements? What is the audience? Who will be the user? Who will be the consumer?

Lots of things to think through, but I boil it down to two main categories: documentation or tests/development.

I like to keep things as open and transparent as possible. This means that I don't want to use something that those involved won't be able to easily consume or understand. If someone will be using/reviewing/contributing to these, then it needs to be presented in a way that they can easily use. Documentation then needs to be just that, not code. Tests and development can have code, but needs to be easily usable.

Cucumber handles the documentation side of things well. Adding the middle layer of step definitions (the tests) gives the middle layer for the testers and developers, and the page object layer gives the developers code that is abstracted from the rest of it. Cucumber is plain English, can be written in any editor/ide, and can be printed, pdfd, or whatever is needed. Steps and pages can be written in many different languages, and can be used for most of the different levels of testing.

Rspec handles testing and specifications, and gives a the ability for the specification and test to be in the same place. The formatting is more "code" like than documentation like.

I usually use cucumber for anything that I will be working on or sharing with anyone else, and rspec for unit testing work that will be reviewed or used by other developers.

There is an interesting project called turnip that combines the documentation style of cucumber (gherkin specifically) and the rspec runner...
Quick links:
  • cucumber
  • rspec
  • turnip
0 Comments

Your comment will be posted after it is approved.


Leave a Reply.

    Author

    Hi, my name is Clancey and I am a quality advocate, agile coach, scrum master, automator, and toolsmith.

    I help companies with agility and quality. To do this I end up automating a lot of things, functional testing and workflows being some of them.

    Clancey McNeal CTSM, CSM, A-CSM
    Getting started with ruby automation series
    1. Required Installs
    2. Tools
    3. Project Structure
    4. Page Objects

    Archives

    June 2023
    May 2023
    April 2023
    June 2021
    March 2020
    October 2016
    September 2016
    August 2016
    July 2016
    June 2016
    February 2014
    December 2013

    Categories

    All
    AI
    API
    Cucumber
    Espanso
    Getting Started
    Insomnia
    Mouse Without Borders
    Page Objects
    Python
    Rspec
    Ruby
    Setup
    Slack
    Sublime
    Tools
    Web Test Automation

    RSS Feed

Copyright injinia, images copyright Adachi Photography