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

TeamCity ImportDotCoverCoverage tests fail when running on TeamCity #766

Closed
devlead opened this issue Mar 17, 2016 · 3 comments · Fixed by #767
Closed

TeamCity ImportDotCoverCoverage tests fail when running on TeamCity #766

devlead opened this issue Mar 17, 2016 · 3 comments · Fixed by #767
Assignees
Milestone

Comments

@devlead
Copy link
Member

devlead commented Mar 17, 2016

TeamCityProvider WriteServiceMessage works directly with the Console, this isn't very "mockable", because this the TheImportDotCoverCoverageMethod hi-jacks the console stream.

This works an all build systems except TeamCity were these service messages have a meaning.

I'll shorty submit a PR with a suggested fix for this.

devlead added a commit to devlead/cake that referenced this issue Mar 17, 2016
This fixes cake-build#766 by not using System.Console directly and instead using ICakeLog and mock that during tests.
* Change TeamCityProvider WriteServiceMessage to use ICakeLog instead of System.Console
* Change TeamCityProviderTests to not change System.Console stream so TeamCityFixture instead has a FakeLog/ICakeLog instance
* Add AggregateLogMessages method to FakeLog to get all current log entries message as a string
@devlead devlead self-assigned this Mar 17, 2016
@bjorkstromm
Copy link
Member

@devlead Hmm, why is it failing on TeamCity? I mean TheImportDotCoverCoverageMethod resets the console stream on dispose?

A solution with a "mockable" output for WriteServiceMessage sounds like a less "hacky" solution though.

@devlead
Copy link
Member Author

devlead commented Mar 17, 2016

@mholo65 It fails because XUnit is TeamCity aware and does a little magic so test is already within a service message basically.

@bjorkstromm
Copy link
Member

..of course, and since Console is static, we're hijacking all output.

devlead added a commit to devlead/cake that referenced this issue Mar 17, 2016
This fixes cake-build#766 by not using System.Console directly and instead using ICakeLog and mock that during tests.
* Change TeamCityProvider WriteServiceMessage to use ICakeLog instead of System.Console
* Change TeamCityProviderTests to not change System.Console stream so TeamCityFixture instead has a FakeLog/ICakeLog instance
* Add AggregateLogMessages method to FakeLog to get all current log entries message as a string
devlead added a commit to devlead/cake that referenced this issue Mar 18, 2016
This fixes cake-build#766 by not using System.Console directly and instead using ICakeLog and mock that during tests.
* Change TeamCityProvider WriteServiceMessage to use ICakeLog instead of System.Console
* Change TeamCityProviderTests to not change System.Console stream so TeamCityFixture instead has a FakeLog/ICakeLog instance
* Add AggregateLogMessages method to FakeLog to get all current log entries message as a string
devlead added a commit to devlead/cake that referenced this issue Mar 18, 2016
This fixes cake-build#766 by not using System.Console directly and instead using ICakeLog and mock that during tests.
* Change TeamCityProvider WriteServiceMessage to use ICakeLog instead of System.Console
* Change TeamCityProviderTests to not change System.Console stream so TeamCityFixture instead has a FakeLog/ICakeLog instance
* Add AggregateLogMessages method to FakeLog to get all current log entries message as a string
@gep13 gep13 added this to the v0.11.0 milestone Mar 18, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants