Super Contributor.
Super Contributor.

Leanft to execute TestNG test cases without closing browser

I use TestNG and have several LeanFT test cases. I defined those in testng.xml.

<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >

<suite name="MyTestSuite1" verbose="2" parallel="methods" thread-count="1">
        <listener class-name="utils.TestNGListener"></listener>

    <test name="Regression" parallel="false" verbose="2">
            <class name="test.LoginTest" />
            <class name="test.ClearTest" />
            <class name="test.SendMessageTest" />

Execution starts with the first class, it is successful, but browser is closed and after execution of second class is started instead of execution on same browser window.

main() method:

TestNG testNG = new TestNG();testNG.setTestSuites(Arrays.asList("testng.xml"));testNG.setPreserveOrder(true);testNG.run();


1 Reply
Respected Contributor.
Respected Contributor.

Re: Leanft to execute TestNG test cases without closing browser


I hope that you are okay!

In order to help you with your request 

By default each time that test starts and finish , it will open and close the AUT, there is a tiny workaround for this:

Have an object that calls the AUT, so once that you have it try with the following, for example:

BrowserWindow AUT = BroswerWindow.Launch(www.google.com)

AUT.CloseOnPlaybackCleanup = false; *This is the line that will try not to close the browser

This might change on the way that you are using the action to call the browser,  but you can use .CloseOnPlaybackCleanup method to try to avoid the closing of the Browser

Note this is part of IDE itself, and it is from Visual Studio

For runing multiple tests, we can offer you the following from our side , in case that what to give it a quick view, this is just for maybe a future reference:



Francisco Jimenez




The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.