I’d like to kill the Firefox instances on the build server when all Selenium tests finished. The build.gradle file looks as follows (extract):
task stopFirefox(type: Exec) {
commandLine "/usr/bin/killall", "-9", "firefox"
}
task seleniumTest(type: Test) {
maxParallelForks = 8
}
seleniumTest.finalizedBy stopFirefox
When is the task “stopFirefox” executed? a) After all 8 parallel running “Gradle Task Executors” terminated? b) When the first of the 8 “Gradle Task Executors” terminates?
I expect a) but suspect b). See the console log below:
com......MasterModeWebtest > testReplace PASSED
Gradle Test Executor 3 finished executing tests.
com.....EmployeeWebtest > testCheckbox FAILED
org.openqa.selenium.remote.UnreachableBrowserException: Error communicating with the remote browser. It may have died.
Build info: version: 'unknown', revision: 'unknown', time: 'unknown'
System info: host: 'zhbappsp-ci1.it', ip: '127.0.0.1', os.name: 'Linux', os.arch: 'amd64', os.version: '2.6.32-431.el6.x86_64', java.version: '1.7.0_55'
Driver info: driver.version: RemoteWebDriver
Caused by:
org.apache.http.conn.HttpHostConnectException: Connect to localhost:7062 [localhost/127.0.0.1] failed: Connection refused
Gradle is started in parallel mode.