Using Acceptance Tests to Define Done

Have you ever been on a team and was asked “What is the definition of done?” You respond by saying, “When all of your automated tests pass, and there are no bugs, then you have satisfied the acceptance criteria. Done!” Which then is responded to by “Well, how do I define the acceptance criteria?” Good question!

Understanding the Feature

First things first – you have to understand what feature you’ll be building. Building the right product and building the product right takes communication and collaboration between your product owner and your team.

The reason for all of the collaboration is that we’re trying to build a shared understanding of what needs to be done and also produce examples that are easy to maintain. There are many ways to work collaboratively and ultimately, you have to decide what works best for your team.

The team I’m currently on has found that smaller workshops work best for us. Those workshops, otherwise known as “Three Amigos”, include a business analyst, a developer and a tester who share a similar understanding of the domain.

Lets hypothetically say you’re discussing a shopping cart feature for your site. Start by defining the goals of this feature. By starting with the goal, you’ll let everyone know why they’re spending their time on implementing the feature. If you can’t come up with a good reason why, then maybe the product owner is wasting everyone’s time.

We’ve used the Feature Injection template from Chris Matts and Liz Keogh to help us successfully describe why:
As a <type of stakeholder>
I want <a feature>
So that <I can meet some goal>

Here’s our feature description:
As an online shopper
I want to add items to my shopping cart
So that I can purchase them

Determining Acceptance Criteria

Next, your team needs to determine what the system needs to do to meet those goals-the Acceptance Criteria.

In your Three Amigos meeting, be sure to ask questions to clear up assumptions, such as “Are there any products that cannot be purchased online?” or “Does the shopper need to be authenticated to purchase?”.

Remember, the scope of feature should be high level as we only want to identify what the application needs to do and not how it’s implemented. Leave that part to the people that know how to design software. It was determined by the team that the following are in scope:
– Only authenticated shoppers can add items to the shopping cart.
– Cannot add refrigerators to shopping cart.
– Only 25 items can be added.
– Shopper can remove items from shopping cart.
– Shopper can change quantity of items after adding it to the cart.

Hey, now we have some acceptance criteria!

Acceptance Criteria lead to Acceptance Tests

We’ve used communication and collaboration to determine why a feature is necessary and what the system needs to do to at a high level, so now we can come up with some examples to test our acceptance criteria.

To do this, we’ll write some Cucumber scenarios. We’ve chosen Cucumber for all of the reasons mentioned in Tim Wingfield’s post on Day 15. If you haven’t read it, go back and check it out. It’s an excellent post on the benefits of employing Cucumber.

Here are a few scenarios that were created:

Given the shopper is a guest
When they try to add an item to their shopping cart
Then they will receive the error "Only authenticated shoppers can add items to their shopping cart."

Given an authenticated shopper
When they click the "Add Item to Cart" button
Then they will have an item in their shopping cart

Given an authenticated shopper with an item in their shopping cart
When they click the "Remove Item" button
Then that item is no longer in their shopping cart

These are only a few of the examples that were developed as part of the Three Amigos meeting. On our team, the output of the Three Amigos is a Cucumber feature file. We now have a shared understanding and a definition of done! We can pass on our failing acceptance tests to the Dev team to begin their work. They will begin by creating failing unit tests and writing enough code to make them pass. Once they are passing, they can then run the acceptance tests. Once those are passing then the feature is complete. We’re done! Those acceptance tests will be added to the regression suite to be ran anytime to ensure that the feature remains done. Now the feature can be demonstrated to the product owner at the next review.

What we’ve just done is taken a trip around the Acceptance Test Driven Development cycle. Just remember, it’s not about the tools or the technology, but rather the communication and collaboration. Our ultimate goal is to deliver high quality software that functions as the product owner intended. By including QA in the entire process, we can eliminate many of the problems that plague us earlier so that they don’t make it to production. Quality is not just a QA function, it’s a team function.

Tagged , , ,

Connecting ActiveRecord to SQL Server

What is ActiveRecord?

  • ActiveRecord is a Ruby library that was written by the creators of Ruby on Rails to do database integration. It connects classes to relational database tables to establish an almost zero-configuration persistence layer for applications.

That’s great, but we’re not using Ruby on Rails and our web app has SQL Server on the back end. How can we leverage ActiveRecord in our environment?

  • Good news! You can use ActiveRecord without Rails! If you are a Ruby programmer, you can can connect very easily to SQL Server to create models! You get a great deal of functionality such as basic CRUD operations, data validations, search support and many others!
  • All of this can be accomplished with the activerecord-sqlserver-adapter gem.

How do I connect ActiveRecord to SQL Server?

For more information, check out my example:

Tagged

Cha’ Cha’ Changes

In November, I accepted a new position as a SDET within my company. With it, I get the opportunity to program in Ruby full-time, something I’ve been wanting to do for quite some time. Since then, my life has become quite the whirlwind. I have been engrossed in learning the language as well as coming up to speed with the testing culture and being an evangelist to our Devs and QAs.

I’ve also had the opportunity to talk to many people active in the community who are experts in testing to try and learn the best ways to implement automated acceptance testing within an organization.

My first order of business is to implement automated UI testing using Cucumber and Watir. I’m sure over the next few months I’ll be blogging about the challenges that we face to achieve these goals. Stay tuned!

Tagged , , ,

HOW TO: Configure Ubuntu 10.04 (Lucid Lynx) to work with Ruby on Rails 3.0

I’ve journeyed into the world of Ruby and Rails and decided that it would be fun to develop on Ubuntu.  I’m your typical Windows user during the day, and although Rails can be installed on Windows, I’ve read many blog posts that end in frustration for those that do.  So, to avoid all the frustration (and to have fun with Ubuntu!), I have created an Ubuntu VM using VirtualBox to run on my Windows 7 laptop.  Getting Ubuntu set up in VirtualBox was fairly painless, so I won’t cover those installation steps here, but rather those that I found quite handy when configuring Ubuntu to work with Rails. Here we go!

Install git-you will need this along the way, so it’s easiest to install right off the bat.

After git has completed installation:

Generate an SSH keypair and

Set your local git config

Install Ruby Version Manager (RVM)-RVM is a command line tool which allows us to easily install, manage and work with multiple ruby environments from interpreters to sets of gems.  Using RVM will allow us to ensure that our apps work with the different versions of ruby and quickly expose areas in which they don’t.

Install the necessary tools.  From the terminal:

sudo apt-get curl

Install  RVM from the github repository:

bash < <( curl http://rvm.beginrescueend.com/releases/rvm-install-head )

Add this line to the end of your .bashrc.  It loads RVM into a shell session.:

if [[ -s "$HOME/.rvm/scripts/rvm" ]]  ; then source "$HOME/.rvm/scripts/rvm" ; fi

Close your terminal and open a new one.  Run the following to test whether RVM installed correctly.  It will also list the various dependencies for each ruby:

rvm notes

Install Ruby 1.9.2 using RVM (will take several minutes):

rvm install 1.9.2

Set Ruby 1.9.2 as the default version:

rvm –default ruby-1.9.2

Test the ruby install:

ruby –v

And finally, install Rails 3 (which also takes a while):

sudo gem install rails

Develop for the better!

Tagged ,

Technical ADD-How to Regain and Maintain Your Focus

Technology changes so frequently, so how to you know what to learn?  As soon as something new comes out, you want to get hands-on with it.  Then something newer comes out and you want to get hands-on with it too.  Well, what happens?  You begin something that you’re interested in, leave it partially completed to learn something else, which also never gets completed.  So, are you really learning anything?

This was happening to me quite frequently.  There are so many things I read in blogs or see on Twitter and think “Man, I need to take a look at that!  This is awesome!” So I do, and leave whatever I’m doing behind.  Some of the time I come back to those projects that were left behind, but it’s usually a month or so later.  By that time, you forget where you were or what you were doing, so you quit.  You can never regain that mojo that you once had when you began.

How do I break this vicious circle?

1.  Create a list of topics that interest you.

As you find something that interests you, write it down.  Make sure you jot down any pertinent information so that you can come back to it later.  I find that Evernote, or any other note taking software, is good for this.  If you come across a tweet or a blog post and you think “Hmm…this looks cool”, jot it down in Evernote.

2.  Create Goals

Rank all of the items on your list and create goals from them.  They can’t just be I want to learn Ruby, or I want to create this website.  They should be S.M.A.R.T (or S.T.U.P.I.D.) goals or you’ll never get to where you want to be.

3.  Start Learning

Congrats!  You’ve just created a learning plan!  Begin small, start crossing off your objectives and you’re well on your way.

How do I stay on track and maintain focus?

You should never stop learning. There are things that will get added to your topics list every day.  So how do you stop your technical ADD from kicking in? You find this super cool library or you’re introduced to a new language and you think “Man, I really need to look at this!”  One rule that I use, is that I set a timer, or just set aside a couple of hours to dive into a topic.  If I think that I can get what I need out of it in that amount of time, then I go ahead and jump into it.  When the timer goes off, or my specified time is up, and I haven’t satisfied my mind, then I jot it down on the topics list.  This is something that I’m going to have to spend more time on.  The key here is to only do this once a day, and no more than a couple of times a week.  If you don’t, then you get back in the same boat as you were before.

Travelling down your learning path

As you begin down your learning path, some of the things that you put on your topic sheet may no longer interest you, and that’s ok.  That’s good.  That means that you might have found something that you’re passionate about and want to dive deeper into.  You’ll end up crossing off the topics that don’t interest you and replacing them with new ones.  Don’t be afraid to do it.

Also, as you complete a goal, don’t be afraid to reorder your list of goals.  You may find that your priorities have changed based on what you’ve just finished.

How to add a filter for all of the noise

Another good way to try to eliminate technical ADD is to add a filter.  At CodeMash this past January, Joe O’Brien gave a presentation entitled “Refactoring the Programmer”.  In this presentation, he describes the Rule of 4 and the Rule of 8. Anytime he hears a certain technology mentioned four times from any of his mentors, he goes and researches it.  If he hears it mentioned eight times, he researches it more in-depth and does some hands on work with it.  This technique may help you cut down on much of the noise that you may encounter.

Give back

By this time you may have found some things that really interest you.  If you haven’t started a blog, do so now.  All of these tidbits that you think are trivial are useful to someone.  Don’t worry if you think that they’ve been beaten like a dead horse; this will help cement the things that you have just learned.  Plus, no one can read every single blog out there.  This will help you increase your visibility.

While you’re at it, take some of your blog posts and turn them into presentations that you can give to your teammates or your peers.  There’s no better way to learn something than to have to talk about it to a bunch of developers at a user group, or a conference.  No one is an expert in everything.  People will come to listen to you to learn.  They’re not there to criticize (well, most aren’t).

Final Thoughts

Keep in mind,  this is something that has worked for me.  Ultimately, you have to find what works for you.  If you’re doing something different, I’d like to hear from you.

Now I have to go and cross this off my goal sheet! Thanks to my mentors that have helped me make this a reality.

Develop for the better!

Tagged ,

CodeMash 2.0.1.0 Reviewed

Last week I had the privilege to attend one of the premier developer events in the country.  CodeMash 2010 was the best professional event that I’ve ever had the opportunity to attend. I would like to express my appreciation to the entire volunteer community who have taken the time  to put this on.

What made this event so great, you ask?  Let me give you some of the reasons why.

The Speakers

Three days, 58 speakers. ‘Nuff said. CodeMash gave us the opportunity to learn about languages, development approaches, and technologies that we might not know much about, or even knew existed. It gave us the opportunity to step out of our comfort zone and learn something new.  Ruby, Rails, Python, F#, PHP, .NET, Java, iPhone…where else could you go to see amazing presentations given by experts in our community? Not to mention three excellent keynotes given by Mary Poppendieck, Andy Hunt and Hank Janssen.

Open Spaces

Post a topic, show up to discuss it.  Open Spaces at CodeMash were little breakout sessions where you pick a time and place where you wish to discuss your topic.  They weren’t lectures.  They weren’t presentations.  Those that showed up decided where to steer the discussions. 

Coding Dojo

This was the place to go to pair up and learn some new coding skills or just hone your existing ones.  HudsonSC and Nimble Pros provided Katas to work on if you wished.  You could also use this room to pair up and discuss a current project or what you were looking to work on.

The Venue

Where else could you swim up to a bar and discuss Ruby; or float around on the lazy river and talk about F#?  The Kalahari Resort and Conference Center was a great host to over 600 geeks and their families.  The place is top notch.  My wife and daughter had a great time at the CodeMash Families and KidzMash events that were held while we were in our sessions. 

Make sure you have CodeMash 2.0.1.1 on your calendar for next year!  I know that I’m counting down the days-and so is my family!

Tagged

CodeMash 2.0.1.0 is almost here!

As a new year begins, the countdown to CodeMash is down to little over a week and I’m as giddy as a 5 year old on Christmas morning!  I’m getting the new laptop installed with everything I’ll need to pair up with some of the best developers in the country.

If you’re not familiar with CodeMash, it’s one of the best developer events in the country.  It’s focus is to educate on current patterns and practices, methodologies and technology trends in a variety of platforms and development languages.  In short, if you’re a developer, you should be there! Not to mention that it’s very affordable and held at a world-class indoor waterpark; the Kalahari Resort in Sandusky, Ohio.

I can’t wait to learn from some of the best in the industry next week. Who knows, maybe one of these days, I’ll be one of those speakers.  Something to aspire to.

Tagged

Software Engineering 101 Conference Wrap-up

I want to thank the many people involved in putting on such a great conference yesterday.  Over 90 people attended and walked away with tons of great information on OOP, SOLID, code analysis/metrics, and production debugging.

Many thanks go to Jim Holmes for the original idea, and putting together such a great lineup of presenters.

To start the day off right, Leon Gersing talked about the fundamentals of OOP, followed by Jon Kruger‘s SOLID principles presentation.  Then Jim gave a brief presentation of tools for code analysis. Next up, was Scott Walker showing us debugging tools and how to use them in a production environment.  These all lead up to a TDD workshop where we paired up to work on an exercise from Leon.

I can’t begin to express how much I actually came away with from this conference.  If for some reason that you missed it, I can only hope that they put this on again soon.  You’ll benefit greatly by attending.

Want to get started with TDD?

Test Driven Development (TDD) is a software development technique that utilizes unit tests to build better software that is loosely coupled.  TDD can be thought of as Red-Green-Refactor.  First, you create a failing test (Red), then write just enough code in order for the test to pass (Green), then the code can be cleaned up (Refactor) as necessary.

If you’ve never written unit tests, it can be quite tricky.  There is definitely an art to creating good unit tests.  Luckily, a colleague of mine has put together a TDD starter kit to help you come up to speed.  It contains sample projects that you can download and step thru, as well as many links to various topics on all things TDD.

You can find the TDD starter kit here.  I highly recommend downloading and walking through the projects.  Within it, you’ll also see examples of mocks and stubs as well as dependency injection and inversion of control.

Tagged ,

Software Engineering 101

On September 23rd, the Microsoft office in Polaris is hosting a FREE one day event thats targeted to help you build software.  It doesn’t cover the latest and greatest tech skill of the day, but rather fundamentals and principles to help you understand how to build software that is better designed, more maintainable and more testable.

The morning will be spent on the fundamentals surrounding object oriented programing, SOLID principles, as well as a few others.  The afternoon will be more of a hands on TDD workshop.

The conference is being put together by Jim Holmes and has a great lineup of speakers, including Jon Kruger, Scott Walker and Leon Gersing.

This is definitely one to put on the calendar.  Not to mention again…it’s FREE! 

Click here for more details and how to register