Do we have to use fixtures in xUnit for the bUnit instance? #1723
-
Do we have to use fixtures in xUnit for the bUnit context instance? I mean is it ok to be instantiated for every test or the workload is big? |
Beta Was this translation helpful? Give feedback.
Answered by
linkdotnet
Jun 3, 2025
Replies: 1 comment 3 replies
-
I guess you mean: public class MyTest: TestContext VS: public class MyTest
{
public void Test001()
{
using var ctx = new TestContext(); ? In the context of xUnit that almost doesn't matter, because each test is, normally, a new instance anyway. So the workload is almost identical here. We recommend the first approach, but that is not always feasible or desired. And that is fine - therefore: Stick what you prefer. |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
"Heavy" is relative. It has a few handles to your components (ids) (like what was rendered and stuff). So the state is somewhat lightweight in comparison. If you wanna reduce some time - this is probably not the low hanging fruit you are looking for.