All Projects → legshort → apple-mango

legshort / apple-mango

Licence: MIT license
Python BDD Pattern

Programming Languages

python
139335 projects - #7 most used programming language

Labels

Projects that are alternatives of or similar to apple-mango

Lightbdd
BDD framework allowing to create easy to read and maintain tests.
Stars: ✭ 195 (+983.33%)
Mutual labels:  tdd, bdd
Bandit
Human-friendly unit testing for C++11
Stars: ✭ 240 (+1233.33%)
Mutual labels:  tdd, bdd
Cucumber Rust
Cucumber testing framework for Rust. Fully native, no external test runners or dependencies.
Stars: ✭ 210 (+1066.67%)
Mutual labels:  tdd, bdd
Should.js
BDD style assertions for node.js -- test framework agnostic
Stars: ✭ 1,908 (+10500%)
Mutual labels:  tdd, bdd
tddd-starter
Laravel TDDD Starter App
Stars: ✭ 23 (+27.78%)
Mutual labels:  tdd, bdd
Spek
A specification framework for Kotlin
Stars: ✭ 2,143 (+11805.56%)
Mutual labels:  tdd, bdd
Pester
Pester is the ubiquitous test and mock framework for PowerShell.
Stars: ✭ 2,620 (+14455.56%)
Mutual labels:  tdd, bdd
Qaf
Quality Automation Framework for web, mobileweb, mobile native and rest web-service using Selenium, webdrier, TestNG and Java Jersey
Stars: ✭ 150 (+733.33%)
Mutual labels:  tdd, bdd
chai-exclude
Exclude keys to compare from a deep equal operation with chai expect or assert.
Stars: ✭ 33 (+83.33%)
Mutual labels:  tdd, bdd
chai
BDD / TDD assertion framework for node.js and the browser that can be paired with any testing framework.
Stars: ✭ 7,842 (+43466.67%)
Mutual labels:  tdd, bdd
Karma
Spectacular Test Runner for JavaScript
Stars: ✭ 11,591 (+64294.44%)
Mutual labels:  tdd, bdd
ginkgo4j
A Java BDD Testing Framework (based on RSpec and Ginkgo)
Stars: ✭ 25 (+38.89%)
Mutual labels:  tdd, bdd
Gunit
GUnit - Google.Test/Google.Mock/Cucumber on steroids
Stars: ✭ 156 (+766.67%)
Mutual labels:  tdd, bdd
Catch2
A modern, C++-native, test framework for unit-tests, TDD and BDD - using C++14, C++17 and later (C++11 support is in v2.x branch, and C++03 on the Catch1.x branch)
Stars: ✭ 14,330 (+79511.11%)
Mutual labels:  tdd, bdd
Radish
Behavior Driven Development tooling for Python. The root from red to green.
Stars: ✭ 153 (+750%)
Mutual labels:  tdd, bdd
Add
Разработка с управляемым качеством на 1С
Stars: ✭ 210 (+1066.67%)
Mutual labels:  tdd, bdd
Tester
Тестер 1С
Stars: ✭ 131 (+627.78%)
Mutual labels:  tdd, bdd
Snap Shot It
Smarter snapshot utility for Mocha and BDD test runners + data-driven testing!
Stars: ✭ 138 (+666.67%)
Mutual labels:  tdd, bdd
Nspec
A battle hardened testing framework for C# that's heavily inspired by Mocha and RSpec.
Stars: ✭ 242 (+1244.44%)
Mutual labels:  tdd, bdd
bdd-for-all
Flexible and easy to use library to enable your behavorial driven development (BDD) teams to easily collaborate while promoting automation, transparency and reporting.
Stars: ✭ 42 (+133.33%)
Mutual labels:  tdd, bdd

Light weight BDD Pattern

Installation

  • pip install apple-mango

Goal

  • Easy to Use
  • Compatible with Python unittest
  • Compatible with existing test code
  • Support Python3

Next Step

  • Register to pypi
  • Add CI
  • Support pytest

Usage

  • Define regular test class
  • Define regular test method with @mango.given()
  • Define inner when method with @mango.when()
  • Define inner then method with @mango.then()
  • Run python test: python -m unittest test_file.py
  • No need to call inner when and then method becuase given(), when(), then() decorators will take care of it

Example

# test_exampel.py

class MangoUseCase(TestCase):
    def setUp(self):
        self.user = 'jun'

    @mango.given('I am logged-in user')
    def test_profile(self):
        self.given.user_profile = 'my_profile'
        self.given.user_photo = 'my_photo'

        self.given.notifications_count = 3
        self.given.unread_notifications_count = 1

        @mango.when('I click profile')
        def when_click_profile():
            print('click')

            @mango.then('I see profile')
            def then_profile():
                self.assertEqual(self.given.user_profile, 'my_profile')

            @mango.then('I see my photo')
            def then_photo():
                self.assertEqual(self.given.user_photo, 'my_photo')

        @mango.when('I click notification')
        def when_click_notification():
            print('click')

            @mango.then('I see 3 notifications')
            def then_notification():
                self.assertEqual(self.given.notifications_count, 3)

            @mango.then('I see 1 unread notification')
            def then_unread_notification():
                self.assertEqual(self.given.unread_notifications_count, 1)

    @mango.given('I am logged-out user')
    def test_auth(self):
        self.given.status_code = 401

        @mango.when('I access profile by url')
        def when_access_profile():
            print('access profile')

            @mango.then('I see 401 error')
            def then_error():
                self.assertEqual(self.given.status_code, 401)

Run Example

python -m unittest test_example.py

Contributing

Run Test

python -m unittest tests/test_mango.py
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].