karate - 从第二个功能文件调用第一个功能,没有指定线索失败
问题描述
运行第一个.feature文件成功,但是从第二个.feature调用失败,没有任何分析线索。您有什么想法可以帮助我找到根本原因吗?
我的 first.feature 的来源:
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
我的 second.feature 的来源:
Feature: 提交递送样本
Background:
* def sampleResult = call read('classpath:mainFlow/first.feature')
* print sampleResult
我单独运行 first.feature,它可以工作。但是,空手道在运行 second.feature 后会报告以下错误。知道如何调试以找到根本原因吗?我不知道第二次阅读有什么问题。非常感谢!
* def sampleResult = call read('classpath:mainFlow/first.feature')
-unknown-:14 - javascript 评估失败:read('classpath:mainFlow/first.feature'), null
解决方案
寻找一些问题karate-config.js
。正如巴布在评论中所说,很难弄清楚问题是什么,我建议你按照这个过程:https ://github.com/intuit/karate/wiki/How-to-Submit-an-Issue
如果最新的预览版本 0.9.3.RC2 更能显示错误是什么,也可以试试。
如果您可以将问题复制为一个小例子,它将对我们有所帮助 - 因为我们确实需要在显示更多有用的错误日志方面做得更好,而不仅仅是null
.
推荐阅读
- css - 如何使响应式视频嵌入与另一个 div 成排并共享相同的高度?
- python - 在python中使用vid.stab将ffmpeg的输出文件捕获到一个变量中
- facebook - 无法提交文件以供 Facebook 审批
- c - Clarification about precedence of operators
- android - 如何将 recycleView 与数据绑定库一起使用?
- c# - 使用 UML 序列图生成自动测试用例
- python - 我应该为多个 Python 版本使用系统还是单独的 pipenv?
- youtrack - 有没有办法使用新的 YouTrack REST API 进行过滤?
- c - 在函数“ResultatdeMouvement”中将 R 记录写入文件“时是否出错?
- html - 2个文件中工具栏的相同css,看起来不同