AUTOMATED TEST FRAMEWORK - TEST STEP TO CHECK IF USER HAS LOGGED IN

karen joy
Tera Contributor

Good day, everyone.

 

Is there a way or test step in ATF to check if user has logged in?

 

Thanks in advance.

5 REPLIES 5

Peter Bodelier
Giga Sage

Hi @karen joy,

 

Can you explain why you would like to use this? There may be a better solution for your use case.


Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.

Hi @Peter Bodelier 

 

I'd like to know if it is possible to have a test step in ATF to check if user was able to log in successfully in Servicenow instance.

 

Thanks.

I do not believe that is something which can be tested, apart from doing a query on the user table, to see if any records exist with a last login time in the last x period.

 

You won't be able to let a user log in with ATF, since it is already running as a logged in user.


Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.

Vaibhav
Mega Guru

Hello @karen joy ,

 

Its possible by some way to check logins users with current sessions.

There is one table "Logged in Users (v_user_session)" in where users login/logout session are maintained.

 

Proceed with below steps:

 

1.Go to sys_user_session table-
 - We can get the  'current' logged-in users from the entire instance, by filtering on "Name is not Empty" AND "Invalidated is Empty".

 - The sys_user_session.invalidated column will be empty, as long as the related user session is active.
 - When the session becomes inactive (either by logging out, or session being destroyed by the platform - based on the value of 'glide.ui.session_timeout' system property), sys_user_session.invalidated will be populated with the session end timestamp.

 

2. Normally "Logged in users" module under "User Administration" will give you the correct number of users logged in. But when Multi SSO/Single Sign-on is enabled, this module doesn't show the correct information.

You can find the users logged in by following the steps below:

  1. Go to xmlstats.do with include=sessions             
  2. In the <sessions> tag 
    • logged_in parameter shows how many users are currently logged in to this node.

 

Please mark my answer helpful and solution accepted if it serves the purpose..

Regards,

Vaibhav