Discussion:
[Cucumber] [Parser Error] Getting it when trying to run a very first Cucumber script
Vizag
2015-09-26 08:08:18 UTC
Permalink
Hi All,

I am a very beginner to Cucumber and BDD. I am getting parser error when
tried to run the first test script itself.

I am windows 7 with 64 bit.

Here is feature file:
-----------------------------------

Feature: Visit Career guide page in career.guru99.com

Scenario: Visit career.guru99.com

Given I am on http://career.guru99.com/

When I click on jobs tab

Then I should see Jobs page

Here is the step-guru.rb file from Step_definitions directroy:
----------------------------------------------------------------------------

#Cucumber:

#BDD...Given-When-Then

#Given - that Web site is open and launched

#When - type in log in and pwd and press login

#Then - The page with title 'Welcome' appears


require 'watir-webdriver'

require 'colorize'

browser = Watir::Browser.new



Given (/^ I am on career.guru99 demo Page$/) do

Browser.goto "http://career.guru99.com"

end



When (/^ click on Jobs tab$/) do

Browser.text (:name, "Jobs" ).click

end



Then (/^ I should see Jobs page$/) do

Browser.goto "http://career.guru99.com/jobs/"

puts "Successful Page load"

browser.close

end


And here is the [Parser Error] that I am seeing when running the Cucumber
script.
====================================================================

c:\Work\Test Scripts\Cucumber\features\step_definitions>cucumber
step-guru.rb
*** WARNING: You must use ANSICON 1.31 or higher
(https://github.com/adoxa/ansic
on/) to get coloured output on Windows
step-guru.rb: Parser errors:
(12:1): expected: #Language, #TagLine, #FeatureLine, #Comment, #Empty, got
'requ
ire 'watir-webdriver''
(14:1): expected: #Language, #TagLine, #FeatureLine, #Comment, #Empty, got
'requ
ire 'colorize''
(16:1): expected: #Language, #TagLine, #FeatureLine, #Comment, #Empty, got
'brow
ser = Watir::Browser.new'
(20:1): expected: #Language, #TagLine, #FeatureLine, #Comment, #Empty, got
'Give
n (/^ I am on career.guru99 demo Page$/) do'
(22:1): expected: #Language, #TagLine, #FeatureLine, #Comment, #Empty, got
'Brow
ser.goto "http://career.guru99.com"'
(24:1): expected: #Language, #TagLine, #FeatureLine, #Comment, #Empty, got
'end'

(28:1): expected: #Language, #TagLine, #FeatureLine, #Comment, #Empty, got
'When
(/^ click on Jobs tab$/) do'
(30:1): expected: #Language, #TagLine, #FeatureLine, #Comment, #Empty, got
'Brow
ser.text (:name, "Jobs" ).click'
(32:1): expected: #Language, #TagLine, #FeatureLine, #Comment, #Empty, got
'end'

(36:1): expected: #Language, #TagLine, #FeatureLine, #Comment, #Empty, got
'Then
(/^ I should see Jobs page$/) do'
(38:1): expected: #Language, #TagLine, #FeatureLine, #Comment, #Empty, got
'Brow
ser.goto "http://career.guru99.com/jobs/"'
(Cucumber::Core::Gherkin::ParseError)

C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/cucumber-core-1.3.0/lib/cucumber/core/gh
erkin/parser.rb:34:in `rescue in document'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/cucumber-core-1.3.0/lib/cucumber/core/gh
erkin/parser.rb:29:in `document'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/cucumber-core-1.3.0/lib/cucumber/core.rb
:27:in `block in parse'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/cucumber-core-1.3.0/lib/cucumber/core.rb
:26:in `each'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/cucumber-core-1.3.0/lib/cucumber/core.rb
:26:in `parse'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/cucumber-core-1.3.0/lib/cucumber/core.rb
:18:in `compile'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/cucumber-2.1.0/lib/cucumber/runtime.rb:7
0:in `run!'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/cucumber-2.1.0/lib/cucumber/cli/main.rb:
32:in `execute!'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/cucumber-2.1.0/bin/cucumber:8:in
`<top (
required)>'
C:/Ruby200-x64/bin/cucumber:23:in `load'
C:/Ruby200-x64/bin/cucumber:23:in `<main>'


Can some one please help me here, I have tried to search the group and net
but did not find answer properly.

Thank you,
cheers,
Vizag
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cukes+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Björn Rasmusson
2015-09-29 05:45:22 UTC
Permalink
Post by Vizag
Hi All,
I am a very beginner to Cucumber and BDD. I am getting parser error when
tried to run the first test script itself.
I am windows 7 with 64 bit.
-----------------------------------
Feature: Visit Career guide page in career.guru99.com
Scenario: Visit career.guru99.com
Given I am on http://career.guru99.com/
When I click on jobs tab
Then I should see Jobs page
----------------------------------------------------------------------------
#BDD...Given-When-Then
#Given - that Web site is open and launched
#When - type in log in and pwd and press login
#Then - The page with title 'Welcome' appears
require 'watir-webdriver'
require 'colorize'
browser = Watir::Browser.new
Given (/^ I am on career.guru99 demo Page$/) do
Browser.goto "http://career.guru99.com"
end
When (/^ click on Jobs tab$/) do
Browser.text (:name, "Jobs" ).click
end
Then (/^ I should see Jobs page$/) do
Browser.goto "http://career.guru99.com/jobs/"
puts "Successful Page load"
browser.close
end
And here is the [Parser Error] that I am seeing when running the Cucumber
script.
====================================================================
c:\Work\Test Scripts\Cucumber\features\step_definitions>cucumber
step-guru.rb
Hi,

You are passing the step definition file to cucumber as a feature file, so
of course you get a parse error when the step definition file is parsed by
the Gherkin parser.
Instead run cucumber from the c:\Work\Test Scripts\Cucumber directory:
c:\Work\Test Scripts\Cucumber> cucumber
or
c:\Work\Test Scripts\Cucumber> cucumber features\<feature file>.feature

Regards
Björn
Post by Vizag
*** WARNING: You must use ANSICON 1.31 or higher (
https://github.com/adoxa/ansic
on/) to get coloured output on Windows
(12:1): expected: #Language, #TagLine, #FeatureLine, #Comment, #Empty, got
'requ
ire 'watir-webdriver''
(14:1): expected: #Language, #TagLine, #FeatureLine, #Comment, #Empty, got
'requ
ire 'colorize''
(16:1): expected: #Language, #TagLine, #FeatureLine, #Comment, #Empty, got
'brow
ser = Watir::Browser.new'
(20:1): expected: #Language, #TagLine, #FeatureLine, #Comment, #Empty, got
'Give
n (/^ I am on career.guru99 demo Page$/) do'
(22:1): expected: #Language, #TagLine, #FeatureLine, #Comment, #Empty, got
'Brow
ser.goto "http://career.guru99.com"'
(24:1): expected: #Language, #TagLine, #FeatureLine, #Comment, #Empty, got
'end'
(28:1): expected: #Language, #TagLine, #FeatureLine, #Comment, #Empty, got
'When
(/^ click on Jobs tab$/) do'
(30:1): expected: #Language, #TagLine, #FeatureLine, #Comment, #Empty, got
'Brow
ser.text (:name, "Jobs" ).click'
(32:1): expected: #Language, #TagLine, #FeatureLine, #Comment, #Empty, got
'end'
(36:1): expected: #Language, #TagLine, #FeatureLine, #Comment, #Empty, got
'Then
(/^ I should see Jobs page$/) do'
(38:1): expected: #Language, #TagLine, #FeatureLine, #Comment, #Empty, got
'Brow
ser.goto "http://career.guru99.com/jobs/"'
(Cucumber::Core::Gherkin::ParseError)
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/cucumber-core-1.3.0/lib/cucumber/core/gh
erkin/parser.rb:34:in `rescue in document'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/cucumber-core-1.3.0/lib/cucumber/core/gh
erkin/parser.rb:29:in `document'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/cucumber-core-1.3.0/lib/cucumber/core.rb
:27:in `block in parse'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/cucumber-core-1.3.0/lib/cucumber/core.rb
:26:in `each'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/cucumber-core-1.3.0/lib/cucumber/core.rb
:26:in `parse'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/cucumber-core-1.3.0/lib/cucumber/core.rb
:18:in `compile'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/cucumber-2.1.0/lib/cucumber/runtime.rb:7
0:in `run!'
32:in `execute!'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/cucumber-2.1.0/bin/cucumber:8:in
`<top (
required)>'
C:/Ruby200-x64/bin/cucumber:23:in `load'
C:/Ruby200-x64/bin/cucumber:23:in `<main>'
Can some one please help me here, I have tried to search the group and net
but did not find answer properly.
Thank you,
cheers,
Vizag
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cukes+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reyaz Mohammad
2018-06-15 19:20:08 UTC
Permalink
Still the above solution did not work for me , could you please provide is
there any other solution
Post by Björn Rasmusson
Post by Vizag
Hi All,
I am a very beginner to Cucumber and BDD. I am getting parser error when
tried to run the first test script itself.
I am windows 7 with 64 bit.
-----------------------------------
Feature: Visit Career guide page in career.guru99.com
Scenario: Visit career.guru99.com
Given I am on http://career.guru99.com/
When I click on jobs tab
Then I should see Jobs page
----------------------------------------------------------------------------
#BDD...Given-When-Then
#Given - that Web site is open and launched
#When - type in log in and pwd and press login
#Then - The page with title 'Welcome' appears
require 'watir-webdriver'
require 'colorize'
browser = Watir::Browser.new
Given (/^ I am on career.guru99 demo Page$/) do
Browser.goto "http://career.guru99.com"
end
When (/^ click on Jobs tab$/) do
Browser.text (:name, "Jobs" ).click
end
Then (/^ I should see Jobs page$/) do
Browser.goto "http://career.guru99.com/jobs/"
puts "Successful Page load"
browser.close
end
And here is the [Parser Error] that I am seeing when running the Cucumber
script.
====================================================================
c:\Work\Test Scripts\Cucumber\features\step_definitions>cucumber
step-guru.rb
Hi,
You are passing the step definition file to cucumber as a feature file, so
of course you get a parse error when the step definition file is parsed by
the Gherkin parser.
c:\Work\Test Scripts\Cucumber> cucumber
or
c:\Work\Test Scripts\Cucumber> cucumber features\<feature file>.feature
Regards
Björn
Post by Vizag
*** WARNING: You must use ANSICON 1.31 or higher (
https://github.com/adoxa/ansic
on/) to get coloured output on Windows
(12:1): expected: #Language, #TagLine, #FeatureLine, #Comment, #Empty,
got 'requ
ire 'watir-webdriver''
(14:1): expected: #Language, #TagLine, #FeatureLine, #Comment, #Empty,
got 'requ
ire 'colorize''
(16:1): expected: #Language, #TagLine, #FeatureLine, #Comment, #Empty,
got 'brow
ser = Watir::Browser.new'
(20:1): expected: #Language, #TagLine, #FeatureLine, #Comment, #Empty,
got 'Give
n (/^ I am on career.guru99 demo Page$/) do'
(22:1): expected: #Language, #TagLine, #FeatureLine, #Comment, #Empty,
got 'Brow
ser.goto "http://career.guru99.com"'
(24:1): expected: #Language, #TagLine, #FeatureLine, #Comment, #Empty,
got 'end'
(28:1): expected: #Language, #TagLine, #FeatureLine, #Comment, #Empty,
got 'When
(/^ click on Jobs tab$/) do'
(30:1): expected: #Language, #TagLine, #FeatureLine, #Comment, #Empty,
got 'Brow
ser.text (:name, "Jobs" ).click'
(32:1): expected: #Language, #TagLine, #FeatureLine, #Comment, #Empty,
got 'end'
(36:1): expected: #Language, #TagLine, #FeatureLine, #Comment, #Empty,
got 'Then
(/^ I should see Jobs page$/) do'
(38:1): expected: #Language, #TagLine, #FeatureLine, #Comment, #Empty,
got 'Brow
ser.goto "http://career.guru99.com/jobs/"'
(Cucumber::Core::Gherkin::ParseError)
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/cucumber-core-1.3.0/lib/cucumber/core/gh
erkin/parser.rb:34:in `rescue in document'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/cucumber-core-1.3.0/lib/cucumber/core/gh
erkin/parser.rb:29:in `document'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/cucumber-core-1.3.0/lib/cucumber/core.rb
:27:in `block in parse'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/cucumber-core-1.3.0/lib/cucumber/core.rb
:26:in `each'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/cucumber-core-1.3.0/lib/cucumber/core.rb
:26:in `parse'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/cucumber-core-1.3.0/lib/cucumber/core.rb
:18:in `compile'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/cucumber-2.1.0/lib/cucumber/runtime.rb:7
0:in `run!'
32:in `execute!'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/cucumber-2.1.0/bin/cucumber:8:in
`<top (
required)>'
C:/Ruby200-x64/bin/cucumber:23:in `load'
C:/Ruby200-x64/bin/cucumber:23:in `<main>'
Can some one please help me here, I have tried to search the group and
net but did not find answer properly.
Thank you,
cheers,
Vizag
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cukes+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Thomas Sundberg
2018-06-26 05:37:46 UTC
Permalink
Still the above solution did not work for me , could you please provide is there any other solution
Please consider starting a new thread where you describe your problem.
You answered a three year old mail. It is possible that you use
different versions than the original poster.

/Thomas
Post by Vizag
Hi All,
I am a very beginner to Cucumber and BDD. I am getting parser error when tried to run the first test script itself.
I am windows 7 with 64 bit.
-----------------------------------
Feature: Visit Career guide page in career.guru99.com
Scenario: Visit career.guru99.com
Given I am on http://career.guru99.com/
When I click on jobs tab
Then I should see Jobs page
----------------------------------------------------------------------------
#BDD...Given-When-Then
#Given - that Web site is open and launched
#When - type in log in and pwd and press login
#Then - The page with title 'Welcome' appears
require 'watir-webdriver'
require 'colorize'
browser = Watir::Browser.new
Given (/^ I am on career.guru99 demo Page$/) do
Browser.goto "http://career.guru99.com"
end
When (/^ click on Jobs tab$/) do
Browser.text (:name, "Jobs" ).click
end
Then (/^ I should see Jobs page$/) do
Browser.goto "http://career.guru99.com/jobs/"
puts "Successful Page load"
browser.close
end
And here is the [Parser Error] that I am seeing when running the Cucumber script.
====================================================================
c:\Work\Test Scripts\Cucumber\features\step_definitions>cucumber step-guru.rb
Hi,
You are passing the step definition file to cucumber as a feature file, so of course you get a parse error when the step definition file is parsed by the Gherkin parser.
c:\Work\Test Scripts\Cucumber> cucumber
or
c:\Work\Test Scripts\Cucumber> cucumber features\<feature file>.feature
Regards
Björn
Post by Vizag
*** WARNING: You must use ANSICON 1.31 or higher (https://github.com/adoxa/ansic
on/) to get coloured output on Windows
(12:1): expected: #Language, #TagLine, #FeatureLine, #Comment, #Empty, got 'requ
ire 'watir-webdriver''
(14:1): expected: #Language, #TagLine, #FeatureLine, #Comment, #Empty, got 'requ
ire 'colorize''
(16:1): expected: #Language, #TagLine, #FeatureLine, #Comment, #Empty, got 'brow
ser = Watir::Browser.new'
(20:1): expected: #Language, #TagLine, #FeatureLine, #Comment, #Empty, got 'Give
n (/^ I am on career.guru99 demo Page$/) do'
(22:1): expected: #Language, #TagLine, #FeatureLine, #Comment, #Empty, got 'Brow
ser.goto "http://career.guru99.com"'
(24:1): expected: #Language, #TagLine, #FeatureLine, #Comment, #Empty, got 'end'
(28:1): expected: #Language, #TagLine, #FeatureLine, #Comment, #Empty, got 'When
(/^ click on Jobs tab$/) do'
(30:1): expected: #Language, #TagLine, #FeatureLine, #Comment, #Empty, got 'Brow
ser.text (:name, "Jobs" ).click'
(32:1): expected: #Language, #TagLine, #FeatureLine, #Comment, #Empty, got 'end'
(36:1): expected: #Language, #TagLine, #FeatureLine, #Comment, #Empty, got 'Then
(/^ I should see Jobs page$/) do'
(38:1): expected: #Language, #TagLine, #FeatureLine, #Comment, #Empty, got 'Brow
ser.goto "http://career.guru99.com/jobs/"' (Cucumber::Core::Gherkin::ParseError)
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/cucumber-core-1.3.0/lib/cucumber/core/gh
erkin/parser.rb:34:in `rescue in document'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/cucumber-core-1.3.0/lib/cucumber/core/gh
erkin/parser.rb:29:in `document'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/cucumber-core-1.3.0/lib/cucumber/core.rb
:27:in `block in parse'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/cucumber-core-1.3.0/lib/cucumber/core.rb
:26:in `each'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/cucumber-core-1.3.0/lib/cucumber/core.rb
:26:in `parse'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/cucumber-core-1.3.0/lib/cucumber/core.rb
:18:in `compile'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/cucumber-2.1.0/lib/cucumber/runtime.rb:7
0:in `run!'
32:in `execute!'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/cucumber-2.1.0/bin/cucumber:8:in `<top (
required)>'
C:/Ruby200-x64/bin/cucumber:23:in `load'
C:/Ruby200-x64/bin/cucumber:23:in `<main>'
Can some one please help me here, I have tried to search the group and net but did not find answer properly.
Thank you,
cheers,
Vizag
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
For more options, visit https://groups.google.com/d/optout.
--
Thomas Sundberg
M. Sc. in Computer Science

Mobile: +46 70 767 33 15
Blog: http://www.thinkcode.se/blog
Twitter: @thomassundberg

Better software through faster feedback
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cukes+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...