Re: [jbehave-dev] Re: Starting up with JBehave and encountering bugs in StoryBuilder and story generator makes me wonder why those features are not in use.
Hi, Mauro Talevi wrote: Hi Eric Eric Lewin wrote: Hi! I was thinking that starting with JBehave would be something like this: 1. writing story text files with the customer 2. Generating the code for givens, event and outcomes with Ensure.pending() 3. Run the story textfile 4. Implement some givens, event and outcomes (in a BDD style of development with behaviour testing) And iterate to step 3 again and again till there are no more Pendings. But I can't make JBehave version 1.0.1 to neither run a story textfile nor generate code. (See bugs and suggestions further down) It seems that I must handcraft all my code, even the stories. Does nobody work in my suggested way of developing stories? Is it a naive approach? I was thinking it would be a way to speed up development of a stories, but maybe the stories change so much during a project that it is better to have them in code to benefit from the refactoring tools in the IDE? Are their other good reasons for not letting the text files drive the code or for not generating the code? ATM, there is no stub-generation of the scenario components from the story text file, but I agree it could be a useful optional feature. I say optional, because IMO, it's important to keep the Java-centric approach to stories and provide rendering/parsing to external representations. I prefer to discuss the stories/scenarios with my customer before coding, so I've rewritten the StoryGeneratorSpike so that it works as described in feature suggestion #2 further down. Are you interested in that code? So here are the bugs I've encountered so far: ***StoryBuilder: Bug #1: I was trying to use the maven plugin to run a story text file and I found out that when storyBuilder.story() is called the scenarios are not added to the story, so my text file runs successfully with 0 scenarios. Can you provide a test case for this? Ideally create a jira issue with attached all the code/files that allows us to reproduce the problem. FYI, there is an integration test suite for the maven plugin in https://svn.codehaus.org/jbehave/trunk/plugins/maven/src/it/ It demostrates that scenarios are read and executed. Just use your suggested integration test to reproduce the bugs. I checked out a clean version of jbehave an hour ago. See my results further down. Even though it says that the build is successful when I run the integration suite, no scenarios are run (test 2), nor printed out (test 3). Anyway, I've fixed the code locally. If you like I could submit it. Is a patch to a new Jira issue the best way to contribute? Bug #2: If I insert a call to story.specify() before running the story I get a class cast exception. The lists details.context.givens and details.context.outcomes are filled with strings and not BasicDetails Bug #3: Classbuilder.newInstance(..) in StoryBuilder does not use the fullname when loading the class. Again, test cases would be useful. Feature suggestion #1: The TextStoryParser should accept newlines in the story text files. That would make the text files easier to read for human beings. It does - although possibily not blank lines. I agree blank lines can improve readability. If you can provide the failing file we can investigate. I'm not familiar with sablecc but it doesn't seem that blank lines are defined within the grammar defined by core\src\java\org\jbehave\core\story\codegen\story.scc ***CodeGenerator (I know, it is in the sandbox, but it gets distributed ;O): Bug #4: The sandbox/antlr/... directory have got a StoryGeneratorSpike that doesn't work. Bug #5: When I fix the code in the StoryGeneratorSpike and run it, I find out that the generated classes are bogus. antlr is not used anymore - nor supported. There is only a couple of unused Exception in StoryGeneratorSpike that refers to antlr libraries. Feature suggestion #2: A generator that generates the code for givens, event and outcomes with PendingExceptions, but does not overwrite existing classes. I agree. Thanks Cheers, Eric Maven results: C:\work\svn_workspace\jbehaveTrunk\plugins\maven\src\itmvn integration-test [INFO] Scanning for projects... [INFO] Reactor build order: [INFO] jBehave Maven Plugin Integration Test 1 [INFO] jBehave Maven Plugin Integration Test 2 [INFO] jBehave Maven Plugin Integration Test 3 [INFO] jBehave Maven Plugin Integration Test Reactor [INFO] [INFO] Building jBehave Maven Plugin Integration Test 1 [INFO]task-segment: [integration-test] [INFO] [INFO] [resources:resources] [INFO] Using default encoding to copy filtered resources. [INFO] [compiler:compile] [INFO] Compiling 5 source files to C:\work\svn_workspace\jbehaveTrunk\plugins\maven\src\it\test1\target\classes [INFO] [resources:testResources] [INFO] Using default encoding to copy
[jbehave-dev] Re: Starting up with JBehave and encountering bugs in StoryBuilder and story generator makes me wonder why those features are not in use.
Eric Lewin wrote: Hi, I prefer to discuss the stories/scenarios with my customer before coding, so I've rewritten the StoryGeneratorSpike so that it works as described in feature suggestion #2 further down. Are you interested in that code? Sure - I understand your point of view and it's very useful when facing customers. I do agree it's useful to be able to create stubs and would be very interested if you could provide a patch with the feature enhancement. Please use http://jira.codehaus.org/browse/JBEHAVE to attach any patch. Just use your suggested integration test to reproduce the bugs. I checked out a clean version of jbehave an hour ago. See my results further down. Even though it says that the build is successful when I run the integration suite, no scenarios are run (test 2), nor printed out (test 3). Anyway, I've fixed the code locally. If you like I could submit it. Is a patch to a new Jira issue the best way to contribute? yes please Bug #2: If I insert a call to story.specify() before running the story I get a class cast exception. The lists details.context.givens and details.context.outcomes are filled with strings and not BasicDetails Bug #3: Classbuilder.newInstance(..) in StoryBuilder does not use the fullname when loading the class. Again, test cases would be useful. Feature suggestion #1: The TextStoryParser should accept newlines in the story text files. That would make the text files easier to read for human beings. It does - although possibily not blank lines. I agree blank lines can improve readability. If you can provide the failing file we can investigate. I'm not familiar with sablecc but it doesn't seem that blank lines are defined within the grammar defined by core\src\java\org\jbehave\core\story\codegen\story.scc Quite possibly :-) ***CodeGenerator (I know, it is in the sandbox, but it gets distributed ;O): Bug #4: The sandbox/antlr/... directory have got a StoryGeneratorSpike that doesn't work. Bug #5: When I fix the code in the StoryGeneratorSpike and run it, I find out that the generated classes are bogus. antlr is not used anymore - nor supported. There is only a couple of unused Exception in StoryGeneratorSpike that refers to antlr libraries. We'll kill antlr from src. Thanks for feedback and patches! Cheers - To unsubscribe from this list please visit: http://xircles.codehaus.org/manage_email
[jbehave-dev] Re: Starting up with JBehave and encountering bugs in StoryBuilder and story generator makes me wonder why those features are not in use.
Hi Eric Eric Lewin wrote: Hi! I was thinking that starting with JBehave would be something like this: 1. writing story text files with the customer 2. Generating the code for givens, event and outcomes with Ensure.pending() 3. Run the story textfile 4. Implement some givens, event and outcomes (in a BDD style of development with behaviour testing) And iterate to step 3 again and again till there are no more Pendings. But I can't make JBehave version 1.0.1 to neither run a story textfile nor generate code. (See bugs and suggestions further down) It seems that I must handcraft all my code, even the stories. Does nobody work in my suggested way of developing stories? Is it a naive approach? I was thinking it would be a way to speed up development of a stories, but maybe the stories change so much during a project that it is better to have them in code to benefit from the refactoring tools in the IDE? Are their other good reasons for not letting the text files drive the code or for not generating the code? ATM, there is no stub-generation of the scenario components from the story text file, but I agree it could be a useful optional feature. I say optional, because IMO, it's important to keep the Java-centric approach to stories and provide rendering/parsing to external representations. So here are the bugs I've encountered so far: ***StoryBuilder: Bug #1: I was trying to use the maven plugin to run a story text file and I found out that when storyBuilder.story() is called the scenarios are not added to the story, so my text file runs successfully with 0 scenarios. Can you provide a test case for this? Ideally create a jira issue with attached all the code/files that allows us to reproduce the problem. FYI, there is an integration test suite for the maven plugin in https://svn.codehaus.org/jbehave/trunk/plugins/maven/src/it/ It demostrates that scenarios are read and executed. Bug #2: If I insert a call to story.specify() before running the story I get a class cast exception. The lists details.context.givens and details.context.outcomes are filled with strings and not BasicDetails Bug #3: Classbuilder.newInstance(..) in StoryBuilder does not use the fullname when loading the class. Again, test cases would be useful. Feature suggestion #1: The TextStoryParser should accept newlines in the story text files. That would make the text files easier to read for human beings. It does - although possibily not blank lines. I agree blank lines can improve readability. If you can provide the failing file we can investigate. ***CodeGenerator (I know, it is in the sandbox, but it gets distributed ;O): Bug #4: The sandbox/antlr/... directory have got a StoryGeneratorSpike that doesn't work. Bug #5: When I fix the code in the StoryGeneratorSpike and run it, I find out that the generated classes are bogus. antlr is not used anymore - nor supported. Feature suggestion #2: A generator that generates the code for givens, event and outcomes with PendingExceptions, but does not overwrite existing classes. I agree. Thanks - To unsubscribe from this list please visit: http://xircles.codehaus.org/manage_email