<commit_before>Feature: demo karate's equivalent of before and after hooks
    note that 'afterScenario' / 'afterFeature' if set up using 'configure'
    is not supported within features invoked using the 'call' or 'callonce' keywords 

Background:
# anything here is run before every scenario (and every Example row for Scenario Outline-s)
# use the 'callonce' keyword if you want "once only" control: https://github.com/intuit/karate#callonce
# any variable here is "global" to all scenarios
* def foo = 'hello'

# for custom code to run after every scenario / feature: https://github.com/intuit/karate#configure
# note that these can be complex JS functions that you can read from separate files and re-use in multiple features
# and you can give control to another (re-usable) feature via 'karate.call' if needed

# the JSON returned from 'karate.info' has the following properties:
#   - featureDir
#   - featureFileName
#   - scenarioName
#   - scenarioType (either 'Scenario' or 'Scenario Outline')
#   - scenarioDescription
#   - errorMessage (will be not-null if the Scenario failed)

* configure afterScenario = 
"""
function(){
  var info = karate.info; 
  karate.log('after', info.scenarioType + ':', info.scenarioName);
  karate.call('after-scenario.feature', { caller: info.featureFileName });
}
"""

# for an explanation of 'karate.info' above: https://github.com/intuit/karate#the-karate-object
# note that 'karate.info' will not work within features invoked using the 'call' or 'callonce' keywords

* configure afterFeature = function(){ karate.call('after-feature.feature'); }

Scenario: first
    * print foo

Scenario: second
    * print foo

Scenario Outline:
    * print <bar>

    Examples:
    | bar     |
    | foo + 1 |
    | foo + 2 |

Scenario: 'after' hooks do not apply to called features
    # 'afterScenario' and 'afterFeature' are NOT supported in 'called' features
    * def result = call read('called.feature')<commit_msg>updated doc in example ref #630<commit_after>Feature: demo karate's equivalent of before and after hooks
    note that 'afterScenario' / 'afterFeature' if set up using 'configure'
    is not supported within features invoked using the 'call' or 'callonce' keywords 

Background:
# anything here is run before every scenario (and every Example row for Scenario Outline-s)
# use the 'callonce' keyword if you want "once only" control: https://github.com/intuit/karate#callonce
# any variable here is "global" to all scenarios
* def foo = 'hello'

# for custom code to run after every scenario / feature: https://github.com/intuit/karate#configure
# note that these can be complex JS functions that you can read from separate files and re-use in multiple features
# and you can give control to another (re-usable) feature via 'karate.call' if needed

# the JSON returned from 'karate.info' has the following properties:
#   - featureDir
#   - featureFileName
#   - scenarioName
#   - scenarioType (either 'Scenario' or 'Scenario Outline')
#   - scenarioDescription
#   - errorMessage (will be not-null if the Scenario failed)

* configure afterScenario = 
"""
function(){
  var info = karate.info; 
  karate.log('after', info.scenarioType + ':', info.scenarioName);
  karate.call('after-scenario.feature', { caller: info.featureFileName });
}
"""

# for an explanation of 'karate.info' above: https://github.com/intuit/karate#the-karate-object
# note that 'karate.info' will not work within features invoked using the 'call' or 'callonce' keywords
# one limitation of afterScenario and afterFeature is that any feature steps involved will NOT appear
# in the JSON report output and HTML reports

* configure afterFeature = function(){ karate.call('after-feature.feature'); }

Scenario: first
    * print foo

Scenario: second
    * print foo

Scenario Outline:
    * print <bar>

    Examples:
    | bar     |
    | foo + 1 |
    | foo + 2 |

Scenario: 'after' hooks do not apply to called features
    # 'afterScenario' and 'afterFeature' are NOT supported in 'called' features
    * def result = call read('called.feature')
{'fraction_non_alphanumeric': 0.097818092669772, 'fraction_numerical': 0.0017161068889433686, 'mean_word_length': 4.018450184501845, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2007070', 'n_tokens_mistral': 1167, 'n_tokens_neox': 1146, 'n_words': 457}