BDD using Lettuce – Writing Beautiful Tests that Last – Ok, wise guy, how do you thing these last



BDD using Lettuce – Writing Beautiful Tests that Last – Ok, wise guy, how do you thing these last

0 0


lettuce_pyDelhi2016


On Github dusual / lettuce_pyDelhi2016

BDD using Lettuce

Writing Beautiful Tests that Last

By Amit Sethi / @dusual

BDD is a second-generation, outside-in, pull-based, multiple-stakeholder, multiple-scale, high-automation, agile methodology. It describes a cycle of interactions with well-defined outputs, resulting in the delivery of working, tested software that matters.

- Dan North

Let's come to this definition, later

Tests are the requirements

How are requirements created in your organization? User Stories. Can we have a DSL that can be understood by the PMs as well as your application
                 Feature: Manipulate strings
                   In order to have some fun
                   As a programming beginner
                   I want to manipulate strings
                 
                 Scenario: Uppercased strings
                   Given I have the string "lettuce leaves"
                   When I put it in upper case
                   Then I see the string is "LETTUCE LEAVES"
                                  
                from lettuce import *
                @step('I have the string "(.*)"')
                def have_the_string(step, string):
                    world.string = string
                
                @step
                def i_put_it_in_upper_case(step):
                    world.string = world.string.upper()
                
                @step
                def see_the_string_is(step, expected):
                    '''I see the string is "(.*)"'''
                    assert world.string == expected, 
                        "Got %s" % world.string
                                  

Some of our own examples

Ok, wise guy, how do you thing these last

Setup Cost? The Business Guy gets them, can contribute to them. Coverage?? Its all about coverage Testing the app as a whole Automate and connect to your CI a process that you would be doing manually

Using different webdrivers and remote webdrivers

Saucelabs / BrowserStack

THE END

BDD using Lettuce Writing Beautiful Tests that Last By Amit Sethi / @dusual