1

I have three feature files - preTest.feature,postTest.feature and tests.fetaure. I'm doing callonce for preTest.feature and configured afterFeature for postTest.feature in tests.feature. These two called feature files are getting executed fine but in report detailed steps aren't coming of both preTest.feature and postTest.feature files. Steps are coming only of tests.feature. How to show all steps even called feature files in Karate report?

preTest.feature

Feature: Pre test suite test cases
    Background:
        * print 'setup tasks'
    Scenario:
        Given url URL
        When method 'GET'
        Then status == 200 

    Scenario:
        Given url URL
        When method 'GET'
        Then status == 200
 

postTest.feature

Feature: Post test suite test cases
    Background:
        * print 'clean up tasks'
    Scenario:
        Given url URL
        When method 'GET'
        Then status == 200 

    Scenario:
        Given url URL
        When method 'GET'
        Then status == 200

tests.feature

Feature: Test suite test cases
    Background:
        * print 'all test cases'
        * def dataReturnedFromPreSetupTests = callonce read('classpath:preTest.feature')
        * configure afterFeature = function(){ karate.call('classpath:postTest.feature',             preSetupData); }

    Scenario:
        Given url URL
        When method 'GET'
        Then status == 200 

    Scenario:
        Given url URL
        When method 'GET'
        Then status == 200

I tried putting Gerkin keyword too for called feature files but it dint work for me. For example added below line in tests.feature -

When def dataReturnedFromPreSetupTests = callonce read('classpath:preTest.feature')
  • please see this answer: https://stackoverflow.com/a/76723165/143475 – Peter Thomas Aug 01 '23 at 11:11
  • If I add @report=true in preTest.feature and postTest.feature (called feature files) then will step details of these files come in report? – Madhu Gupta Aug 02 '23 at 06:08
  • besides what is shared in the above link - I am not sure. you can try or contribute code. I request you and your team to think: are you testing or creating reports ? which is more important :) – Peter Thomas Aug 02 '23 at 10:46

0 Answers0