TestNG : I want to login only once,execute all the testcases ,logout of the application and then should close the browser
<p>I am implementing hybrid framework i am posting the code below</p>

<pre><code>public class BaseClass {

    public WebDriver driver;

    @BeforeTest
    @Parameters({"browser","component"})
    public void launchBrowser(String browser,String component) throws Exception{

        if(browser.equals("firefox")){

            driver = new FirefoxDriver();
            driver.manage().window().maximize();
            driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
            BasePage basePageObject = new BasePage(driver);

            if(null!=component) {

                if(component.equals("Operations")){

                    driver.get(propertyDataObj.getOdUrl());
                    System.out.println("odusername---"+propertyDataObj.getOdUserName());
                    System.out.println("odpassword---"+propertyDataObj.getOdPassword());
                    basePageObject.loginToOd(odUserName, odPassword);

                }
</code></pre>

<p>In the above code I have used <code>@BeforeTest</code> in-order to login to the application only once but when I run the framework, only first testcase gets executed and I am getting no such window found exception and the execution is getting terminated.</p>