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.
TestNG testNG = new TestNG();testNG.setTestSuites(Arrays.asList("testng.xml"));testNG.setPreserveOrder(true);testNG.run();
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: