I agree with what Cristiano/Brian are saying. The fact that you can use JBehave to write unit tests does not make it necessarily the best tool for the job.
The primary aim of BDD is communication. In the case of unit tests, you should be able to understand from the code what the behaviour is. Tools like Mockito do a pretty good job at that. Introducing the extra layer of JBehave with the mocking happening in the Steps classes rather than then JUnit class itself would imply extra logic and complexity that is perhaps an overkill. That said, if it works for you and your team and stakeholders, why not? On 27/08/2010 20:59, Cristiano Gavião wrote: > Brian / Chris, > > I think there is no problem in use BDD's ways of thinking and > strutucture the ideas for any kind of test... > > For instance, I am using Bdd sentences to write business rules, that > will be implemented by Drools or some Manager class later... I wont > automate it for now, but just fit on the "When Then" way used by > drools.... and lots of other process tools... > > Well, but such low level detail test that Chris is trying to do is > more apropriated using the right tool. And in my opinion mockito is > the best approch for that. > > I've used Jbehave just to handle the "black box" tests... that my > business customer can understand... > > Take a look at the example in this javadoc : > > http://mockito.googlecode.com/svn/tags/1.8.0/javadoc/org/mockito/BDDMockito.html > > > Bdd is used to comment the steps... > > cheers > > [email protected] escreveu: >> That is exactly what I am trying to. There is no reason why BDD can >> not be >> applied on the unit level of development. Proper TDD is actually really >> about behaviour anyway. :) >> >> >>> Chris / Christiano, >>> >>> Yes - this feels like doing TDD/unit testing via Given/When/Then >>> and that might not be the most appropriate use of BDD. >>> >>> You could do the expects as additional @Givens >>> >>> @Given a service object and DAO object >>> @Given the DAO object expects methodX and returns Y >>> @When the service method is called >>> >>> The @When could do all the replays and then invoke the method. >>> >>> Brian >>> >>> >> >> --------------------------------------------------------------------- >> To unsubscribe from this list, please visit: >> >> http://xircles.codehaus.org/manage_email >> >> >> > > --------------------------------------------------------------------- > To unsubscribe from this list, please visit: > > http://xircles.codehaus.org/manage_email > > --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email
