Karate Runner with ExecutionHook listener

喜欢而已 提交于 2020-05-16 22:38:48

问题


@Peter - As per your suggestion from my previous queries, I have used ExecutionHooks to implement ReportPortal. I am finding difficulties in passing all the required values from my Runner to Base Runner. Below is my configuration-

BaseRunner.java
Results results = Runner.parallel(tags,path,ScenarioName,Collections.singletonList(new 
ScenarioReporter()),threads,karateOutputPath);

Runner.java
@KarateOptions(tags = { "@Shakedown" },
features = "classpath:tests/Shakedown"
 )

I want to understand how can I pass the attributes like Scenario Name, path and tags. ScenarioReporter() is my class where I have implemented Execution Hook. I have a base runner that will have all the details and a normal runner that will have minimal information. I have just given snippets, please don't mind if there are some syntactical errors.


回答1:


You don't need the annotations any more, and you can set all parameters including tags using the new "builder" (fluent interface) on the Runner. Refer the docs: https://github.com/intuit/karate#parallel-execution

Results results = Runner.path("classpath:some/package").tags("~@ignore").parallel(5);

So it should be easier to inherit from base classes etc. just figure out a way to pass a List<String> of tags and use it.

Just watch out for this bug, fixed in 0.9.6.RC1: https://github.com/intuit/karate/issues/1061



来源:https://stackoverflow.com/questions/60923099/karate-runner-with-executionhook-listener

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!