Lance, I rarely have a need to cleanup and/or recreate the ApplicationContext as everything in there is singletons and thread-safe. There is a need to cleanup data that is manipulated by the given/when/then annotated methods but I don't keep that in the context - I keep that on a thread local.
"Shouldn't we clean everything up between Examples too?" - are you thinking like a teardown/@After method? As a general statement (no specific use case given) - I wouldn't do that since I will need that data for my "then" methods to assert on. Brian ----- Original message ----- From: [email protected] To: [email protected] Date: Wed, 29 Jun 2011 14:56:47 +0100 Subject: RE: [jbehave-user] JBehave uses a single test case for the whole Story instead of one per Story/Scenario/Example Hi Paul, Shouldn't we clean everything up between Examples too? I would think that I should get exactly the same results if I declare 2 test cases: In two separate stories In two separate scenarios in the same story In two separate examples within the same scenario Have you had a chance to look at the code I sent you? Do you agree that it would be a much better IDE experience with JBehave? Lance. ____________________________________________________________ From: Paul Hammant [mailto:[email protected]] Sent: 29 June 2011 14:50 To: [email protected] Subject: Re: [jbehave-user] JBehave uses a single test case for the whole Story instead of one per Story/Scenario/Example OK, please forgive me but I am going to address @DiretiesContext only... ... it would be possible for us to reverse engineer what that does and do the same between-stories or between-scenarios On Wed, Jun 29, 2011 at 7:17 AM, <[1][email protected]> wrote: My wish is actually driven by @DirtiesContext, we have tests that write to an in memory data store which I was expecting to be cleaned after each example. But, my wish will have a positive impact on JUnit result integration, I think that the JBehave report could be close to redundant if this was done properly. Lance. ____________________________________________________________ From: Paul Hammant [mailto:[2][email protected]] Sent: 29 June 2011 12:57 To: [3][email protected] Subject: Re: [jbehave-user] JBehave uses a single test case for the whole Story instead of one per Story/Scenario/Example That's going to take a deeper integration with JUnit that we have done to date. Your wish is more about JUnit result integration than the @DirtiesContext stuff - right ? I'm sure it would be possible, but we'd need to do a lot more reading of JUnit source to work out how. On Wed, Jun 29, 2011 at 6:42 AM, <[4][email protected]> wrote: Hi Paul, that is what I am doing and it is not granular enough. I think what I need is a separate org.junit.runner.Request per Story/Scenario/Example. I would like each Story/Scenario/Example (not just Story) to show up as a separate row in the junit results (in eclipse and in the junit report) Cheers, Lance. ____________________________________________________________ From: Paul Hammant [mailto:[5][email protected]] Sent: 29 June 2011 12:37 To: [6][email protected] Subject: Re: [jbehave-user] JBehave uses a single test case for the whole Story instead of one per Story/Scenario/Example You can configure JBehave to do one story per Java class too - as you want it. Look in the examples/ module of the core project. On Wed, Jun 29, 2011 at 6:27 AM, <[7][email protected]> wrote: Hi, I'm a jbehave newbie but from what I can see, each story is executed within a single JUnit test. I can see that this by looking at the source code for org.jbehave.core.junit.JUnitStories and org.jbehave.core.junit.AnnotatedPathRunner. This approach doesn't work well with the spring annotation @DirtiesContext which should use a new ApplicationContext for each test execution. I would have expected @DirtiesContext to cleanup after each Story/Scenario/Example but instead it only occurs after the entire story. What I would like is for the JUnit tests to be at a more granular level, I would like each Story/Scenario/Example to be executed within a separate Junit test. This would have the following benefits: 1. Any org.junit.runner.Runner associated with a test case would be notified before() and after() etc each test run rather than at the Story level. 2. Standard Junit reports (not the jbehave report) would be much more descriptive (each Story.Scenarion/Example would have a pass / fail) 3. Running through the IDE (I use eclipse) would have much better error reporting (at the moment I need to inspect log files to see what failed). Any one else think that this is a good idea? Visit our website at [8]http://www.ubs.com This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. E-mails are not encrypted and cannot be guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this message which arise as a result of e-mail transmission. If verification is required please request a hard-copy version. This message is provided for informational purposes and should not be construed as a solicitation or offer to buy or sell any securities or related financial instruments. UBS Limited is a company limited by shares incorporated in the United Kingdom registered in England and Wales with number 2035362. Registered office: 1 Finsbury Avenue, London EC2M 2PP. UBS Limited is authorised and regulated by the Financial Services Authority. UBS AG is a public company incorporated with limited liability in Switzerland domiciled in the Canton of Basel-City and the Canton of Zurich respectively registered at the Commercial Registry offices in those Cantons with Identification No: CH-270.3.004.646-4 and having respective head offices at Aeschenvorstadt 1, 4051 Basel and Bahnhofstrasse 45, 8001 Zurich, Switzerland. Registered in the United Kingdom as a foreign company with No: FC021146 and having a UK Establishment registered at Companies House, Cardiff, with No: BR 004507. The principal office of UK Establishment: 1 Finsbury Avenue, London EC2M 2PP. In the United Kingdom, UBS AG is authorised and regulated by the Financial Services Authority. UBS reserves the right to retain all messages. Messages are protected and accessed only in legally justified cases. -------------------------------------------------------------- ------- To unsubscribe from this list, please visit: [9]http://xircles.codehaus.org/manage_email Visit our website at [10]http://www.ubs.com This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. E-mails are not encrypted and cannot be guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this message which arise as a result of e-mail transmission. If verification is required please request a hard-copy version. This message is provided for informational purposes and should not be construed as a solicitation or offer to buy or sell any securities or related financial instruments. UBS Limited is a company limited by shares incorporated in the United Kingdom registered in England and Wales with number 2035362. Registered office: 1 Finsbury Avenue, London EC2M 2PP. UBS Limited is authorised and regulated by the Financial Services Authority. UBS AG is a public company incorporated with limited liability in Switzerland domiciled in the Canton of Basel-City and the Canton of Zurich respectively registered at the Commercial Registry offices in those Cantons with Identification No: CH-270.3.004.646-4 and having respective head offices at Aeschenvorstadt 1, 4051 Basel and Bahnhofstrasse 45, 8001 Zurich, Switzerland. Registered in the United Kingdom as a foreign company with No: FC021146 and having a UK Establishment registered at Companies House, Cardiff, with No: BR 004507. The principal office of UK Establishment: 1 Finsbury Avenue, London EC2M 2PP. In the United Kingdom, UBS AG is authorised and regulated by the Financial Services Authority. UBS reserves the right to retain all messages. Messages are protected and accessed only in legally justified cases. -------------------------------------------------------------- ------- To unsubscribe from this list, please visit: [11]http://xircles.codehaus.org/manage_email Visit our website at [12]http://www.ubs.com This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. E-mails are not encrypted and cannot be guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this message which arise as a result of e-mail transmission. If verification is required please request a hard-copy version. This message is provided for informational purposes and should not be construed as a solicitation or offer to buy or sell any securities or related financial instruments. UBS Limited is a company limited by shares incorporated in the United Kingdom registered in England and Wales with number 2035362. Registered office: 1 Finsbury Avenue, London EC2M 2PP. UBS Limited is authorised and regulated by the Financial Services Authority. UBS AG is a public company incorporated with limited liability in Switzerland domiciled in the Canton of Basel-City and the Canton of Zurich respectively registered at the Commercial Registry offices in those Cantons with Identification No: CH-270.3.004.646-4 and having respective head offices at Aeschenvorstadt 1, 4051 Basel and Bahnhofstrasse 45, 8001 Zurich, Switzerland. Registered in the United Kingdom as a foreign company with No: FC021146 and having a UK Establishment registered at Companies House, Cardiff, with No: BR 004507. The principal office of UK Establishment: 1 Finsbury Avenue, London EC2M 2PP. In the United Kingdom, UBS AG is authorised and regulated by the Financial Services Authority. UBS reserves the right to retain all messages. Messages are protected and accessed only in legally justified cases. -------------------------------------------------------------- ------- To unsubscribe from this list, please visit: [13]http://xircles.codehaus.org/manage_email Visit our website at http://www.ubs.com This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. E-mails are not encrypted and cannot be guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this message which arise as a result of e-mail transmission. If verification is required please request a hard-copy version. This message is provided for informational purposes and should not be construed as a solicitation or offer to buy or sell any securities or related financial instruments. UBS Limited is a company limited by shares incorporated in the United Kingdom registered in England and Wales with number 2035362. Registered office: 1 Finsbury Avenue, London EC2M 2PP. UBS Limited is authorised and regulated by the Financial Services Authority. UBS AG is a public company incorporated with limited liability in Switzerland domiciled in the Canton of Basel-City and the Canton of Zurich respectively registered at the Commercial Registry offices in those Cantons with Identification No: CH-270.3.004.646-4 and having respective head offices at Aeschenvorstadt 1, 4051 Basel and Bahnhofstrasse 45, 8001 Zurich, Switzerland. Registered in the United Kingdom as a foreign company with No: FC021146 and having a UK Establishment registered at Companies House, Cardiff, with No: BR 004507. The principal office of UK Establishment: 1 Finsbury Avenue, London EC2M 2PP. In the United Kingdom, UBS AG is authorised and regulated by the Financial Services Authority. UBS reserves the right to retain all messages. Messages are protected and accessed only in legally justified cases. --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email References 1. mailto:[email protected] 2. mailto:[email protected] 3. mailto:[email protected] 4. mailto:[email protected] 5. mailto:[email protected] 6. mailto:[email protected] 7. mailto:[email protected] 8. http://www.ubs.com/ 9. http://xircles.codehaus.org/manage_email 10. http://www.ubs.com/ 11. http://xircles.codehaus.org/manage_email 12. http://www.ubs.com/ 13. http://xircles.codehaus.org/manage_email --- Brian Repko LearnThinkCode, Inc. http://www.learnthinkcode.com email: [email protected] phone: +1 612 229 6779
