function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Abhishek Kumar 149Abhishek Kumar 149 

how to create virtual record for Profile in test class?

Vickal GuptaVickal Gupta
Hi Abhishek,

You don't have to create Profile in Test class.
All you need to do is query it from your Org. Refer below example:
Profile p = [SELECT Id FROM Profile WHERE Name='System Administrator'];
You can change name('System Administrator') based on requirement. And then you can use profile Id (p.Id) in your test classes.

Hope this will help you.