Karate 从第二个要素文件调用第一个要素,在没有指定线索的情况下失败
成功运行第一个.feature文件,但是从第二个调用它。feature失败,没有任何分析线索。你能帮我找到根本原因吗 我的第一个的来源。功能:Karate 从第二个要素文件调用第一个要素,在没有指定线索的情况下失败,karate,Karate,成功运行第一个.feature文件,但是从第二个调用它。feature失败,没有任何分析线索。你能帮我找到根本原因吗 我的第一个的来源。功能: Feature: 采样管理-样本登记 Background: 读取随机生成的条形码、手机号、采样类型等作为入参 * url baseURL * def randomData = Java.type('utils.RandomData') * def barcode = randomData.getRandom(11)
Feature: 采样管理-样本登记
Background: 读取随机生成的条形码、手机号、采样类型等作为入参
* url baseURL
* def randomData = Java.type('utils.RandomData')
* def barcode = randomData.getRandom(11)
* def randomPhone = randomData.getTelephone()
* def sampletype = randomData.getNum(0,1)
Scenario: 输入合法参数进行正常样本登记,确认能够登记成功
Given path 'iEhr/PersonSample'
# * header Content-type = 'application/x-www-form-urlencoded; charset=UTF-8'
* cookies { JSESSIONID: '#(jsessionID)',SESSION: '#(sessionID)', ACMETMP: '#(acmetmpID)'}
* def autoMotherName = "autoMname"+ barcode
# * def confData = {mothername: "#(autoMotherName)", barcode: "#(barcode)", mobile: '#(randomPhone)', sampletype:"#(sampletype)" }
# 设置sampletype为1,已被采样
* def confData = {mothername: "#(autoMotherName)", barcode: "#(barcode)", mobile: '#(randomPhone)', sampletype:"1" }
# 打印入参变量输出
* print confData
# 用例与数据分离
* def paramObj = read('classpath:mainFlow/sampleSaveReqTest.json')
* print paramObj
* form field param = paramObj
When method post
Then status 200
* json result = response[0].result
* def personId = result[0].personid
* def sampleid = result[0].sampleid
* print personId
* print sampleid
Feature: 提交递送样本
Background:
* def sampleResult = call read('classpath:mainFlow/first.feature')
* print sampleResult
我的第二个的来源。功能:
Feature: 采样管理-样本登记
Background: 读取随机生成的条形码、手机号、采样类型等作为入参
* url baseURL
* def randomData = Java.type('utils.RandomData')
* def barcode = randomData.getRandom(11)
* def randomPhone = randomData.getTelephone()
* def sampletype = randomData.getNum(0,1)
Scenario: 输入合法参数进行正常样本登记,确认能够登记成功
Given path 'iEhr/PersonSample'
# * header Content-type = 'application/x-www-form-urlencoded; charset=UTF-8'
* cookies { JSESSIONID: '#(jsessionID)',SESSION: '#(sessionID)', ACMETMP: '#(acmetmpID)'}
* def autoMotherName = "autoMname"+ barcode
# * def confData = {mothername: "#(autoMotherName)", barcode: "#(barcode)", mobile: '#(randomPhone)', sampletype:"#(sampletype)" }
# 设置sampletype为1,已被采样
* def confData = {mothername: "#(autoMotherName)", barcode: "#(barcode)", mobile: '#(randomPhone)', sampletype:"1" }
# 打印入参变量输出
* print confData
# 用例与数据分离
* def paramObj = read('classpath:mainFlow/sampleSaveReqTest.json')
* print paramObj
* form field param = paramObj
When method post
Then status 200
* json result = response[0].result
* def personId = result[0].personid
* def sampleid = result[0].sampleid
* print personId
* print sampleid
Feature: 提交递送样本
Background:
* def sampleResult = call read('classpath:mainFlow/first.feature')
* print sampleResult
我单独运行第一个功能,它可以工作。但是,空手道在运行second.feature后会报告以下错误。知道如何调试才能找到根本原因吗?我不知道复读有什么问题。非常感谢
* def sampleResult = call read('classpath:mainFlow/first.feature')
-未知-:14-javascript评估失败:读取('classpath:mainFlow/first.feature'),null查找
空手道配置.js的一些问题。正如巴布在评论中所说,很难弄清问题所在,我建议您遵循以下流程:
另外,如果最新的预览版本0.9.3.RC2更能显示错误,请尝试
如果您可以将问题复制为一个小示例,它将帮助我们-因为我们确实需要更好地显示更有用的错误日志,而不仅仅是null
我发现很少有变量需要作为输入传递给first.feature,这些是从second.feature传递的还是至少在second.feature的范围内?所有my feature文件和json数据文件都位于同一文件夹中。我可以在单独运行fist.feature时成功运行。但是,我没有从second.feature传递任何变量,因为我认为在调用first.feature时,应该传递变量的是first.feature。我现在不能复制这个问题。我将提交一个问题,一旦我得到它的复制。谢谢~~可能是类路径问题。还有,@Peter空手道接受捐款吗?@AshikVetrivelu是的