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

multiple output options #700

Open
hutchic opened this issue Sep 2, 2022 · 7 comments
Open

multiple output options #700

hutchic opened this issue Sep 2, 2022 · 7 comments

Comments

@hutchic
Copy link

hutchic commented Sep 2, 2022

I want htest output for humans -- to the terminal
junit output for computers -- to a file for consumption elsewhere

@alerque
Copy link
Member

alerque commented Sep 2, 2022

What exactly is the request here? For an htest output driver? Or did you mean gtest there? Or is the request for simultaneous output to two drivers from one test run?

@Tieske
Copy link
Member

Tieske commented Sep 2, 2022

htest is an external output library (is on luarocks). So for this request it would be the same as gtest.

The idea is to use two outputs in parallel. To terminal for human consumption, to file for passing results on to a report system or similar

@Tieske
Copy link
Member

Tieske commented Sep 2, 2022

Passing the events shouldn’t be too hard I think. But how to configure what goes where?

@alerque
Copy link
Member

alerque commented Sep 2, 2022

For my use cases the longest running test suite I have with ~500 test units takes a very limited time to run (a few seconds) so I am content running multiple instances of busted for each purpose. Hence I'll be unlikely to work on this directly.

But I'd be happy to facilitate a PR if somebody wants to work on it and contribute a way to do this. In my view it would have to not break existing CLI usage and busted files for people using only one output handler, but within that requirement find some ergonomic way to set it up.

@hutchic
Copy link
Author

hutchic commented Sep 8, 2022

So the test suite I have is not fast 😂

Which is why I'd like one output format for humans (htest) and a different output format (junit) to a file for computer consumption

@alerque
Copy link
Member

alerque commented Sep 8, 2022

Besides speed it would have the added benefit of CI usage being able to show something to the user in logs but also provide a download artifact with more detailed reports in a more usable format. Even if jobs are fast and for occasional manual trigger it would be tolerable, running everything twice on every invocation by default does get excessive if the output could be captured and handled two ways at once.

@myzhan
Copy link
Contributor

myzhan commented Dec 27, 2023

I manage to do this by specify a custom output handler, which combines two output handlers from busted.

return function(options)
    local utfTerminalHandler = require('busted.outputHandlers.utfTerminal')(options)
    utfTerminalHandler:subscribe(options)

    table.insert(options.arguments, 1, "junit.xml")
    local junitHandler = require('busted.outputHandlers.junit')(options)
    junitHandler:subscribe(options)

    return utfTerminalHandler
end

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

No branches or pull requests

4 participants