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\it>mvn 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 filtered resources.
[INFO] [compiler:testCompile]
[INFO] No sources to compile
[INFO] [surefire:test]
[INFO] No tests to run.
[INFO] [jar:jar]
[INFO] Building jar:
C:\work\svn_workspace\jbehaveTrunk\plugins\maven\src\it\test1\target\jbehave-maven-plugin-it-test1-1.1-SNAPSHOT.jar
[INFO] [jbehave:run-behaviours {execution: run-behaviours}]
Done something
.
Time: 0.0s
Total: 1. Success!
[INFO]
----------------------------------------------------------------------------
[INFO] Building jBehave Maven Plugin Integration Test 2
[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\test2\target\classes
[INFO] [resources:testResources]
[INFO] Using default encoding to copy filtered resources.
[INFO] [compiler:testCompile]
[INFO] No sources to compile
[INFO] [surefire:test]
[INFO] No tests to run.
[INFO] [jar:jar]
[INFO] Building jar:
C:\work\svn_workspace\jbehaveTrunk\plugins\maven\src\it\test2\target\jbehave-maven-plugin-it-test2-1.1-SNAPSHOT.jar
[INFO] [jbehave:run-story {execution: run-story}]
Time: 0.0s
Total: 0. Success!
[INFO]
----------------------------------------------------------------------------
[INFO] Building jBehave Maven Plugin Integration Test 3
[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\test3\target\classes
[INFO] [resources:testResources]
[INFO] Using default encoding to copy filtered resources.
[INFO] [compiler:testCompile]
[INFO] No sources to compile
[INFO] [surefire:test]
[INFO] No tests to run.
[INFO] [jar:jar]
[INFO] Building jar:
C:\work\svn_workspace\jbehaveTrunk\plugins\maven\src\it\test3\target\jbehave-maven-plugin-it-test3-1.1-SNAPSHOT.jar
[INFO] [jbehave:print-story {execution: run-story}]
Story: 1
As a
I want
So that
[INFO]
----------------------------------------------------------------------------
[INFO] Building jBehave Maven Plugin Integration Test Reactor
[INFO] task-segment: [integration-test]
[INFO]
----------------------------------------------------------------------------
[INFO] [site:attach-descriptor]
[INFO]
[INFO]
[INFO]
------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
------------------------------------------------------------------------
[INFO] jBehave Maven Plugin Integration Test 1 ............... SUCCESS
[9.453s]
[INFO] jBehave Maven Plugin Integration Test 2 ............... SUCCESS
[0.938s]
[INFO] jBehave Maven Plugin Integration Test 3 ............... SUCCESS
[0.937s]
[INFO] jBehave Maven Plugin Integration Test Reactor ......... SUCCESS
[2.297s]
[INFO]
------------------------------------------------------------------------
[INFO]
------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO]
------------------------------------------------------------------------
[INFO] Total time: 14 seconds
[INFO] Finished at: Mon May 21 09:12:08 CEST 2007
[INFO] Final Memory: 8M/15M
[INFO]
------------------------------------------------------------------------
---------------------------------------------------------------------
To unsubscribe from this list please visit:
http://xircles.codehaus.org/manage_email