首页 > 解决方案 > 从第二个功能文件调用第一个功能,没有指定线索失败

问题描述

运行第一个.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

解决方案


寻找一些问题karate-config.js。正如巴布在评论中所说,很难弄清楚问题是什么,我建议你按照这个过程:https ://github.com/intuit/karate/wiki/How-to-Submit-an-Issue

如果最新的预览版本 0.9.3.RC2 更能显示错误是什么,也可以试试。

如果您可以将问题复制为一个小例子,它将对我们有所帮助 - 因为我们确实需要在显示更多有用的错误日志方面做得更好,而不仅仅是null.


推荐阅读