How to deal with resettlement accidents

I am currently automating tests with RC Selenium that run every hour. Everything works smoothly in most cases, but there are times when either firefox will crash or RC selenium will simply hang, and because of these two problems, testing does not continue and stops. Does anyone know how I can make firefox.exe and java.exe (an instance of selenium) be killed when they crash or freeze, so testing can resume. The problems that I see are automatically detected when firefox or selenium hangs and kills it with a script automatically.

thanks!

+6
firefox process selenium kill selenium-rc
source share
2 answers

Ideally, each of your tests will start with a clean state, without any existing Firefox or IE processes. In the test tearDown () methods, you must close / exit the browser. Even with this approach, wandering processes can sometimes occur. If you use a Selenium server on Windows using Java RC, this command in the startUp () method can guarantee that browsers / instances will not be executed:

Runtime.getRuntime().exec("TASKKILL /F /IM Firefox.exe"); Runtime.getRuntime().exec("TASKKILL /F /IM iexplore.exe"); 

Regarding crash detection, Firefox displays a crash warning dialog box. You can programmatically interact with this window using external tools such as AutoIT, which can automatically click the OK button in this dialog box if you need to. I found that creating an external AutoIT script that constantly runs in the background to handle pop-ups, crashes, warnings, etc., is very useful.

+2
source share

Not sure if I have a definitive answer for you, but I can offer some ideas:

  • Selenium will have a timeout to fight Firefox freeze. You must double check the installation and operation.
  • In any case, your selenium (for example, cruise control or the city of the team) should also have a timeout that can kill the selenium server.
  • People often return to reboot their servers once a day and report positive results. (Not me)
  • I would really like you to understand the reason for this. Selenium may feel disappointing and flaky, but after digging around, I always found that it was a diagnostic problem that could be fixed (like this ).

(Se pushes us to terrible extremes: we actually wrote an ssh task running in TeamCity that logged into Windows and restarted the selenium server there. Ultimately, we did not use it.)

+1
source share

All Articles