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
Include the output $stderr and $stdout in JUnit formatted XML #259
Conversation
I think this is great. Nice specs, easy to read code. |
I'm not aware of any way to know what global pipe was passed in originally (being a reference and all), so I've cleaned up as best I could. In the case of |
Nice! How about just taking a symbol to represent which global pipe it should wrap, then doing the interception in that method: @wrappedstderr = Interceptor::Pipe.wrap(:stderr) WDYT? It would keep the formatter itself cleaner, even if the interceptor has to get a little bit more ugly. |
How symmetrical should the Should Interceptor::Pipe.unwrap!(@wrappedstderr) |
…<system-err/> tags
…y intercepting writes to pipes This will ultimately be used to consume $stderr and $stdout for formatters
… return the original
Per @mattwynne's feedback, wrapping can now be done with: Interceptor::Pipe.wrap :stdout Interceptor::Pipe.unwrap! :stdout Both methods will return the Interceptor::Pipe object such that the consumer can then inspect the interceptor's buffer.
I hope this finally meets your satisfaction :) 🍰 |
Thanks! I'll take a look shortly. |
Beautiful! |
Include the output $stderr and $stdout in JUnit formatted XML
So does this feature actually work? I'm running Cucumber 1.2.0 on Linux and don't seem to get anything to "system-err" or "system-out". I tried adding a
line to |
@penberg is correct, it looks like I overlooked the fact that "puts" inside of a step-definition is something else that doesn't seem to print to stdout/stderr at all. A raw: $stdout.write("HELLO!\n") in a step-definition will be placed in the right XML tags though. Guess this isn't over just yet ;) |
Ah I forgot. This is a feature which @aslakhellesoy implemented a while back. We used to call this method What do you guys think would be the least surprising behaviour to implement here? |
It does take me a little by surprise that What this means is that It is a little bonkers IMHO. |
So @penberg can you try using @rtyler now you know the lay of the land, what do you think it should do? Maybe we should start using the pipe interceptor everywhere and push all stdout / stderror output to the formatters as events? That way we'd still get the current behaviour ( |
FWIW, Anything you're up for @mattwynne I can take a crack at if you want to file an issue, I'm still sufficiently fresh to Cucumber's codebase that I'm not comfortable making these kinds of decisions just yet. |
@rtyler $stderr.write() indeed works just fine. Thanks! |
I can't get my head around it. Let's leave it until it pops back up. |
Hello. Its possible to print stdout/stderr into tag, now all stdout writes to level and Jenkins doesn't print output in test results? My workaround, maybe it will be useful for somebody:
|
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
This is useful for Jenkins users who might have valuable information getting pumped into
$stderr
or$stdout
..In my case, I need to put data into the
<system-out/>
for some plugin integration in Jenkins, but I can see it useful for the general case.I tried to make the
Interceptor::Pipe
class as re-usable as possible, but also low impact. This is my first pull request, so be gentle :)Willing to accept free BDD coaching if @mattwynee is up for it ;)