Untill now I had written page specific tests which just focused on page specific scenarios. Ex: LoginPageTest.java contains tests that test scenarios related only to Login Page. 

Now that I have automated a few more pages, I want to integrate all these pages in my `testng.xml`

Problem is - Assume that I want to test 3 test classes ( LoginPageTest.java, ExercisePageTest.java & HomePageTest.java ) & I have passed these class names in `testng.xml` file. What's happening when I run the `testng.xml` file is 3 browser instances are opening together because in each of my test class I have a `@BeforeClass` method which initializes the browser.

In all my test classes I'm following the same procedure as below-

-- In `@BeforeClass` method I'm initializing browser.

```
@BeforeClass
    public void setUp() throws Exception {

        wte = new ReadWriteExcel();
        extent = new ExtentReports("D://myfitnesspal.html", true);
        extent.addSystemInfo("Environment", "Test Environment");
        test = extent.startTest("Login Functionality");
        driver = BrowserSettings.startBrowser("chrome","https://www.myfitnesspal.com");
        engineDriver=new EngineDriver(driver);
        test.log(LogStatus.PASS, "Executing on Firefox browser");

    }

```

--In `@Test` method I'm reading the EmailID & Password of the guest from an excel sheet & logging into the application.

```
@Test(priority=0, groups={"regression"})
    //@Test(dependsOnMethods="setUp")
    public void existingUserLoginfromLandingPage() throws Exception{

        new WebDriverWait(driver,10).until(ExpectedConditions.titleContains("Free Calorie Counter, Diet & Exercise Journal"));
        test.log(LogStatus.INFO, "Title Detected : " + "Free Calorie Counter, Diet & Exercise Journal" );
        String emailIDFromExcel = ReadWriteExcel.fecthEmailID(0);
        String passwordFromExcel = ReadWriteExcel.fecthPassword(1);
        engineDriver.landingPage.existingUserLogin(emailIDFromExcel, passwordFromExcel);
        System.out.println("EmailID & Password are :" + emailIDFromExcel+passwordFromExcel);

    }

```

Similarly, I have other `@Test` methods which test page related scenarios. 

What I want to achieve is this -

Instead of opening the browser 3 times, I want the browser to run once & once the LoginPageTest.java has completed I want to execute the other test classes without the need of a new browser instance opening up & without a new user being logged in.

Example: I want my `testng.xml` file to look like this- 

```
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Suite">
    <test name="Test">
        <parameter name="typeOfCardio" value="Swimming" />
        <parameter name="typeOfStrengthExercise" value="Bench Press" />
        <classes>
            <class name="com.myfitnesspal.tests.LoginPageTest"/>
            <class name="com.myfitnesspal.tests.ExercisePageTest"/>
            <class name="com.myfitnesspal.tests.HomePageTest" />
        </classes>
    </test> <!-- Test -->
</suite> <!-- Suite -->

```