如何在空手道框架中将变量从方案传递回afterScenario

时间:2019-05-10 11:06:39

标签: javascript karate

需要在空手道框架中将测试用例ID(变量)和测试用例status_code从我的方案传递到afterScenario()。 我想在场景运行后执行afterScenario并通过通过或失败来更新测试用例的状态。

Background:
        * url 'https://myorganisation.com/tokenService' 
        * def status_code = 49
        * configure afterScenario =
      """
      function() {
      karate.call('classpath:com/test/setup/SetStatus.feature',{ caseID: '#(case_id)', status: '#(status_code)'});    
      }
      """


    Scenario: Create token - POSITIVE
        * def case_id = 12345
        Given path '/oauth/token'
        And param grant_type = 'client_credentials'
        And request {}
        And header Content-Type = 'application/json'
        And header Accept = 'application/json'
        When method POST
        Then status 200
        And set status_code = 50

0 个答案:

没有答案