I have read many of the articles out here on this topic and have yet to find the one that resolves my issue.
Goal:
- Get test classes defined in testng.xml file to execute in order listed in the file.
- Have all methods defined within each class fire in order listed (this works)
- Only have a single browser window open at any given time (NO Parallel execution)
Each test class has an init method that initializes the browser, so I understand why I am getting n number of browser windows open right off the bat, one for each test class.
What I'd like to happen is...
Kick off Test Class A Run all methods in Test Class A Clsoe the browser via @AfterTest method in Test Class A Move on to Test Class B ...
I am hoping there is some way that I can get TestNG to do this. Also, I am kicking off the tests from maven command line using 'mvn test -Dbrowser=chrome' with the surefire plugin that calls on my defined TestNG.xml file.
Current TestNG.xml file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "https://testng.org/testng-1.0.dtd">
<suite name="Suite">
<listeners>
<listener class-name="com.infdig.qa.Listeners" />
<listener class-name="com.infdig.qa.resources.ExtentReporterNG" />
</listeners>
<test name="Regression" >
<classes>
<class name="com.infdig.qa.BasicSiteNavigationTests">
<methods>
<include name="openedToDashboard" />
<include name="navigateToActiveReleasePreset" />
<include name="navigateToReleasePresets" />
<include name="navigateToComponentSelections" />
<include name="navigateToOrderSlices" />
<include name="navigateToAbout" />
</methods>
</class>
<class name="com.infdig.qa.AboutPageTests">
<methods>
<include name="validateAboutPageDescriptionText" />
<include name="validateAboutPageLegalText" />
<include name="validateAboutPageHelpText" />
<include name="validateHelpLinkToInfinityPortal" />
</methods>
</class>
<class name="com.infdig.qa.ReleasePresetTests">
<methods>
<include name="deleteAllExistingPresets" />
<include name="createInitialPresets" />
<include name="changeActivePreset" />
<include name="addNewReleasePreset" />
<include name="deletePreset" />
<include name="addMultiplePresets" />
<include name="searchForPresetByName" />
<include name="deleteMultiplePresetsAtOnce" />
<include name="validateHelpTextIsAccurate" />
</methods>
</class>
<class name="com.infdig.qa.OrderSliceTests">
<methods>
<include name="deleteAllSlices" />
<include name="createNewOrderSlice" />
<include name="editExistingOrderSlice" />
</methods>
</class>
</classes>
</test>
</suite>