MuraliKola / robotframework-seleniumlibrary

Automatically exported from code.google.com/p/robotframework-seleniumlibrary
Apache License 2.0
1 stars 0 forks source link

Checking if selenium server is already running #224

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
How would I detect if the server is already running?

I'm trying to structure my tests so that a selenium server and browser only 
needs to be created once.

Currently my setup and teardown for each test starts selenium, opens a browser, 
logs in, runs the test, logs out, closes browser, stops selenium for every 
single test.

Some ways I could do this would be:

1. detect if the server is currently running and use existing instance

2. only call start on a server if this is the 1st test to run and only call 
stop if it's the last test

For #2 I would need a way to know how many tests are currently in queue and 
which test I'm on.

Or is there a better way to approach this ?

Thanks.

Original issue reported on code.google.com by mr.danie...@gmail.com on 9 Jan 2012 at 9:11

GoogleCodeExporter commented 8 years ago
I have also tried to run keywords that require a selenium server and browser 
instance to be open using the `run keyword and ignore error` style wrappers but 
they don't trap exceptions so entire suite fails at that point.

Original comment by mr.danie...@gmail.com on 9 Jan 2012 at 9:13

GoogleCodeExporter commented 8 years ago
My general recommendation is to start Selenium Server either before the 
execution or in highest level suite setup. If neither of these work for you, 
could you explain why? If there's a good enough reason, perhaps Start Selenium 
Server keyword could be changed so that it only starts the server once and 
running it again does nothing.

Original comment by pekka.klarck on 10 Jan 2012 at 9:37

GoogleCodeExporter commented 8 years ago
Well that sounds like a great idea.. I mean as far as selenium server goes I 
could also just create a global flag that marks it as started but there is 
possibility that it could crash so your suggestion is better..

As far as the top level suite how would I go about doing that?  I believe I 
tried to create a top level resource file that contained suite setup and 
teardown but it does not run on it's own it has to be called by a test case I 
believe which means it would run setup/teardown for every single test which is 
currently where I am.

Original comment by mr.danie...@gmail.com on 10 Jan 2012 at 11:29

GoogleCodeExporter commented 8 years ago
Resource files cannot have setups/teardowns but both normal test case files and 
suite initialization files can have suite setup and suite teardown:
http://robotframework.googlecode.com/hg/doc/userguide/RobotFrameworkUserGuide.ht
ml#suite-setup-and-teardown

Original comment by pekka.klarck on 11 Jan 2012 at 7:49

GoogleCodeExporter commented 8 years ago
Thanks that does the trick!

Original comment by mr.danie...@gmail.com on 17 Jan 2012 at 7:34

GoogleCodeExporter commented 8 years ago
Great. I think this issue can be closed.

Original comment by pekka.klarck on 19 Jan 2012 at 10:42