【发布时间】:2021-06-30 06:15:13
【问题描述】:
说明:升级到空手道 1.1.0.RC3 后出现参考错误消息
步骤: 执行 test.feature 文件
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'
}
}
"""
错误信息:
org.graalvm.polyglot.PolyglotException: ReferenceError: "randomAlphabetic" is not defined
- <js>.:anonymous(Unnamed:2)
Git repo 供参考 - https://github.com/naveenkrao/karate-sample-project
【问题讨论】:
标签: karate