My question is about a strategy for unit testing across profiles. Ideally, we'd like to isolate data to our unit tests (SeeAllData=false, the default) so that we could more easily write our unit tests to not touch on production data. Many of our tests need to test as different running users, with different profiles, including the Sites user ([SiteName] Guest User).
For most internal and portal profiles, we can just create an instance of the user within the test. However, we also need to test the website guest user (anonymous sites users) and it seems like the only way to get this user is to query for it. The only way to query for a user is to have SeeAllData=true and this makes test data isolation pretty difficult.
Ideally, what we want to do is create a utility class for our tests that takes arguments to create or query for a new or existing user, respectively. Does anyone have an example of utility methods like this that they could share here or via github?