Hi Mauro,

My think on this was... I liked the way Im writing textual scenarios now... jbehave runs through junit.... so, why not to use jbehave for some integration test too... :-)

  I've tried to to make a experiment to stub the Model layer before running the tests...

But my first try didn't works.. When I try to do I got a exception:
    public void runScenario() throws Throwable {

        
        ITestModelClass mockedManager = mock(ITestModelClass.class);
        given(mockedManager.isManagerStarted()).willReturn(false);
        super.runScenario();
    }


java.lang.NoSuchMethodError: org.mockito.Mockito.when(Ljava/lang/Object;)Lorg/mockito/stubbing/OngoingStubbing;
    at org.mockito.BDDMockito.given(BDDMockito.java:134)
    at com.drysoftware.qa.bdd.manager.pages.web.scenario.Scenario4PagesWeb.runScenario(Scenario4PagesWeb.java:35)
    at org.jbehave.scenario.JUnitScenario.testScenario(JUnitScenario.java:73)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at junit.framework.TestCase.runTest(TestCase.java:168)
    at junit.framework.TestCase.runBare(TestCase.java:134)
    at junit.framework.TestResult$1.protect(TestResult.java:110)
    at junit.framework.TestResult.runProtected(TestResult.java:128)
    at junit.framework.TestResult.run(TestResult.java:113)
    at junit.framework.TestCase.run(TestCase.java:124)
    at junit.framework.TestSuite.runTest(TestSuite.java:232)
    at junit.framework.TestSuite.run(TestSuite.java:227)
    at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:79)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:46)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)



Mauro Talevi escreveu:
Cristiano Gavião wrote:
Hi,

I would like to know if it's possible to create a stub for one class inside a step methods managed by jbehave?

Somebody have tried to do this?


I've never tried personally, as I tend to use mocks for unit-level testing and use IoC containers for constructing objects used at integration-level testing. If I need to use a stub in integration tests I typically create one myself without resorting to mocking frameworks.

That said, JBehave Step method are plain-old Java methods so you can create your object instances whichever way you prefer.  I would just recommend that you make explicit the construction of the stub expectations via appropriately expressive steps.

Let us know how you get on with this and we can add a page in documentation about it.

Cheers


---------------------------------------------------------------------
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

Reply via email to