Sheldon,

I do this by having multiple version of my steps classes (not quite the same) 
and
then load one Spring application context (against the web services) or the other
(against the web application using Selenium).  Again, not quite the same, but 
totally
do-able.  For me the implementation of the steps was definitely different and I 
couldn't
just replace my service implementation.  I'm not sure that a http 
(request/response) 
implementation can be replaced by a jms (async request/response) straight out 
of the
box but if that works for you great - then its another instance of the 
StepsFile.

Again, I was doing this via Spring (see Spring-Security example) - but you 
should
be able to restrict the steps classes for a given run or use an IoC solution for
this.

Brian


----- Original message -----
From: "Sheldon" <sporc...@gmail.com>
To: user@jbehave.codehaus.org
Date: Wed, 04 Jan 2012 11:37:09 -0700
Subject: [jbehave-user] Can I reuse stories with two different implementations?

I am using JBehave in a project where we test http requests to web 
services.  This has worked beautifully so far.  Now the team is 
introducing a new front end using JMS.  It is designed to work as a 
secondary front end to the existing web services.

For example, a customer can post a request directly to the web service 
via http GET or POST, or alternatively submit a message to the JMS 
service, which then will submit an http GET or POST to the web service. 
  The JMS service gives us the ability to prioritize and 
pre/post-process requests, which is why it is being introduced.

I built the tests so that we have a collection of story files & a single 
steps file.  The steps file includes the following:

public class StepsFile {
     MyService service;
     ServiceBuilder serviceBuilder;
     [a collection of @Given, @When, @Then methods]
}

The ServiceBuilder generates the service object at the appropriate time 
during testing.  'service' is then queried for results (within @Then steps).

Now that we need to handle two variations of MyService (http and JMS), 
can I configure JBehave to run thru the same stories twice, but 
injecting different versions of ServiceBuilder in to the StepsFile class 
for each iteration?  Is there a better way to handle this kind of 
implementation variation?


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



---
Brian Repko
LearnThinkCode, Inc.
http://www.learnthinkcode.com
email: brian.re...@learnthinkcode.com
phone: +1 612 229 6779


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to