Giter Club home page Giter Club logo

specloud's Introduction

SpecLoud

Use nosetests and plugins to take BDD specifications easier.

Installation

The easiest way to install specloud is using pip and requirements file:

$ pip install specloud

Usage

Get a python file with BDD-style test names (starting with it, ensure, should, must, spec, example, deve) and add them to the test suite

For example:

$ cat example.py

import unittest


class CalculatorSpec(unittest.TestCase):

    def it_should_sum_integers(self):
        # ...
        pass

    def should_not_divide_by_zero(self):
        # ...
        pass

    def must_accept_floats(self):
        # ...
        pass

    def ensure_it_work_with_fractions(self):
        # ...
        pass

    def test_subtract_positive_from_negative_numbers(self):
        # ...
        pass

    def deve_calcular_raizes_quadradas(self):
        # ...
        pass

The command line tool specloud colorizes green for tests with no failures and no errors and red for tests with failures and/or errors:

$ specloud example.py

Calculator spec
- ensure it work with fractions
- it should sum integers
- must accept floats
- should not divide by zero
- subtract positive from negative numbers
- deve calcular raizes quadradas

----------------------------------------------------------------------
Ran 6 tests in 0.003s

OK

How It Works

SpecLoud is a python package that install nose, pinocchio and figleaf packages, so it can call nosetests with pinocchio and figleaf plugins. nosetests is called with some default options to find test methods and pinocchio to show pretty and colored messages. figleaf is just pinocchio dependency.

A call to:

$ specloud FILE

is the same doing:

$ nosetests -i '^(it|ensure|must|should|specs?|examples?|deve)' -i '(specs?(.py)?|examples?(.py)?)$' '--with-spec' '--spec-color'

Old Name

The project was born as a proof of concept and I named it firstly pyunitbdd. But that's a terrible name. So I renamed the project to specloud.

Bitdeli badge

specloud's People

Contributors

hltbra avatar romulomachado avatar mkwiatkowski avatar tarsisazevedo avatar bitdeli-chef avatar douglascamata avatar hugomaiavieira avatar

Stargazers

Eugene Oskin avatar Angus H. avatar Neil Ortega avatar Sliim avatar Omer Katz avatar Hugo Lopes Tavares avatar  avatar Bernardo avatar Wéslleymberg Lisboa avatar Felipe Duarte avatar Douglas Soares de Andrade avatar Jordan Dea-Mattson avatar Alexander Petrovich avatar Diogo Baeder avatar Álvaro Justen avatar Rafael Gonçalves avatar  avatar Claudio Acciaresi avatar OldhamMade avatar Fernando Carvalho avatar  avatar J. B. Rainsberger avatar  avatar Danilo Cabello avatar Matías Agustín Méndez avatar  avatar Avelino avatar Tom Mortimer-Jones avatar Chuck Collins avatar Ask Solem avatar Charleno Pires avatar

Watchers

 avatar Felipe Duarte avatar James Cloos avatar

specloud's Issues

Update nose version

Specloud just works with nose 0.11.4, but the newest nose version is 1.0.

Add ability for spec "stubs"

There's as of yet no way to create an "empty" spec that doesn't implicitly pass but also doesn't fail. For instance, since specloud is used for BDD, one may wish to create the specification for a whole project but not implement any of the methods. However, since all the tests must pass, one is unable to work iteratively to make a subset of the tests pass to implement individual features.

It would be useful to be able to create spec "stubs", so one can use specloud to "plan" the project and then iteratively implement features.

I would see this as doing the following:

class PlannedFeatureSpec(unittest.TestCase):
    def it_must_do_something_new(self):
        raise NotImplemented()

This then would show up as orange in the specloud output and be ignored so that if it were the only spec the suite would still pass.

Hope this makes sense!

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.