0

Background: I have an automation framework setup for Windows Applications using WinAppDriver, TestNG and POM. As we know, for WinAppDriver we need to run the server manually before running the tests on- http://127.0.0.1:4723/.

I am trying to run and close the WinAppDriver using the @BeforeSuite and @AfterSuite annotation. The code is code:

String wadServerPath = "C:\\Program Files (x86)\\Windows Application Driver\\WinAppDriver.exe";
ProcessBuilder builder = new ProcessBuilder(wadServerPath).inheritIO();
Process process = builder.start();
.
.
.
.   

process.destroy();

I have placed my @BeforeSuite and @AfterSuite code in BaseClass.java which does all the setUp and tearDown of the driver for me.

Problem: The problem I am facing is that, this @BeforeSuite and @AfterSuite code is not being called when I run my program from the .xml file and I get the following error:

[RemoteTestNG] detected TestNG version 7.0.1
org.openqa.selenium.WebDriverException: Connection refused: connect
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: 'NTO008669', ip: '10.0.53.198', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_221'
Driver info: driver.version: WindowsDriver

I do not wish to place the before and after suite annotations in my test classes as I want to keep them separate. Any suggestions?

0 Answers0