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 · 4 comments
Open

Tests need their own environment implementation #925

Ivanidzo4ka opened this issue Sep 15, 2018 · 4 comments
Labels
good first issue Good for newcomers P3 Doc bugs, questions, minor issues, etc. test related to tests up-for-grabs A good issue to fix if you are trying to contribute to the project

Comments

@Ivanidzo4ka
Copy link
Contributor

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.

@Ivanidzo4ka Ivanidzo4ka added good first issue Good for newcomers up-for-grabs A good issue to fix if you are trying to contribute to the project test related to tests Answered and removed Answered labels Sep 15, 2018
@Zruty0 Zruty0 changed the title Tests need they own environment implementation Tests need their own environment implementation Sep 15, 2018
@TomFinley
Copy link
Contributor

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

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

@Ivanidzo4ka
Copy link
Contributor Author

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 Doc bugs, questions, minor issues, etc. label Jan 10, 2020
@danpadmore
Copy link

danpadmore commented Jan 10, 2021

Is this still relevant or is it resolved/handled by #4710 ?
(just considering first timer issues, and noticed this change)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers P3 Doc bugs, questions, minor issues, etc. test related to tests up-for-grabs A good issue to fix if you are trying to contribute to the project
Projects
None yet
Development

No branches or pull requests

5 participants