Limitations of xUnit Fixtures

Following are a few of the limitations of xUnit fixtures:

  • xUnit fixtures don’t show up in -setup-show and -setup-plan. This might seem like a small thing, but when you start writing a bunch of fixtures and debugging them, you’ll love these flags.

  • There are no session scope xUnit fixtures. The largest scope is module.

  • Picking and choosing which fixtures a test needs is more difficult with xUnit fixtures. If a test is in a class that has fixtures defined, the test will use them, even if it doesn’t need to.

  • Nesting is at most three levels: module, class, and method.

  • The only way to optimize fixture usage is to create modules and classes with common fixture requirements for all the tests in them.

  • No parametrization is supported at the fixture level. You can still use parametrized tests, but xUnit fixtures cannot be parametrized.

There are enough limitations of xUnit fixtures that I strongly encourage you to forget you even saw this appendix and stick with normal pytest fixtures.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.118.20.68