Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Add a section on custom reporters. #1225

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

Merged
merged 1 commit into from
Sep 9, 2022

Conversation

kukimik
Copy link
Contributor

@kukimik kukimik commented Aug 15, 2022

Custom reporters are mentioned in a few places in the docs. Also, README.md lists "plugin architecture for reporters and matchers" as one of the key features. But there is no section in the docs that actually describes how to add a custom reporter. I believe that this short description of the process may be useful (it would be useful for me).

Sorry - I didn't have time to build the website and check if it looks ok, but I don't see why it wouldn't. (I've had a revolution in my family life in the last few months, and now I hardly have time for anything)

I decided not to describe the necessary grants when the custom reporter is created outside of the UT3 schema. I state that this is not recommended, If someone wants to follow this path, let them do it at their own risk. Also, I'm not able to check it in different DB versions.

# Custom reporters

It is possible to add your own reporters by creating an appropriate object type. In principle, it has to be a subtype of `ut_reporter_base`. However, in most cases, it is more convenient to create the custom reporter type under a more specialized type, like `ut_documentation_reporter` or `ut_junit_reporter`, and override just some of the functionality.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to distinguish between ut_reporter_base which is a foundation for any reporter and
ut_output_reporter_base which should be used as a base for reporter that is expected to produce output consumable by client (screen/file) outside of database.

Currently, all reporters in utPLSQL framework provide outputs to customer

If however you would like to create a reporter that saves data to a DB table for example, you should use ut_reporter_base

utPLSQL will behave differently based on what type they are build on.

For reporters built on ut_output_reporter_base utPLSQL will consume output of the reporter and put it to screen before finishing the ut.run() call. For reporters not based on that type, output will not be consumed.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could build a reporter based on ut_console_reporter_base if you would like to produce a text output from reporter in different colors

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good points, thanks for the review. I'll improve the paragraph as suggested. I hope to do it over the weekend, but can't promise anything. I'm also going to mention where the core reporter types can be found in the repo.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Michał
I rally know how difficult it can be to find time & space to spend on writing some code outside of your da-to-day work. We appreciate all, even smallest contributions. They really make a difference.

Copy link
Contributor Author

@kukimik kukimik Aug 23, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jgebal I force-pushed an updated version. I wasn't 100% sure what you meant by "For reporters built on ut_output_reporter_base utPLSQL will consume output of the reporter and put it to screen before finishing the ut.run() call. For reporters not based on that type, output will not be consumed.", so I didn't include this remark.

@jgebal
Copy link
Member

jgebal commented Aug 16, 2022

@kukimik Thank you for contributions

@jgebal
Copy link
Member

jgebal commented Aug 18, 2022

Thank you for the contribution @kukimik

I have added a suggestion to make the doc even better.
Please have a look at it whenever you have time.

@kukimik
Copy link
Contributor Author

kukimik commented Aug 18, 2022

@jgebal I try to contribute to the open source projects that I use. For me it's both a way to get better understanding of the tool, and to say "thank you" to the authors/maintainers.

@kukimik kukimik force-pushed the docs_custom_reporters branch from 32c6fd8 to 53dc4d8 Compare August 23, 2022 19:46
@kukimik kukimik requested a review from jgebal September 9, 2022 06:54
@jgebal
Copy link
Member

jgebal commented Sep 9, 2022

Resolves #701

@jgebal jgebal merged commit ef66537 into utPLSQL:develop Sep 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants