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

Feature: xunit/junit output #50

Closed
AidaPaul opened this issue May 17, 2020 · 18 comments · Fixed by #147
Closed

Feature: xunit/junit output #50

AidaPaul opened this issue May 17, 2020 · 18 comments · Fixed by #147
Assignees
Labels
enhancement Improvement of existing features or bugfix
Milestone

Comments

@AidaPaul
Copy link
Contributor

I believe that adding j/xunit output support would go a long way to streamlining the tests, as those are the formats supported by IDE's and CI tools, so it would make cucumber-rust fit in like a glove with how devs work right now, rather than relying on reading the text output.

I will probably give it a whack myself, as it's of high interest to me, but certainly, welcome any pointers and suggestions!

@bbqsrc
Copy link
Member

bbqsrc commented May 17, 2020

@Puciek let me finish with the feature/async branch as that will fundamentally change the API for printing output.

I'll ping you once that's done, implementing your choice of output should then be much easier. 😄

@AidaPaul
Copy link
Contributor Author

@bbqsrc oh, aces, will do! Got any sort of ETA? Just so I can plan accordingly :)

@bbqsrc
Copy link
Member

bbqsrc commented May 17, 2020

Yeah, within a week or so. There's no longer an output trait but instead an event handler callback function, so you basically only need to have a function that takes a single CucumberEvent type and you can structure your output handler however you need to.

I don't anticipate those events changing very much, so I'd be quite happy for you to have at least a look at the branch as it currently stands as the more feedback the better, imho. 😄

@AidaPaul
Copy link
Contributor Author

I'll dig in! Thanks!

@bbqsrc
Copy link
Member

bbqsrc commented May 22, 2020

Hey @Puciek, just checking in. Have you made any progress? Hit any roadblocks? I'd welcome the feedback.

Also if you have any documentation about the xunit or junit output formats, I'd appreciate some links. I'm not really able to find anything so far and it's frustrating me haha

@AidaPaul
Copy link
Contributor Author

@bbqsrc I will have an update for you over the weekend (this one), as I was hopelessly stuck this week, sudden surge of unexpected work :)

As for docs, xunit: https://xunit.net/docs/format-xml-v2
junit: https://llg.cubic.org/docs/junit/

There are very common across loads of technology, very much the standard for test reporting (and integrated into majority of IDEs as a result).

@bbqsrc
Copy link
Member

bbqsrc commented May 23, 2020

@Puciek no problem 😄

On the branch feature/async-output, I've begun re-implementing the default output printer from the master branch using the new events. I have changed the callback to be a trait with one function so one can hold state in an object (which is going to be useful quite a bit, I suspect moreso if writing XML).

Ping me if you get stuck, I'll be around.

@bbqsrc
Copy link
Member

bbqsrc commented May 23, 2020

And now I've merged those output changes into feature/async. The logical place to put your xunit or junit output formats is in src/output and re-export the things from inside it. There's now a function on Cucumber called with_handler, which is the entry point for using another handler such as yours.

@AidaPaul
Copy link
Contributor Author

@bbqsrc I finally got the ball rolling with it, and gotta say I love the new format you've setup for output handling, makes is a breeze (once you figure it out ha!). I should have a draft PR ready by end of this week with it, depending just how busy the last few days will be at work.

@bbqsrc
Copy link
Member

bbqsrc commented May 27, 2020

@Puciek wonderful! thanks!

AidaPaul added a commit to AidaPaul/cucumber-rust that referenced this issue May 27, 2020
AidaPaul added a commit to AidaPaul/cucumber-rust that referenced this issue May 28, 2020
@bbqsrc
Copy link
Member

bbqsrc commented Jul 6, 2020

Hey @Puciek, just checking in! Things still progressing?

@AidaPaul
Copy link
Contributor Author

AidaPaul commented Jul 6, 2020

@bbqsrc Yep, just mostly work is going on in the underlying library. Should be able to wrap this up soon™

@bbqsrc
Copy link
Member

bbqsrc commented Jul 6, 2020

I look forward to reviewing your PR soon™, 😄

@bbqsrc bbqsrc added the enhancement Improvement of existing features or bugfix label Jul 21, 2020
@bbqsrc
Copy link
Member

bbqsrc commented Sep 7, 2020

@Puciek 0.7.0 has been published now. 🎆

@AidaPaul
Copy link
Contributor Author

AidaPaul commented Sep 9, 2020

@bbqsrc Time bloody flies doesn't it? In last month i literally only had one hour to do OS stuff :/. But I've set time for this weekend and will bloody finish this, as it's embarrassing, and I apologize that this went from making headway to being dead, even more so that I still need it myself hah!

@bbqsrc
Copy link
Member

bbqsrc commented Sep 9, 2020

No problem, took me long enough to get the develop branch merged back into master as it is. 😄

Take your time and don't burn out, it's a voluntary effort.

@johnoneil
Copy link

I'm very interested in this feature or something similar.

As it stands, integration tests which use cucumber-rust must implement their own output formatter? How would this be done?

Perhaps, use with_handler to add event handlers, and append to a file when they're invoked? Traversing the CucumberEvent to get the feature and test results?

If there's anything you can point me to that shows this I'd appreciate it. Would think that adding a formatter for the Cucumber json output format would be what I'd try.

@VexedPanda
Copy link

It looks like @Puciek started on this at https://github.com/Puciek/cucumber-rust/commits/feature/junit-output so that may be a good starting place

@tyranron tyranron added this to the 0.11 milestone Sep 28, 2021
tyranron added a commit that referenced this issue Nov 9, 2021
- impl `writer::JUnit` behind `output-junit` Cargo feature
- make `writer::Basic` generic over `io::Write` implementor

Co-authored-by: Kai Ren <tyranron@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improvement of existing features or bugfix
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants