You need to sign in to do that
Don't have an account?
Chris760
Simulate a user logging in on a test class?
I have a trigger that utilizes the Last Login field on the user record (you need to have logged in within a certain period of time to start getting a case load assigned to you), but I can't seem to figure out how to simulate a test user logging into salesforce on a test class. I've tried inserting a UserLogin record manually to create the needed "Last Login" record, but no dice... the system wouldn't let me. Is there some other way that I could simulate the act of a test user logging into salesforce after I've created that test user?
Any ideas would be welcome.
Any ideas would be welcome.
System.runAs( u ) {
}
where u is the user instance.
Were you able to create the login records?
I am in the same situation.
I need to login as the test user in test class in order to create a record on LoginHistory.
Thanks,
Mahesh