Karate : How to use response of scenario in afterScenario

陌路散爱 提交于 2021-01-28 04:50:49

问题


What is the best way to use the response of scenario in afterScenario??

Background:    
   * configure afterScenario = function(response){if(response.key){ karate.log('key is present');} else{karate.log('key is not present');} }

    Scenario: get all users 

    Given path 'users'
    When method get
    Then status 200

回答1:


Try function without input params

* configure afterScenario = function(){if(response.key){ karate.log('key is present');} else{karate.log('key is not present');} }

if the response variable available for hooks this should work.



来源:https://stackoverflow.com/questions/55112948/karate-how-to-use-response-of-scenario-in-afterscenario

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!