1

I have a feature file that has both scenario and scenario outline. I am trying to integrate the karate test with Zephyr and update the test status based on the tag value. This works fine with Scenario as it has only one tag associated. But, when it comes to scenario outline as below, I am unable to fetch the correct tag for each run. Please note that, I am trying to update the test status in Zephyr in afterScenario, which will be called after each scenario.

@TestCaseKey=T123,T124,T125
Scenario Outline: Add two numbers <num1> & <num2>
    Given I have a calculator
    When I add <num1> and <num2>
    Then the result should be <total>

  Examples: 
    | num1 | num2 | total |
    | -2   | 3    | 1     |
    | 10   | 15   | 25    |
    | 99   | -99  | 0     |
`* configure afterScenario =
"""

function() {

var info = karate.info;
karate.log(info);
var tagVal = karate.tagValues.TestCaseKey;
var status = (info.errorMessage) ? 'Fail':'Pass';
karate.call ('classpath:Package/Update_Zephyr.feature', {testCaseKey:tagVal, statusName:status});

}

"""`

I would like to fetch the correct tag to run the correct scenario. for eg, for tag value T123, execute | -2 | 3| for tag value T124, execute | 10 | 15 |

Peter Thomas
  • 54,465
  • 21
  • 84
  • 248
ksl4u
  • 11
  • 1

1 Answers1

0

Could well be a limitation in afterScenario. You are welcome to contribute code to fix it, or get the help of the Zephyr team, as this is not considered the highest priority.

The approach of sending results at the end (using the consolidated Results object, or using a RuntimeHook may give you better results: https://stackoverflow.com/a/54527955/143475

If you are trying to use tags to "filter" what rows should be run, refer: https://github.com/karatelabs/karate#tags-and-examples

Peter Thomas
  • 54,465
  • 21
  • 84
  • 248