Easyb – easy BDD in Groovy

November 25, 2008 at 7:05 pm 1 comment

Some time ago I got interested in Ruby and one of the things that I was extremely impressed about was RSpec. RSpec is a library that allows to define a testable specification that can be run similar to unit tests. Let’s say I want a write a Stack implementation (for some reason BDD people always use stack as their “hello world” alternative). So before I begin I can define some specifications for that Stack class, like this: given empty stack, size() should return 0. Now, the beutiful thing about RSpec is that because of power of Ruby it allowed writing specs like this almost in a natural language, and then run those specs to verify the code behaves correctly. This concept is called Behavior Driven Development or BDD.

By the way, if you think this is almost the same as normal unit testing, you will be mostly right. The difference is in the “user-friendliness” not in the technology. With unit tests, you get the spec, than you need to think of ways to test it, then you implement the test, then if it breaks you need to reverse-lookup what part of spec that test was testing anyway so you can fix it. BDD is mostly the same, but just more straightforward – right spec in English, extend it with code, when it fails it will tell you in English what failed.

Anyway, this was some time ago, and I remember that I got a bit jealous of Ruby people for having this tool. Fast forward to now, and turns out that like most good things in Ruby (RoR to Grails) RSpec was also imported to Java, or more specifically Groovy. It is called Easyb and from examples on the website it looks fantastic. I haven’t used it yet, but I am looking forward to it.

Advertisements

Entry filed under: Uncategorized.

Agile hype cycle The original agilist

1 Comment Add your own

  • 1. Josh  |  November 25, 2008 at 11:39 pm

    I think BDD and easyb look really cool, too. You might be interested to see this post, which shows it in use.

    Reply

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

Trackback this post  |  Subscribe to the comments via RSS Feed


Calendar

November 2008
S M T W T F S
    Dec »
 1
2345678
9101112131415
16171819202122
23242526272829
30  

Most Recent Posts


%d bloggers like this: