In summary, I have 2 tests declared in a test suite as below however the testng runner executes the beforesuite method of the last test always. This results in the test reports shows there are 3 tests executed which is not expected. By trailing the code, I found the privateRun() overrides the beforesuite method for the last test because it iterates itselft for the 2 testRunners.
Please advise how I can run the beforesuite always for the first test instance, not the last one of the suite.
Here is the test structure.
Test.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="suiteA">
<test name="T1">
<classes>
<class name="C1"/>
<class name="C2"/>
</classes>
</test>
<test name="T2">
<classes>
<class name="C3"/>
<class name="C4"/>
</classes>
</test>
</suite>
Test Run
Suite A
T2 *(this doesn't run any tests other than Beforesuite)*
>T1
>T2