Karate afterFeature function execution works fine when run locally but fails when run through Jenkins

Viewed 602

Karate afterFeature function execution works fine when run locally but fails when run through Jenkins, I get assertion failed: assert evaluated to false: responseStatus == 200 || responseStatus == 404. Whereas the responseStatus should either be 200 or 404.

Code Snippet

main.feature snippet

  Background:
    ...
    * def myName1 = 'karate-test-name'
    * configure afterFeature = function(){ karate.call('cleanup.feature'); }
  ...
  ...

cleanup.feature

@ignore
Feature: To cleanup after main.feature execution. This Feature is not supposed to be run individually.

  Background:
    * url myUrl

  Scenario: Delete
    * print 'In "cleanup.feature", If exists delete: ' + myName1
    Given path 'v1/myapi/',myName1,''
    And header Content-Type = 'application/json; charset=utf-8'
    And request {}
    When method delete
    Then assert responseStatus == 200 || responseStatus == 404

Logs from Jenkins: The assertion for the responseStatus fails, but it does not log the actual value of the responseStatus.

23:03:15.448 [pool-1-thread-4] ERROR com.intuit.karate - assertion failed: assert evaluated to false: responseStatus == 200 || responseStatus == 404
23:03:15.450 [pool-1-thread-4] ERROR com.intuit.karate - feature call failed: cleanup.feature
arg: null
cleanup.feature:16 - assert evaluated to false: responseStatus == 200 || responseStatus == 404
23:03:15.451 [pool-1-thread-4] ERROR com.intuit.karate - javascript function call failed: 
cleanup.feature:16 - assert evaluated to false: responseStatus == 200 || responseStatus == 404
23:03:15.451 [pool-1-thread-4] ERROR com.intuit.karate - failed function body: function(){ karate.call('cleanup.feature'); }

Moreover, I do not see the logs for execution of afterFeature in Jenkins, neither it is part of the Cucumber report for me to do further analysis.

1 Answers
Related