All Projects → hitchdev → hitchstory

hitchdev / hitchstory

Licence: MIT License
Type-safe, StrictYAML based BDD framework for python.

Programming Languages

python
139335 projects - #7 most used programming language
Jinja
831 projects

Projects that are alternatives of or similar to hitchstory

eggplant
A behaviour driven development (BDD) library for Clojure. Simplicity is key.
Stars: ✭ 16 (-33.33%)
Mutual labels:  bdd, bdd-specs, specification, bdd-framework, bdd-tests
kekiri
A .NET framework that supports writing low-ceremony BDD tests using Gherkin language
Stars: ✭ 19 (-20.83%)
Mutual labels:  bdd, specification, bdd-framework
kheera-testrunner-android
BDD Framework for Android
Stars: ✭ 18 (-25%)
Mutual labels:  bdd, bdd-framework, testing-framework
Behat
BDD in PHP
Stars: ✭ 3,696 (+15300%)
Mutual labels:  bdd, documentation-tool, behavior-driven-development
django-aloe-bdd
BDD with Django and Aloe
Stars: ✭ 27 (+12.5%)
Mutual labels:  bdd, behavior-driven-development
mutest
A BDD testing framework for C, inspired by Mocha
Stars: ✭ 22 (-8.33%)
Mutual labels:  bdd-framework, bdd-style-testing-framework
PixelTest
Fast, modern, simple iOS snapshot testing written purely in Swift.
Stars: ✭ 56 (+133.33%)
Mutual labels:  tests, testing-framework
bdd
Given/When/Then/And/But output to RSpec and Minitest
Stars: ✭ 33 (+37.5%)
Mutual labels:  bdd, tests
Bandit
Human-friendly unit testing for C++11
Stars: ✭ 240 (+900%)
Mutual labels:  bdd, testing-framework
karate
Test Automation Made Simple
Stars: ✭ 6,384 (+26500%)
Mutual labels:  bdd, testing-framework
scenari
Clojure BDD library - Executable Specification with Behavior-Driven Development
Stars: ✭ 57 (+137.5%)
Mutual labels:  bdd, behavior-driven-development
tinyspec
Simple syntax for describing REST APIs
Stars: ✭ 95 (+295.83%)
Mutual labels:  documentation-tool, specification
Swagger meqa
Auto generate and run tests using swagger/OpenAPI spec, no coding needed
Stars: ✭ 151 (+529.17%)
Mutual labels:  yaml, testing-framework
rspec-tap-formatters
TAP Producer for RSpec-3
Stars: ✭ 20 (-16.67%)
Mutual labels:  behavior-driven-development, bdd-tests
Xcodegen
A Swift command line tool for generating your Xcode project
Stars: ✭ 5,032 (+20866.67%)
Mutual labels:  yaml, specification
bdd
JUnit 5 based BDD library to create and run stories and behaviors a.k.a BDD specification tests
Stars: ✭ 25 (+4.17%)
Mutual labels:  bdd, bdd-framework
karate-runner
VSCode Extension for Karate
Stars: ✭ 23 (-4.17%)
Mutual labels:  bdd, testing-framework
Gauge
Light weight cross-platform test automation
Stars: ✭ 2,622 (+10825%)
Mutual labels:  bdd, behavior-driven-development
Pester
Pester is the ubiquitous test and mock framework for PowerShell.
Stars: ✭ 2,620 (+10816.67%)
Mutual labels:  bdd, bdd-framework
Awesome-Cucumber
A collection of awesome Cucumber and Gherkin-related resources
Stars: ✭ 33 (+37.5%)
Mutual labels:  bdd, bdd-framework

HitchStory

HitchStory is a python 3 testing and living documentation framework for building easily maintained example driven executable specifications (sometimes dubbed acceptance tests).

It was designed initially to make realistic testing of code less of a goddamn chore so the tests would actually get written and run.

The executable specifications can be written to specify and test applications at any level and have been used successfully to replace traditional low level unit tests, integration tests and end to end tests with easier to maintain tests.

The specifications are written using StrictYAML and the code to execute them is written by you, in python.

Example

example.story:

Logged in:
  given:
    website: /login  # preconditions
  steps:
  - Form filled:
      username: AzureDiamond
      password: hunter2
  - Clicked: login


Email sent:
  about: |
    The most basic email with no subject, cc or bcc
    set.
  based on: logged in             # inherits from and continues from test above
  steps:
  - Clicked: new email
  - Form filled:
      to: [email protected]
      contents: |                # long form text
        Hey guys,

        I think I got hacked!
  - Clicked: send email
  - Email was sent

engine.py:

from hitchstory import BaseEngine, GivenDefinition, GivenProperty
from mockemailchecker import email_was_sent
from mockselenium import Webdriver
from strictyaml import Str

class Engine(BaseEngine):
    given_definition = GivenDefinition(
        website=GivenProperty(Str()),
    )

    def set_up(self):
        self.driver = Webdriver()
        self.driver.visit(
            "http://localhost:5000{0}".format(self.given['website'])
        )

    def form_filled(self, **textboxes):
        for name, contents in sorted(textboxes.items()):
            self.driver.fill_form(name, contents)

    def clicked(self, name):
        self.driver.click(name)

    def email_was_sent(self):
        email_was_sent()
from hitchstory import StoryCollection
from pathquery import pathquery
from engine import Engine

StoryCollection(pathquery(".").ext("story"), Engine()).named("Email sent").play()

Will output:

RUNNING Email sent in /path/to/example.story ...
Visiting http://localhost:5000/login
Entering text hunter2 in password
Entering text AzureDiamond in username
Clicking on login
Clicking on new email
In contents entering text:
Hey guys,

I think I got hacked!


Entering text [email protected] in to
Clicking on send email
Email was sent
SUCCESS in 0.1 seconds.

Installation and set up

You can install hitchstory through pypi in any python 3 virtualenv:

$ pip install hitchstory

However, it's recommended to install and set up hitchstory with hitchkey, which will take care of automatically setting up a up the recommended hitchstory environment.

Either install hitchkey with pipsi:

pipsi install hitchkey

Or, if you'd prefer, you can safely install with "sudo pip":

sudo pip install hitchkey

Once hitchkey is installed:

Example demo of hitchstory basics:

cd temp
hk --demo hitchstory ; hk bdd email

Example python API test demo (uses game of life):

cd temp
hk --demo pythonapi ; cd pythonapi ; hk bdd

Using HitchStory

Approach to using HitchStory

Best practices, how the tool was meant to be used, etc.

Design decisions and principles

Somewhat controversial design decisions are justified here.

Why not X instead?

There are several tools you can use instead, this is why you should use this one instead:

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].