Discussion:
[Cucumber] Getting gherkin.lexer.LexingError: Lexing error on line
(too old to reply)
Aditya Mukesh
2017-10-18 05:58:01 UTC
Permalink
Raw Message
Feature: Add a warehouse

Background:
* url baseUrl

Scenario: Create a warehouse

Given path 'warehouse/warehouses'
And header Authorization = 'Bearer
eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiI5OTAwMzgzNzk3IiwidXNlcklEIjoyLCJ1c2VyUm9sZSI6IlNFTExFUiIsImlhdCI6MTUwODMwNTI5MywibmJmIjoxNTA4MzA1MjkzLCJleHAiOjE1MTA0NTI3Nzd9.vABe5Bz0a0Eq-BOayvRu_3N7OeDIIwuo7b8Azo-R47I'
And request {
'address': {
'city': 'string',
'country': 'string',
'latitude': 'string',
'line1': 'string',
'line2': 'string',
'longitude': 'string',
'pincode': 'string',
'state': 'string'
},
'createdBy': 0,
'createdOn': '2017-10-18T04:35:14.022Z',
'id': 0,
'lastUpdatedBy': 0,
'lastUpdatedOn': '2017-10-18T04:35:14.022Z',
'name': 'string',
'slotTypes': [
{
'createdBy': 0,
'createdOn': '2017-10-18T04:35:14.022Z',
'id': 0,
'lastUpdatedBy': 0,
'lastUpdatedOn': '2017-10-18T04:35:14.022Z',
'price': 0,
'type': 'string',
'warehouseID': 0
}
]
}
When method post
Then status 201
--
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.
Eric Kessler
2017-10-25 02:49:11 UTC
Permalink
Raw Message
Post by Aditya Mukesh
Feature: Add a warehouse
* url baseUrl
Scenario: Create a warehouse
Given path 'warehouse/warehouses'
And header Authorization = 'Bearer
eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiI5OTAwMzgzNzk3IiwidXNlcklEIjoyLCJ1c2VyUm9sZSI6IlNFTExFUiIsImlhdCI6MTUwODMwNTI5MywibmJmIjoxNTA4MzA1MjkzLCJleHAiOjE1MTA0NTI3Nzd9.vABe5Bz0a0Eq-BOayvRu_3N7OeDIIwuo7b8Azo-R47I'
Almost no way this massive string is meaningful at this scope. Feel free to
use

```
And header Authorization = '<some_magic_key>'
```

and the substitute in the magic value inside of the step definition
instead.
Post by Aditya Mukesh
And request {
'address': {
'city': 'string',
'country': 'string',
'latitude': 'string',
'line1': 'string',
'line2': 'string',
'longitude': 'string',
'pincode': 'string',
'state': 'string'
},
'createdBy': 0,
'createdOn': '2017-10-18T04:35:14.022Z',
'id': 0,
'lastUpdatedBy': 0,
'lastUpdatedOn': '2017-10-18T04:35:14.022Z',
'name': 'string',
'slotTypes': [
{
'createdBy': 0,
'createdOn': '2017-10-18T04:35:14.022Z',
'id': 0,
'lastUpdatedBy': 0,
'lastUpdatedOn': '2017-10-18T04:35:14.022Z',
'price': 0,
'type': 'string',
'warehouseID': 0
}
]
}
That looks like a step that takes up multiple lines and that is why you are
getting a lexing error. To the best of my knowledge, there is no such thing
in Gherkin as a step that takes up multiple lines. There are, however,
steps that can take large blocks of text:

```
And request
"""
{
# write your big JSON blob here
}
"""
```
Post by Aditya Mukesh
When method post
Then status 201
Enjoy!
Eric K
--
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...