-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(Suggestion) A callback for Runner #855
Comments
@pshrm first can you explore this: https://github.com/intuit/karate/blob/master/karate-core/src/main/java/com/intuit/karate/core/ExecutionHook.java this has already evolved to become an un-documented interceptor. it may be missing feature hooks which we can add if you need them. I'd like to take time to see some examples so yes - do submit a draft PR first. |
@pshrm sorry my bad, you are already aware of |
@pshrm and I'm proposing that the I'd like to do this right and perhaps align other infra in Karate into this - so I hope you can be patient and maybe come up with some ideas in the PR |
@ptrthomas Great! thanks a lot. |
@ptrthomas I gave it an attempt on Runner builder and ExecutionHook for beforeFeature and afterFeature. |
@pshrm it will be easier to review if you follow the standard git / PR approach, but I'll try take a look later |
@ptrthomas no worries. I will send you a standard git/PR. |
@ptrthomas opened a draft PR #865. Please have a look. |
@ptrthomas looks good. I hope you will add feature hooks as well later. I've created Junit parallel runner which notifies the IDE with test results. if you wish I can send another PR. Please let me know. |
@pshrm yes, I will take care of the feature hooks. I will be happy to look at your JUnit parallel work. as you have seen I tend to do things "my way" but your work certainly helps give me ideas and push me to do the stuff needed ^_^ |
Hi @ptrthomas, here is PR for Junit Parallel runner. I just did it for Junit4 - #871. |
released 0.9.5 |
Hi Peter,
We have created a small framework on top of Karate. One of the requirement we had that we needed to send test results (reports) to a central ELK instance and reporting has to be realtime i.e., as soon as a feature is executed, result should be updated in ELK.
We achieved it by modifying the karate code. We realized this is not maintainable as upgrading karate version sometimes becomes time consuming due to our changes.
May I suggest a generic approach.
I am thinking of providing a callback interface in Runner. Something like this.
public interface RunnerCallback { void afterFeature(FeatureResult result); }
And in the Runner the parallel method can accept the implentation of this interface.
public static Results parallel(String tagSelector, List<Resource> resources, String scenarioName, Collection<ExecutionHook> hooks, int threadCount, String reportDir, RunnerCallback callback) {}
And when a feature is executed Runner would call the method afterFeatture() to give back the control back to calling method. Here we can perform another tasks i.e., sending results to ELK
// call the call back. if (callback != null) callback.afterFeature(result); latch.countDown();
What do you think about it? Please let me know. If it make sense I can send you a Pull Request.
Regards
Prashant
The text was updated successfully, but these errors were encountered: