Permalink
Browse files

Integrate new core feature running through Cucumber.rb and Aruba

- Progress formatter is under development (issues #16, #17)
- core.feature first scenario is passing

Squashed commit of the following:

commit ed3db19c77f40107b3a2038ace8267d4cb642e85
Author: Julien Biezemans <jb@jbpros.com>
Date:   Tue Jul 5 23:46:07 2011 +0200

    Make progress formatter handle failing steps

commit 998dc26bc327876d23c4e7fdc2526a133659db99
Author: Julien Biezemans <jb@jbpros.com>
Date:   Tue Jul 5 23:00:52 2011 +0200

    Assert cucumber.js succeeds on passing scenario

commit 852c214c61c36077e70c0a11d8f4bf06ff685f0b
Author: Julien Biezemans <jb@jbpros.com>
Date:   Tue Jul 5 22:49:20 2011 +0200

    Integrate new core feature running through Cucumber.rb and Aruba

commit 75b82ed9317304a0ed9f3b8c56c3b2c0ae35caa9
Merge: 749512a b5ff2a7
Author: Julien Biezemans <jb@jbpros.com>
Date:   Tue Jul 5 21:15:56 2011 +0200

    Merge branch 'aruba-new-core-local' into 16-progress_formatter

commit 749512a4aa652dd8eac39e133427e2a26156bae1
Author: Julien Biezemans <jb@jbpros.com>
Date:   Tue Jul 5 18:59:51 2011 +0200

    Add a scenario for failing steps

    On hold because failing steps are not yet handled

commit 4bcd476544e4c094e9862fcf209c7a2446d63a8b
Author: Julien Biezemans <jb@jbpros.com>
Date:   Tue Jul 5 16:45:45 2011 +0200

    Handle multi-scenario features

commit b5ff2a7d12519a8434b14b4380a6662880bb798c
Author: Julien Biezemans <jb@jbpros.com>
Date:   Tue Jul 5 11:18:51 2011 +0200

    WIP

commit acecc9acf8c547bcaffd1e827247ad66c4562947
Author: Julien Biezemans <jb@jbpros.com>
Date:   Tue Jul 5 11:05:29 2011 +0200

    Fix CucumberJsMappings module name

commit afe3460dea101c2b6306a1ceb62a6354bb2773f8
Author: Julien Biezemans <jb@jbpros.com>
Date:   Wed Jun 29 00:16:55 2011 +0200

    Make first new core scenario pass with Aruba

    JS mappings are not semantically correct yet. e.g. cucumber.js cannot run specific scenarios at the moment; this prevents us from implementing run_scenario() the same way as within ruby mappings.

    To run it:
        $ ARUBA_REPORT_DIR=doc cucumber features/cucumber-features/core.feature:16 -r features ; open doc/features/cucumber-features/core.feature\:16.html

commit 87d27c739fea70fc4783737f35b6a6f137eb76f9
Author: Julien Biezemans <jb@jbpros.com>
Date:   Sun Jun 19 22:21:26 2011 +0200

    Count passed steps and scenarios in progress formatter (wip)

commit 15d749bac0f6956646df65b1fdf8e92cfbd62b8f
Author: Julien Biezemans <jb@jbpros.com>
Date:   Sun Jun 19 11:48:38 2011 +0200

    Add initial working progress formatter

commit dc3301a5148b8737cf838b7435e6aac8e797bc14
Author: Julien Biezemans <jb@jbpros.com>
Date:   Thu Jun 16 23:16:13 2011 +0200

    Handle step result (wip)

commit f5f6268714a6310cfeaf2c6ed9445c1921053eca
Merge: 0947988 8ae4c0e
Author: Julien Biezemans <jb@jbpros.com>
Date:   Wed Jun 15 00:37:15 2011 +0200

    Merge branch 'master' into 16-progress_formatter

commit 0947988a580714856b1d551ee9acdcc9ddc15a9f
Merge: 7f595b4 252634f
Author: Julien Biezemans <jb@jbpros.com>
Date:   Wed Jun 15 00:30:04 2011 +0200

    Merge branch 'master' into 16-progress_formatter

commit 7f595b48713b352042d2c382e19841957cd42b76
Author: Julien Biezemans <jb@jbpros.com>
Date:   Wed Jun 15 00:19:31 2011 +0200

    Add ProgressFormatter.listen()

commit a08b10b557e90e0f6ef3cdcb96558b7c45a6daf5
Merge: 0857a6c fc83930
Author: Julien Biezemans <jb@jbpros.com>
Date:   Tue Jun 14 19:20:56 2011 +0200

    Merge branch 'master' into 16-progress_formatter

    Conflicts:
    	lib/cucumber.js

commit 0857a6c
Author: Julien Biezemans <jb@jbpros.com>
Date:   Mon Jun 6 15:52:28 2011 +0200

    Stuck because of 'after' events fired too late -- on hold until refactoring is finished
  • Loading branch information...
jbpros committed Jul 5, 2011
1 parent 8ae4c0e commit f3b40fd824df932490c04130e29bd286187db9fc
View
@@ -2,3 +2,6 @@
node_modules
*~
.#*
+.rvmrc
+doc/
+tmp/
View
@@ -0,0 +1,2 @@
+source :rubygems
+gem "aruba", "0.4.3"
View
@@ -0,0 +1,42 @@
+GEM
+ remote: http://rubygems.org/
+ specs:
+ aruba (0.4.3)
+ bcat (>= 0.6.1)
+ childprocess (>= 0.1.9)
+ cucumber (>= 0.10.7)
+ rdiscount (>= 1.6.8)
+ rspec (>= 2.6.0)
+ bcat (0.6.1)
+ rack (~> 1.0)
+ builder (3.0.0)
+ childprocess (0.1.9)
+ ffi (~> 1.0.6)
+ cucumber (1.0.0)
+ builder (>= 2.1.2)
+ diff-lcs (>= 1.1.2)
+ gherkin (~> 2.4.1)
+ json (>= 1.4.6)
+ term-ansicolor (>= 1.0.5)
+ diff-lcs (1.1.2)
+ ffi (1.0.9)
+ gherkin (2.4.1)
+ json (>= 1.4.6)
+ json (1.5.3)
+ rack (1.3.0)
+ rdiscount (1.6.8)
+ rspec (2.6.0)
+ rspec-core (~> 2.6.0)
+ rspec-expectations (~> 2.6.0)
+ rspec-mocks (~> 2.6.0)
+ rspec-core (2.6.4)
+ rspec-expectations (2.6.0)
+ diff-lcs (~> 1.1.2)
+ rspec-mocks (2.6.0)
+ term-ansicolor (1.0.5)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ aruba (= 0.4.3)
View
@@ -32,15 +32,30 @@ The only dependency of cucumber.js is Gherkin:
## Run tests
-Specs:
+### Specs
$ cd spec
$ ../node_modules/.bin/jasmine-node .
-Features (yes, cucumber.js is eating itself):
+### Features
+
+Features run through cucumber.js have to be run one at a time for the moment. We are working on it :)
+
+#### Cucumber-features
+
+There is a common set of features shared between all cucumber implementations. Find more the [Github repository](http://github.com/cucumber/cucumber-features).
+
+Ruby and Bundler are required for this to work.
$ git submodule update --init
- $ ./cucumber.js features/cucumber-features/basic_feature_execution.feature
+ $ bundle
+ $ rm -rf doc; ARUBA_REPORT_DIR=doc cucumber features/cucumber-features/core.feature -r features
+ $ open doc/features/cucumber-features/*.html # might open a lot of files ;)
+
+#### Cucumber.js-specific features
+
$ ./cucumber.js features/asynchronous_step_definitions-issue_01.feature
-The features have to be run one at a time for the moment. Sorry for that, we're working on it :)
+#### Legacy cucumber.js core feature
+
+ $ ./cucumber.js features/cucumber-features-legacy/core.feature
View
@@ -1,10 +1,11 @@
#!/usr/bin/env node
-var fs = require('fs');
-var Cucumber = require('./lib/cucumber');
-var supportCode = require('./features/step_definitions/cucumber_steps');
-var cucumber = Cucumber(fs.readFileSync(process.ARGV[2]), supportCode);
-var simpleListener = Cucumber.Debug.SimpleAstListener({logToConsole: true});
-cucumber.attachListener(simpleListener);
+var fs = require('fs');
+var Cucumber = require('./lib/cucumber');
+var supportCodePath = process.ARGV[3] ? process.cwd() + '/' + process.ARGV[3] : './features/step_definitions/cucumber_steps';
+var supportCode = require(supportCodePath);
+var cucumber = Cucumber(fs.readFileSync(process.ARGV[2]), supportCode);
+var progressFormatter = Cucumber.Listener.ProgressFormatter;
+cucumber.attachListener(progressFormatter());
cucumber.start(function() {
/*
Some "after" messages from the tree walker are still not processed when
@@ -13,10 +14,10 @@ cucumber.start(function() {
Cucumber.TreeWalker.broadcastMessagesBeforeAndAfterFunction() using no
callback and expecting the passed function to handle the possible
callback.
-
+
Fixing this is easy: broadcastMessagesBeforeAndAfterFunction() would
need a callback and run it AFTER broadcasting "after" messages.
-
+
Uncomment the following line to see that behaviour:
*/
// console.log("Done. But too soon, some dudes haven't finished doing their stuff just yet.");
@@ -0,0 +1,124 @@
+Feature: Core feature elements execution
+ In order to have automated acceptance tests
+ As a developer
+ I want Cucumber to run core feature elements
+
+ Scenario: Simple flat steps
+ Given a step definition matching /^a step passes$/
+ When I run the following feature:
+ """
+ Feature: Simple flat steps
+ In order to execute features
+ As cucumber
+ I want to run features successfully
+
+ Scenario: Simple flat step
+ Given a step passes
+ When a step passes
+ Then a step passes
+ """
+ Then the feature should have run successfully
+
+ Scenario: Given, When, Then, And and But steps
+ Given a "Given" step definition matching /^a "Given" step passes$/
+ And a "When" step definition matching /^a "When" step passes$/
+ And a "Then" step definition matching /^a "Then" step passes$/
+ When I run the following feature:
+ """
+ Feature: Given, When, Then, And and But step execution
+ Scenario: All kinds of steps
+ Given a "Given" step passes
+ When a "When" step passes
+ Then a "Then" step passes
+
+ Scenario: All kinds of steps with And's and But's
+ Given a "Given" step passes
+ And a "Given" step passes
+ But a "Given" step passes
+ When a "When" step passes
+ And a "When" step passes
+ But a "When" step passes
+ Then a "Then" step passes
+ And a "Then" step passes
+ But a "Then" step passes
+ """
+ Then the feature should have run successfully
+
+ Scenario: Step definition body is executed
+ Given a step definition matching /^I call a watched step$/ counting its calls
+ And a step definition matching /^the watched step should have been called (\d+) times?$/ checking the number of step calls
+ When I run the following feature:
+ """
+ Feature: Step definition body execution
+ Scenario: Step definition body is executed once
+ When I call a watched step
+ Then the watched step should have been called 1 time
+
+ Scenario: Step definition body is executed several times
+ When I call a watched step
+ And I call a watched step
+ And I call a watched step
+ Then the watched step should have been called 3 times
+ """
+ Then the feature should have run successfully
+
+ Scenario: Steps accepting parameters
+ Given a step definition matching /^I call a step with "(.*)"$/ recording its parameters
+ And a step definition matching /^I call a step with "(.*)", "(.*)" and "(.*)"$/ recording its parameters
+ And a step definition matching /^the (\d+)(?:st|nd|rd) received parameter should be "(.*)"$/ checking a recorded parameter
+ When I run the following feature:
+ """
+ Feature: Steps receiving parameters
+ Scenario: Single-parameter step
+ When I call a step with "a parameter"
+ Then the 1st received parameter should be "a parameter"
+
+ Scenario: Three-parameter step
+ When I call a step with "one", "two" and "three"
+ Then the 1st received parameter should be "one"
+ And the 2nd received parameter should be "two"
+ And the 3rd received parameter should be "three"
+ """
+ Then the feature should have run successfully
+
+ Scenario: Steps accepting a DocString parameter
+ Given a step definition matching /^I call a step with the following text:$/ recording its parameters
+ And a step definition matching /^I call a step with "(.*)" and the following text:$/ recording its parameters
+ And a step definition matching /^the (\d+)(?:st|nd) received parameter should be "(.*)"$/ checking a recorded parameter
+ And a step definition matching /^the (\d+)(?:nd) received parameter should be:$/ checking a recorded parameter
+ When I run the following feature:
+ """
+ Feature: Steps receiving a DocString parameter
+ Scenario: One-liner DocString parameter
+ When I call a step with the following text:
+ \"\"\"
+ The cucumber (Cucumis sativus) is a widely cultivated plant in the gourd family Cucurbitaceae.
+ \"\"\"
+ Then the 1st received parameter should be "The cucumber (Cucumis sativus) is a widely cultivated plant in the gourd family Cucurbitaceae."
+
+ Scenario: Matching group and one-liner DocString
+ When I call a step with "Cucumber" and the following text:
+ \"\"\"
+ The cucumber (Cucumis sativus) is a widely cultivated plant in the gourd family Cucurbitaceae.
+ \"\"\"
+ Then the 1st received parameter should be "Cucumber"
+ And the 2nd received parameter should be "The cucumber (Cucumis sativus) is a widely cultivated plant in the gourd family Cucurbitaceae."
+
+ Scenario: Matching group and multiline DocString
+ When I call a step with "Cucumber" and the following text:
+ \"\"\"
+ cu·cum·ber |ˈkyoōˌkəmbər|
+ noun
+ 1. a long, green-skinned fruit with watery flesh, usually eaten raw in salads or pickled.
+ 2. the climbing plant of the gourd family that yields this fruit, native to the Chinese Himalayan region. It is widely cultivated but very rare in the wild. • Cucumis sativus, family Cucurbitaceae.
+ \"\"\"
+ Then the 1st received parameter should be "Cucumber"
+ And the 2nd received parameter should be:
+ \"\"\"
+ cu·cum·ber |ˈkyoōˌkəmbər|
+ noun
+ 1. a long, green-skinned fruit with watery flesh, usually eaten raw in salads or pickled.
+ 2. the climbing plant of the gourd family that yields this fruit, native to the Chinese Himalayan region. It is widely cultivated but very rare in the wild. • Cucumis sativus, family Cucurbitaceae.
+ \"\"\"
+ """
+ Then the feature should have run successfully
Oops, something went wrong.

0 comments on commit f3b40fd

Please sign in to comment.