Description : Getting reference error message after upgrading to karate 1.1.0.RC3
Steps: Execute the test.feature file
test.feature
Scenario: Get custom request
* def testUtils = call read('classpath:features/utils.feature')
* def getRequest = testUtils.customRequest()
* print getRequest
Utils.feature
Feature: common utilities
Scenario:
* def randomAlphabetic = function (count) { return org.apache.commons.lang3.RandomStringUtils.randomAlphabetic(count) }
* def customRequest =
"""
function() {
var name = randomAlphabetic(2)
return {
name:name,
city:'Bangalore'
}
}
"""
Error message :
org.graalvm.polyglot.PolyglotException: ReferenceError: "randomAlphabetic" is not defined
- <js>.:anonymous(Unnamed:2)
Git repo for reference - https://github.com/naveenkrao/karate-sample-project