I have started with implementation of a BDD tool for Catch. I will use it for my job. The first implementation language will be Python 3. The license will be the same as the Catch have -- the Boost one.
(To clarify my experience, I am very new to both Catch and to BDD. Anyway, I am seriously interested because of our new C++ project, and I like it.)
The idea is to have a features/ and testscatch/ or the like at the level of your src/ directory. If only the features/ exists, the testscatch/ will be created and filled with the generated Catch skeletons. If only the testscatch/ exist (i.e. also for older projects), the features/ files will be generated. If both exist, the synchronization happens.
I plan to base the xxx.feature
files both on a non-programmer view (user story, scenarios, given when,
then) but also on a programmer view (feature, test, sections with
nesting) with possibility to mix the styles as you wish. Anyway, the xxx.feature files will not contain any code -- only the identification strings, possibly [tags], and some way to express nesting.
Would you be interested in such a tool?
On 10 January 2014 08:15, pepr <pri...@atlas.cz> wrote:
> [...]
I can't grasp what is the actual idea, what is the leading feature here,
what problem are you trying to solve.
Yes, this is the first goal.
> Such code generation in both directions would useful, natural, and not too big of a project.
Yes, this is what I was thinking about.
> Where I think your proposal goes too far is in suggesting you should be able to keep them in sync if you maintain them independently.
My goal is at least to report the differences. It will be more apparent later whether the automatic synchronization is reasonable.
> I think that would only be manageable in the "full Cucumber" version.
Frankly, I do not know Ruby that much to be fluent in it. As you said, I prefer simple enough tools if they need not to be complex. I did not study Cucumber very much, but it seems to implement another "programming language" used in the text description. In my opinion, things should sometimes be more restrictive to be useful.
OK, I will be back when I have something runnable.
I need your opinion...
I am going to publish the t2f.py script that takes Catch tests, does lexical and syntactic parsing,
and produces the corresponding *.feature_new files. Actually, this is similar to what Catch produces
when processing the input:
SCENARIO( "name for scenario", "[optional tags]" ) {
GIVEN( "some initial state" ) {
// set up initial state
WHEN( "an operation is performed" ) {
// perform operation
THEN( "we arrive at some expected state" ) {
// assert expected state
}
}
}
}
-------------------------------------------------------------------------------
Scenario: name for scenario
Given: some initial state
When: an operation is performed
Then: we arrive at some expected state
-------------------------------------------------------------------------------
scenario: name for scenario [optional tags]
given: some initial state
when: an operation is performed
then: we arrive at some expected state
scenario: name for scenario
tags: [optional tags]
given: some initial state
when: an operation is performed
then: we arrive at some expected state
[...] The other possibility, which I think is more feasible - and appears to be what you're actually proposing, is that you maintain the free-form user stories as text files separately from the test code - but allow generation of test code skeleton (using the macros I mentioned earlier) from the text files,
or of the text files from existing test code. I've considered this before to and had it in the back of my mind for a while. I would be very supportive of such a tool.
Such code generation in both directions would useful, natural, and not too big of a project. Where I think your proposal goes too far is in suggesting you should be able to keep them in sync if you maintain them independently. I think that would only be manageable in the "full Cucumber" version.