The Wayback Machine - https://web.archive.org/web/20201128041509/https://github.com/dotnet/machinelearning/issues/925
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

Tests need their own environment implementation #925

Open
Ivanidzo4ka opened this issue Sep 15, 2018 · 3 comments
Open

Tests need their own environment implementation #925

Ivanidzo4ka opened this issue Sep 15, 2018 · 3 comments

Comments

@Ivanidzo4ka
Copy link
Member

@Ivanidzo4ka Ivanidzo4ka commented Sep 15, 2018

Right now we use TlcEnvironment (or ConsoleEnvironment) which outputs everything to console.
And XUnit don't care about console, and if you want to look on output during test execution you need to do something like this:

We should have XUnitEnvironment or TestEnvironment and redirect all output to ITestOutputHelper.

@Zruty0 Zruty0 changed the title Tests need they own environment implementation Tests need their own environment implementation Sep 15, 2018
@TomFinley
Copy link
Contributor

@TomFinley TomFinley commented Sep 15, 2018

Thank you @Ivanidzo4ka .. if I agree with everything you say. To refine and make a best test, we have also spoken about having an abstract environment class capable of outputting to a user's preferred logging framework, it might be nice indeed if this thing followed that example -- if it cannot that might itself be a test that the leve of abtraction imagined is insufficient.

@aadithpm
Copy link

@aadithpm aadithpm commented Oct 15, 2018

Can I take a shot at this? What would I have to do? (If it's still an open issue)

@Ivanidzo4ka
Copy link
Member Author

@Ivanidzo4ka Ivanidzo4ka commented Oct 15, 2018

Feel free to.
Where is thing you need to be aware of. XUnit IOutputHelper (or whats the interface for outputing) doesn't support Write, it support only WriteLIne (which starts new line) and our channels can send only write messages.
Also I think we have quite a lot of tests where we capture output from console, and compare it with baseline. I would like to switch it to XUnit Environment, but it need to write to console as well.

In terms of what you need to do, you need to implement class based on IHostEnviroment interface inside TestFramework project, which would consume channel messages and propagate them to IOutputHelper.
As example I would suggest you to look on ConsoleEnvironment class and it's ConsoleWriter object

public ConsoleWriter(ConsoleEnvironment parent, TextWriter outWriter, TextWriter errWriter)
@harishsk harishsk added the P3 label Jan 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.