0

I know that when multiple tests use the same variable, it should be defined as a fixture, so that it gets initialized once, and can be re-used.

What I don't understand, however, is what advantage it offers (apart from looking cleaner) over a simple global variable, that also gets initialized once, and is accessible to all tests as well.

TylerH
  • 20,799
  • 66
  • 75
  • 101
scott_m
  • 151
  • 2
  • 11

1 Answers1

0

Fixtures are meant to avoid using global variables in the first place, they are meant to provide resources to test functions that are isolated and particular for each test.

I think that best to understand it is using the functionality "scope" that fixture provide

ozs
  • 3,051
  • 1
  • 10
  • 19