Skip to content
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

docs: Describe Formatter API #980

Open
jenisys opened this issue Dec 7, 2021 · 2 comments
Open

docs: Describe Formatter API #980

jenisys opened this issue Dec 7, 2021 · 2 comments

Comments

@jenisys
Copy link
Member

jenisys commented Dec 7, 2021

The Formatter API should be described/documented in more detail.

MENTIONED BY @janoskut in #412:

Could someone elaborate where that "Formatter API" is documented? All I find is
https://behave.readthedocs.io/en/stable/formatters.html

UNTIL DOCUMENTED:
Inspect the behave.formatter.base:Formatter class documentation and the various Formatter implementations under behave.formatter.

SEE ALSO:

@DingLin23
Copy link

I am looking to this open issue.

@bittner
Copy link
Member

bittner commented Sep 21, 2023

For anyone interested in diving into implementing a Formatter, I'd suggest to take a look at behave-html-formatter, which is a rather minimal but complete example (for a standalone formatter). The gist of it is:

from behave.formatter.base import Formatter

class MyCustomFormatter(Formatter):

    name = ...
    description = ...

    def __init__(self, stream, config):
        ...

    def feature(self, feature):
        ...

    def background(self, background):
        ...

    def scenario(self, scenario):
        ...

    def scenario_outline(self, outline):
        ...

    def step(self, step):
        ...

I guess what the class members are designed for is somewhat self-explanatory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants