Skip to main content
Greg Coogan fragte in #Apex
All documentation and articles I have found create a new test user to be used with the RunAs method in a Test Class. How would I run as an existing user, such as an "Integration User" we have? I don't want to create a new user in the Test Class.
1 Antwort
  1. 4. Mai 2016, 19:01
    Without using seeAllData = true we can't access the org data but it's not recommended to use seeAllData = 'True' in the test class the test class will fail if you don't have the particular user in your org then the test will fail. So I recommend you to create a new user in the test class with the user profile same as your Integration userCreation of test data or test user in salesforce org won't  store in the org or send any notification.

    https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_testing_tools_runas.htm
0/9000