karatelabs / karate

Test Automation Made Simple
https://karatelabs.github.io/karate
MIT License
8.09k stars 1.94k forks source link

introduce beforeScenario hook #2239

Open ptrthomas opened 1 year ago

ptrthomas commented 1 year ago

at the very least for mocks, to complement the already existing configure afterScenario option: https://github.com/karatelabs/karate/tree/master/karate-netty#configure-afterscenario

this is needed because the Background in mocks is only "one time": https://github.com/karatelabs/karate/tree/master/karate-netty#background

teams will be able to do advanced request validation with mocks

note that the new JS mocks gives you this flexibility: https://github.com/karatelabs/karate/wiki/Karate-JavaScript-Mocks

but some teams prefer the simpler karate-style mocks

ericdriggs commented 1 year ago

You read my mind! Was just about to open this issue. This would allow me to use a global coinfig to log scenario names before execution. Especially useful for when scenarios are timing out.

ptrthomas commented 1 year ago

@ericdriggs cool. do note that this should be already possible via the ExecutionHook: https://github.com/karatelabs/karate/wiki/1.0-upgrade-guide#hooks