Creation of a new parser to support the tracking of line numbers in error reporting.

Description

Attached is a patch for JBehave.

The main change is the addition of a new parser. Its based on Eclipse JFace, which means we can track line numbers in error reporting. It can also be re-used for syntax highlighting in an Eclipse editor. JFace requires some Eclipse libraries, so these are new dependencies which still work even though we're not running in an OSGi container. The parser is also very fast compared to the current regex-based parser - the longest running test was 25s for the previous parser, and now its just 0.5s.

In ScenarioParserBehaviour we've written some tests for the default configuration of JUnitScenario. They fail with the current parser but pass with the new one which is able to throw a new ParseException for each type of problem.

We've added one test to CandidateStepBehaviour.java that currently fails. Doug tried fixing it by changing the ExamplesTable to be backed by a LinkedHashMap which means that the arguments are automatically in the correct order. But this did not work for other examples and couldn't figure out how to make it work, so the test is currently broken. We'd need help to fix this.

Further proposed changes would improve the detection of problems such as:

  • not having enough columns in the examples section to cover all the required variables

  • having more columns than required in the examples section

  • checking the order of statements e.g. ensure a When comes after a Given

  • allowing boolean's for parameters

The first two are quite difficult as it involves a good knowledge of the CandidateStep class.

Assignee

Unassigned

Reporter

Mike Neeve

Labels

None

Components

Fix versions

Affects versions

Priority

Major
Configure