lundi 4 mai 2015

Scope of Variables in SetUpFixture

I have several files that will require access to an object, which I want initialized only once. I considered making a static variable, but I'd rather stay away from that. Here's my question along with code:

[SetUpFixture]
public class TestSetup
{
    public IWebDriver driver;

    [SetUp]
    public void SetUp()
    {
        driver = new ChromeDriver();
    }

    [TearDown]
    public void TearDown()
    {
        driver.Dispose();
    }
}

Do my tests within the namespace of this SetUpFixture have access to driver?

EDIT: Looks like this is answered here

Aucun commentaire:

Enregistrer un commentaire