Highlighted
Super Contributor.
Super Contributor.
310 views

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">
    <listeners>
        <listener class-name="utils.TestNGListener"></listener>
    </listeners>

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

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();

 

0 Likes
1 Reply
Highlighted
Respected Contributor.
Respected Contributor.

Re: Leanft to execute TestNG test cases without closing browser

Hi,

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:

-https://admhelp.microfocus.com/leanft/en/14.03/HelpCenter/Content/CodeSamples_Java/codeex_Parallel.htm

Regards,

Francisco Jimenez

 

 

 

0 Likes
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.