For those interested, JBehave: http://jbehave.org/ is a java BDD framewor, its 
already at version 1.0.1

Bashar

----- Original Message ----
From: Warner Onstine <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Sent: Wednesday, April 11, 2007 8:33:06 AM
Subject: [jug-discussion] more DSL/Groovy fun

This was sent out to the Groovy list this morning, an implementation  
of Behavior Driven Development, inspired by RSpec (http:// 
rspec.rubyforge.org/), This one is of course called GSpec.

http://codeforfun.wordpress.com/2007/04/09/gspec-for-java-bdd/

Here's the code example he sent to the list:

> GSpec is still very alpha as I need to rework the method and property
> interception, however I'm putting it out there in an attempt to  
> draw some
> interest (more so in the practice rather than the project). Honestly I
> should be spending more time developing and fixing the kinks in  
> GSpec than I
> spend writing about it. Currently I'm working on using Groovy MOP for
> interception and I'm also now working on a term definition feature.  
> The idea
> behind term definition is a means of allowing users to extend GSpec by
> defining additional grammar at runtime. Here's what it wold look like:
>
> the.context("A music store order entry system") {
>   definitions {
>      define 'accepted' { the.orderRepository.contains(it) }
>   }
>
>   initially {
>      the.orderRepository = new OrderRepositoryImpl()
>      the.orderProcessor = new OrderProcessorImpl()
>   }
>
>   specify("An order posted without items should NOT be accepted") {
>      def order = the.orderProcessor.createOrder()
>      order.submit()
>      order.should_not_be_accepted
>   }
>
>   specify("An order posted with items SHOULD be accepted") {
>      def order = the.orderProcessor.createOrder()
>      order.add new LineItem("MC Hammer's greatest hits Double CD",  
> 21.99)
>      order.submit()
>      order.should_be_accepted
>   }
>
>   inConclusion { the.orderRepository.deleteAllOrders() }
> }
>
> Here's what happens. Any term behind the magic properties (i.e.  
> should_be,
> should_not_be) is considered as a boolean bean property. If the  
> property is
> undefined on the calling object then a list of "terms" supplied by  
> the user
> in the definition section will be considered to resolve the call. I  
> think
> it's pretty slick stuff. You probably think I'm crazy, but it might  
> work
> out. Drop me a line if you have any other ideas to throw into the pot.

Warner Onstine - Programmer/Author
New book! Tapestry 101 available at http://sourcebeat.com/books/ 
tapestrylive.html
[EMAIL PROTECTED]
http://warneronstine.com/blog




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





Reply via email to