follow me icons

Thursday, January 27, 2011

Cucumber Parse Error, Expected one of \n \r

My cucumber tests usually have two sections, .manual and .feature, files. I use cucumber to write my automated test cases as well as the manual test cases. This way all of my test cases can be accessed from one project and you can easily differentiate which features are automable and which do not.

The good thing with cucumber is that it will only run the files that have .feature on it and ignoring the rest.

The way I run my test is usually by running the whole folder which is something like this:

cucumber features\regression


inside that folder I will have a mix of .manual and .feature files and folders.

Recently, I have been getting this error when I run my cucumber tests.

features/regression/postcode_details.feature:5:1: Parse error, expected one of "\n", "\r", "|", "\"\"\"", "#", "* ", "Given ", "When ", "Then ", "And ", "But ", "
@", "Scenario", "Scenario Outline". (Cucumber::Parser::SyntaxError


I check the feature file and everything looks ok. It actually took me a while to figure out that the mistake was just because I accidentally named a .manual file into a .feature file and thus the error as cucumber could not understand how to run a manual test. What an annoying mistake to make!

No comments:

Post a Comment