Writing acceptance test before development or implementation starts

In my the few years, where i have pushed for testers developers to write acceptance test before development or implementation commences,
I’ve had testers come up to me say its difficult to achieve this when you dont know what the UI would look like.

This post would attempt to decribe how i have done this in the past and i still do this at the moment.

NB: Ideally i would write my test using page object pattern, if this was a new project,
I would start creating page objects

Supposing i have a feature file with this scenario

Given I am on the ebay website
When I add "Item A" to my shopping basket
Then I should be able to pay for my item using "Paypal"

class EbayHome

def select_item item_name
raise "Not yet implemented"
end

end


class ShoppingBasket
def item_present? item_name
raise "Not yet implemented"
end
end

class PayPalPage
def pay_for_shopping
raise "Not yet implemented"
end

def get_item_cost item_name
raise "Not yet implemented"
end
end

As you can see in the code above i have not written any specifics as to how this would be implemented on the page, but i have created my pageobjects
and i have filled in empty methods block, which would raise an exception “Not yet implement” if this test were to be executed.

NB: If i already had the page object class, i would simply write the methods blocks that what would represent the feature yet to be developed.

I would go ahead and write my step definitions as below.

Given /I am on the ebay website/ do
visit EbayHome
end

When /I add "(.+)" to my shopping basket do |item|
on EbayHome do |ebay_home|
ebay_home.select_item (item)
end
end

Then /I should be able to pay for my item using "Paypal"/ do
on PayPalSite do |paypal|
paypal.pay_for_shopping
end
end

So those are my tests done and this is good enough for developers to start working and without knowing what element the items on the page would be wrapped in, I have been able to write my failing test
and as soon as developers know more about the structure of the page i can start replacing the “Not yet Implemented” with watir or selenium implementation of the page.

NB: You would have noticed the code blocks for the page object (e.g. on EbayHome …), i would write a post later on this but this is a result of work done by alister scott, it a gem called watir-page-helper, very nice tool.
This could have been done in any language and using any tool, I have decided to use ruby, cucumber and watir; as these are the tools i am using on my current project.
I hope you find this useful

Advertisements
This entry was posted in Agile Delivery and tagged , , , , , , , , . Bookmark the permalink.

2 Responses to Writing acceptance test before development or implementation starts

  1. Seun Joseph-Adebo says:

    This is quite interesting. This is a typical agile development methodology; however, I would caution this route without knowing what’s in the High-Level BRD. You don’t want any surprises from Business Owners who in most cases have no clue what they want and keep Business Architects and Business Analysts running in circles.

    • Okay so maybe i didnt make this clear in the post, i wouldn’t even start writing test before user stories have been written up, this example attempts to demonstrate what i would do as a tester once we have picked up a user story (requirement). Prior to doing this, the BA has completed most of the analysis, the team has estimated the work involved in delivery of the story. The issue in the past is testers ask me, how can i write test when i dont even know what the page (UI) would look like; in an ideal situation the best you would have is a wireframe and this post describes what a tester can do pending the time you have more information about the UI look and feel.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s