[rspec-users] RSpec wire protocol Was:Re: describe "RSpec's documentation" do

Matt Wynne matt at mattwynne.net
Fri Dec 11 09:03:44 EST 2009

On 9 Dec 2009, at 00:09, Ed Howland wrote:

> Matt,
> I was facinated to read the email thread on Cuke's wire protoccol.  
> You guys collaborated well.
> I have been working on my own to develop a similar protocol for  
> RSpec. It is totally external to RSpec right now and very primitive.
> Whereas with Cucumber, the step definitions are run on some other  
> language's server, my protocol executes all the code in Ruby in the  
> "it" blocks and proxies objects and method calls to a server.   
> Currently the protocol is CGIish+XML. The current server is PHP but  
> could be anything like .Net.
> In the next iteration, I plan to use REST+JSON sort of like CounchDB  
> or CounchREST. With REST you get all the error checking/responses  
> with all the simplicity of the existing HTTP protocol, My first  
> version used ActiveResource but there are other REST clients for  
> Ruby, And JSON you already know.
> It seemed to me that part of your discussion revolved around  
> encoding the protocol in JSON or externally. Did you consider REST.  
> Did you reject it because of performance?

Yes we did, briefly - probably before the discussion went online on  
the lighthouse ticket. I think there were a couple of reasons why not  
(1) simplicity - we wanted the wire server to be as low-tech as  
possible so it would be easy and lightweight to implement on any  
platform (think Cuke4EmbeddedDevice). Everyone's got a TCP stack but  
not everyone's got a simple web server like sinatra - I'm not even  
sure there's an especially simple one for .NET
(2) flexibility - as the protocol has emerged, it's become clear that  
the relationship is pretty much client / server, but when we first  
started we weren't sure how much chatter would need to go back &  
forth. Obviously a REST server can't start making requests back to a  
client (unless that client also starts offering a web server), but if  
you've got two peers talking over a socket you can have two-way comms.

> If anyone has any thoughts on this, I'd be interested.

If you're using your protocol to effectively get remote control over  
objects, have you considered writing something to support DRB[1] on  
the server side? Otherwise you could also look at SLIM[2], which is  
the protocol Fitnesse uses in much the same way as Cucumber uses the  
wire protocol. We did consider using slim in Cucumber - it's widely  
supported with server implementations on many platforms, but since  
SLIM has much more flexibility that we needed, we decided to keep  
things simple.

> Should we :
> o continue to use web proxies for objects and method calls?
> o -or- switch to running the matchers (should ==, etc.) over the  
> wire protocol, more like cucumber?

I'm not really clear what the goal of your app is, but to go more into  
line with what cucumber's doing, I think what you'd do would be to  
allow RSpec to remotely invoke entire examples ("it blocks") remotely.  
You could then write those examples entirely in the native language.

> Thanks and great work,
> Ed
> BTW, anyone working on a Cuke4PHP?

That's the first time I've heard anyone even suggest it :) I'd be  
happy to collaborate with someone if they wanted some help with that.


> On Mon, Nov 9, 2009 at 5:03 PM, Matt Wynne <matt at mattwynne.net> wrote:
> On 6 Nov 2009, at 12:49, David Chelimsky wrote:
> [3]http://github.com/aslakhellesoy/cucumber/blob/master/features/wire_protocol.feature
> I'm well behind this effort and would like to offer my help on the  
> Cucumber end to make it possible to use the features to generate the  
> user documentation - I think this would make a terrific use case for  
> us to support.
> cheers,
> Matt
> http://mattwynne.net
> +447974 430184
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
> -- 
> Ed Howland
> http://greenprogrammer.wordpress.com
> http://twitter.com/ed_howland
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users


+447974 430184

More information about the rspec-users mailing list