0 votes
1 view
in Devops and Agile by (19.8k points)

I would like to build an NUnit project for selenium UI automation. I would like to sign in to the site before running all tests (all of them) and to close the browser after running all tests (all of them).

I can't use the SetUp since it related to fixtures and I want to do it before and after everything.

Do you know who to execute it?


I'm familiar with the SetUp and TearDown attribute. Let me explain it again.

I need some logic to be executed before all tests from all fixtures start (AKA - First test in the entire assembly) and also some logic to be executed after all tests from all fixtures ended (AKA - Last test in the entire assembly).

1 Answer

0 votes
by (63.4k points)

Before executing each test case, the [SetUp] section will be executed

After completing the execution of each test case, the [TearDown] section will be executed.

If we want to initialize variables we often write it in the [SetUp] section like a constructor

If we want to dispose of any object we often write it in the [TearDown] section

    [SetUp]

    protected void SetUp()

    {

             //initialize objects

    }

    [TearDown]

    public void TearDown()

    {

       //dispose objects

    }

Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...