ArunBharath
ArunBharath

Reputation: 153

Getting gherking.lexer.lexingError, when I try to use javascript in Karate

JavascriptUtil.feature

Feature: test soap end point

Background: 

* def randomString = function(){ 
                return Math.floor(100000000 + Math.random() * 900000000);}

*** Scenario:

TestFeature file

@smoke@sanity
Feature: test soap end poin

Background: 
   * url    'URL of the API'

   * call read('JavascriptUtil.feature')

Scenario:   Test

 * def temp = randomPhoneString()
 * print temp

The error I got is:

Caused by: gherkin.lexer.LexingError: Lexing error on line 6: 'return Math.floor(100000000 + Math.random() * 900000000);}

Upvotes: 1

Views: 454

Answers (1)

Peter Thomas
Peter Thomas

Reputation: 58058

Remove the line feed please or use the """ "doc_string" syntax - refer documentation.

* def randomString = function(){ return Math.floor(100000000 + Math.random() * 900000000) }

Upvotes: 1

Related Questions