I want to create an User in test class with system Administrator profile.
The issue which i have is that i have seeAllData = false where in the test class would only use data from within the test class.
List<Profile> ps = [select id, name from Profile where name = 'System Administrator'];
This might not return any values.
Any ideas how we can create an user
EDIT
I can get the data for the query on even with seeAllData= false. So is it that Profile records are visible even if SeeAllData = false ?
According to the documentation, the User and Profile objects are considered "objects that are used to manage your organization" and can be accessed regardless of whether or not your test class/method includes the IsTest(SeeAllData=true)
annotation.
Other objects that are accessible in this manner include: