You need to sign in to do that
Don't have an account?
Maheshwar
Test coverage for "SELECT LoginGeoId FROM LoginHistory"
Hi,
My method will return true if there are any records in the LoginHistory for the currently logged in User in the last two hours.
Now, I'm trying to create a test class to cover this method.
So, in the test class, I need to login to salesforce org as a test user in order to create a record on LoginHistory.
Someone please help me with this scenario.
Thanks,
Mahesh
My method will return true if there are any records in the LoginHistory for the currently logged in User in the last two hours.
Now, I'm trying to create a test class to cover this method.
So, in the test class, I need to login to salesforce org as a test user in order to create a record on LoginHistory.
Someone please help me with this scenario.
Thanks,
Mahesh
Hi Mahesh,
You will not need to Login to Salesforce Org in order to test. But you can simply create a test record in LoginHistory via the @TestSetup method. This is quite easy and then check if your method is giving the required result as you demanded. Test methods run in isolation and hence you will not get Actual Login Details.
Give a like if my answer helped you in any way.
Thank you so much for responding.
I tried to insert a record in LoginHistory. However, it said "DML operation Insert not allowed on LoginHistory".
Is there anything that I'm missing?
Thanks,
Mahesh
Thanks.