Selenium GRID TestSession's life

100 views
Skip to first unread message
Message has been deleted

Tanmay Ghorai

unread,
Feb 27, 2015, 9:23:40 AM2/27/15
to seleniu...@googlegroups.com
Appreciate any suggestion

PeterJeffreyGale

unread,
Feb 27, 2015, 9:30:38 AM2/27/15
to seleniu...@googlegroups.com
Do you only want specific responses from anyone that has tried this? ... or general suggestions from anyone?

I log the time my tests are running, but not specifically the time they run on a local/remote grid specifically.

However, can't you just measure this from the client side (i.e. the PC from which your tests run) ... I don't see why you need to customize the GRID itself for this.

Tanmay Ghorai

unread,
Feb 27, 2015, 9:54:54 AM2/27/15
to seleniu...@googlegroups.com
Hi Peter,

Thanks for your response. I want to measure this in Server side - the reason is I want to restrict giving browser session. I dont want GRID to be used as Load Testing. It would be simply used for Functional testing.

Regards
Tanmay

PeterJeffreyGale

unread,
Feb 27, 2015, 9:56:47 AM2/27/15
to seleniu...@googlegroups.com
Sorry .. I don't understand what you're trying to say there.

Krishnan Mahadevan

unread,
Feb 27, 2015, 4:42:04 PM2/27/15
to Selenium Users
Assuming that all of your tests are UI based I think it would be easier for you to just evaluate a different of start and end time in your beforeInvocation() and afterInvocation() at the test side and then have a custom TestNG listener just post this information into a data source.


You can also consider overriding the below two interface implementations in org.openqa.grid.selenium.proxy.DefaultRemoteProxy and plugin your logic there :

  • org.openqa.grid.internal.listeners.TestSessionListener#beforeSession
  • org.openqa.grid.internal.listeners.TestSessionListener#afterSession




Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/
My Technical Scribbings @ http://rationaleemotions.wordpress.com/

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/479c5fe0-e2e4-4057-ab81-d84627afb3df%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Amit Chugh

unread,
Feb 28, 2015, 11:57:42 AM2/28/15
to seleniu...@googlegroups.com

Can anyone please help to configure selenium grid with RC in code level... i know how to configure with websriver. But facing issue while configuring with rc. Please help ... its very critical.

On 26 Feb 2015 19:59, "Tanmay Ghorai" <tanma...@gmail.com> wrote:
Hi Experts,

Wondering anyone worked on customizing Selenium GRID by capturing how long a Test Session is active with Client - when it starts, when it ends ?

Appreciate any help.


Regards
Tanmay


--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.

Tanmay Ghorai

unread,
Mar 1, 2015, 6:20:29 PM3/1/15
to seleniu...@googlegroups.com
Hi Krishnan,

Thanks for the suggestion.

I am noticing two different Session ID ( I am not sure whether they are Session ID or not) in  beforeSession vs. afterSession.

When I print Session in beforeSession - it prints : 72e52ac5-9764-466f-8bdb-29a3c5bffafa (int. key, remote not contacted yet.).

where as when I print in afterSession : ext. key 9b50fd33-0e92-4139-a601-1bcbfa9fc86b.

However I see in Node the session ID is
9b50fd33-0e92-4139-a601-1bcbfa9fc86b.

I wanted to capture SessionID in my DB Log and its start and end time. As this would allow me to see how many Concurrent Sessions from an app is running so that I can restrict upto certain numbers. I dont want to misuse my GRID or dont want user to use as a Load Testing ENvironment.

Regards
Tanmay

Krishnan Mahadevan

unread,
Mar 1, 2015, 11:20:05 PM3/1/15
to Selenium Users
Tanmay,

I was hoping that you would pick up on the leads I shared and proceed further. My bad !

Did you read through the javadocs of beforeSession() ?

beforeSession() is going to be called even before the test session is created. So yes, it would obviously be different from what the actual session's session id is going to be.

So you should combine the learnings that you have had so far [ I believe I have responded to you for many of your queries on the Grid offlate] to look at what you have so far before you go ahead and implement this.
Your use case is specific and so I don't think anyone would have already solved the use case. 

Here's what you should be doing :

* override getNewSession() [ https://github.com/SeleniumHQ/selenium/blob/master/java/server/src/org/openqa/grid/selenium/proxy/DefaultRemoteProxy.java#L196-L201] wherein you track the start of a session in milli seconds. This is where the actual session is gettting created.
* override the afterSession() to record the end time of a session in milli seconds.

Hope that should sort this out !

All said and done, not sure why you are bent upon doing this at the Grid level. Are you trying to build a Grid which is going to be used as a service by the general public ? If its within your own company why is it that difficult to just talk to people and educate them not to abuse the resources ? :)







Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/
My Technical Scribbings @ http://rationaleemotions.wordpress.com/

Reply all
Reply to author
Forward
Message has been deleted
0 new messages