-
Notifications
You must be signed in to change notification settings - Fork 40
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
[FEATURE]: Improve xUnit Logging capabilities #271
Comments
I'm a bit hesitant to give What if we added a public setter to public class DatabaseFixture : IDisposable
{
public DatabaseFixture()
{
MyXunitLogger = new XunitLogger(null);
MyActor = new Actor("Pantz", MyXunitLogger);
MyActor.Can(ConnectToDatabase.Using(connection);
}
public Actor MyActor { get; private set; }
public Actor MyXunitLogger { get; private set; }
} Then, you could change the (I presume the fixture would run once per test and would be thread safe.) |
Also found this thread: xunit/xunit#565 (comment) People have been complaining about MessageSink for this exact use case... |
I think I like your suggestion of making the database connection in the fixture and creating the Actor in the test. Creating one Actor per test helps preserve test case independence. |
Description
I've run into a problem using Boa with xUnit. Because of the way that xUnit manages shared context between test classes....
xUnit injects
ITestOutputHelper
into the test class constructor. Which I provide to BoasXUnitLogger
like soThis works fine until I want to create a test fixture to share context across multiple test classes.
It's impossible to instantiate an actor with the logger in the fixture since xUnit does not provide the output helper here. I believe the reason is because of the way xUnit handles parallel execution, the output helper keeps track of the currently executing test
I think need some way to add the logger after the actor has been initialized... from what I can tell this is not currently possible since
actor.Logger
doesn't have a public setterCan we make the property public?
Alternatives
Anything else?
No response
Commitments
The text was updated successfully, but these errors were encountered: