JDeveloper not terminating the process
In the past, while running certain BDD test from jDeveloper, I was unable to stop the jUnit test runner. No matter what I tried, the process wouldn’t terminate.
The only way I was able to get around it was to actually close jDeveloper down, then kill the process by clicking Yes on the Do you want to terminate this process? dialog.
Kill the browser instance
A coworker (Chris Aquirre) reminded me that this actually made sense, because when running a Selenium test, another process is kicked off on the machine for the browser; in my case, IEDriverServer.exe. To resolve you need to kill that process first, and only then can you terminate the test in jDeveloper.
Simple fix – use TaskKill
By creating a bat file with the following command, we were able to kill the running IEDriverServer.exe process:
@echo off TASKKILL /IM IEDriverServer.exe /f exit
Those of you who don’t know, TaskKill is used to end one (or more) task or process using its ID or image name.
Integrate with jDeveloper
This is all fine and good, but being lazy, I didn’t want to have to go to my desktop and double click on the .bat file and stop button in jDeveloper every time I wanted to stop my BDD early.
As is turns out, a better method is to call the bat from jDeveloper. The work around I came up with is to create an External Tool option that calls the batch file in jDeveloper from the main toolbar menu.
This way, I can do everything from within jDeveloper.
Create a custom menu item in jDeveloper
To create an External Tool in your main jDeveloper menu area:
- Click on Tools>External Tools.
- In the External Tools dialog, click on New button.
- Select External Program from the Create External Tool dialog and click Next.
- In the Program Options section, select the path to where you have your .bat file and click Next.
- In the Display section, enter a caption for your menu item and a location for the icon you wish to use.
Set your options in the Integration screen. (I want mine to appear on the main toolbar for easy access.)
- Click Finish.
- You should now have a custom button that calls up your bat file on your jDeveloper main tool bar area.
Now, when I run a BDD feature file on my machine and I need to stop it early, all I need to do is click my kill_webDrivers button then click on the jDeveloper stop button. It’s much faster and cleaner than having to close down jDeveloper each and every time.
Did this help anyone?
This all might be a little too obscure for most “normal” people, but for the poor souls that are stuck using BDD/Selenium with jDeveloper, this will hopefully be a big time saver. I figure if it helps even one other person, this post was a success. Cheers!