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

Use multiple formatters in the same test run #346

Closed
lonnblad opened this issue Oct 9, 2020 · 9 comments · Fixed by #392
Closed

Use multiple formatters in the same test run #346

lonnblad opened this issue Oct 9, 2020 · 9 comments · Fixed by #392
Labels
⚡ enhancement Request for new functionality
Milestone

Comments

@lonnblad
Copy link
Member

lonnblad commented Oct 9, 2020

Is your feature request related to a problem? Please describe.
When running the JUnit and Cucumber formatters, I don't get any feedback.

Describe the solution you'd like
To be able to use multiple formatters so that I can run the Progress formatter next to JUnit/Cucumber.

Describe alternatives you've considered

Additional context

@lonnblad lonnblad added the ⚡ enhancement Request for new functionality label Oct 9, 2020
@jesusnoseq
Copy link

Hi,
Is there anyone working on this feature?
I would like to propose a solution

@lonnblad
Copy link
Member Author

Hi @jesusnoseq, I don't think anyone is working on it, so feel free! 😊

@lonnblad
Copy link
Member Author

the idea was to have the CLI looking something like this:

godog run \
 --format progress \
 --format junit:report.xml \
 --concurrency 10 \
 features

@jesusnoseq
Copy link

jesusnoseq commented Jan 23, 2021

Ok!
This what I plan to do

Modify runWithOptions function

  • Parse command
    • --format junit:report.xml,cucumber:report.json,progress
  • Refactor formatter finder and creation
  • Handle output creation
  • Validation foar multiple formatters
    • Disallow repetition of output.
    • Allow formatter repetition?
    • Any other validation to take into account?
  • Handle errors file.close()
  • Make printStepDefinitions always use os.Stdout
  • Add test
    • Test_MultiFormatOutputRun and Test_MultiFormatOutputRunError
    • Parse format option with multiple formats

Create a new Formatter that wraps others

type MultiFormatter{
  fmts []Formatter
}
  • Implement Formatter interface
  • It will not be registered in the available formatter list
  • Add simpler test than the other formatters

Add doc

  • Example of how to launch godog with multiple output formats
  • Update changelog with the changes made

My intention is to make as few changes as possible that is why I have come up with
--format junit:report.xml,cucumber:report.json
Instead of
--format junit:report.xml --format cucumber:report.json

@lonnblad
Copy link
Member Author

I'm good with using comma separation and MultiFormatter sounds like a good idea!

My opinion is to allow formatter repition, even though I don't see a real use case for it, but I feel like we can leave that to be up to the user.

I also think that we should disallow repition of output and remember to check stdout there as well.

Thanks!!

@lonnblad lonnblad added this to the v0.12.0 milestone Jan 23, 2021
@mdelapenya
Copy link

mdelapenya commented Feb 10, 2021

An use case could be on CI: I want to populate jUnit's XML format so that jenkins displays tests results AND cucumber's JSON format to also display scenarios with this rich UI: https://plugins.jenkins.io/cucumber-reports/

@lonnblad
Copy link
Member Author

lonnblad commented Mar 7, 2021

Hi @jesusnoseq, did you have a chance to look more at this issue? :)

@vearutop
Copy link
Member

I've created a PR based on ideas discussed in this issue, please check if it is sufficient. It implements support for --format junit:report.xml,cucumber:report.json flag format.

With few more changes I think --format junit:report.xml --format cucumber:report.json can also be supported, please let me know if it is important.

@bahlo
Copy link

bahlo commented May 31, 2021

Awesome, can‘t wait to use this @vearutop!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
⚡ enhancement Request for new functionality
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants