Getting gherkin.lexer.LexingError: Lexing error on line 11: ''address': Not sure why .Please help

13 views
Skip to first unread message

Aditya Mukesh

unread,
Oct 24, 2017, 4:20:59 AM10/24/17
to Cukes

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
   

Eric Kessler

unread,
Oct 24, 2017, 10:49:25 PM10/24/17
to Cukes


On Tuesday, October 24, 2017 at 4:20:59 AM UTC-4, Aditya Mukesh wrote:

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'

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. 
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
  }
  """
```
 
    When method post
    Then status 201
   


Enjoy!
Eric K 
Reply all
Reply to author
Forward
0 new messages