I have a requirement that uses criteria based sharing. I wish to unit test this requirement.

I have seen this SE post that says that we can not test Criteria based sharing and I have seen the help docs that also say criteria based sharing can not be unit tested. ("criteria-based sharing cannot be tested using Apex.")

However the post above is nearly 2 years old, so does anyone have a recommended approach around this to allow some level of testing of data visibility for a specific profile or public group member within unit tests?

1 Answer 1


There is no way to unit test Criteria Based Sharing so that post is still accurate, So what I would do is create a few records, and then jump from user name to user name and see if they can see the newly created record. It's going to have to be a manual process..


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.