1

I am writing a bdd test using cucumber but i have a problem in reading a line for an assert. it doesn't read the tabulations at the beginning of the expected line in my feature file

here is my assert:

lines.forEachIndexed { i, _ -> assertEquals(expectedLines[i], lines[i]) }

here is the line causing error in my feature file (expectedlines):

|           335374655.87    Files to be generated compliant with SLA figures    0 |

and here is the error:

org.junit.ComparisonFailure: 
Expected :335374655.87  Files to be generated compliant with SLA figures    0
Actual   :          335374655.87    Files to be generated compliant with SLA figures    0

any help please?

almageek
  • 11
  • 1
  • The [Gherkin Documentation](https://cucumber.io/docs/gherkin/reference/?sbsearch=Data%20Tables) mentions that some characters can be escaped using \. Although TAB is not mentioned, I'd try and replace the literal TAB in your feature file with a \t escape sequence. – Arnaud Meuret Jul 08 '21 at 08:42
  • hello, thank you for your response but it takes it as text \t – almageek Jul 08 '21 at 08:51
  • After [some digging](https://github.com/cucumber/common/blob/b94ce625967581de78d0fc32d84c35b46aa5a075/gherkin/java/src/main/java/io/cucumber/gherkin/GherkinLine.java#L27), it looks like this is designed into the Gherkin tokenizer (same behaviour in Ruby). I guess your only path for now is to organize what was conveniently stored in the Gherkin data table into another structure that is protected from the Gherkin parser. The step definition file, if you have control over it, seems a good candidate. – Arnaud Meuret Jul 08 '21 at 09:28

0 Answers0