You can try writing your test methods to update attributes on the User running tests. For example, if you have a trigger that only executes when the users profile equals sales rep you could do something like this.
Code:
pseudo code:
User testUser = [select profileId from User where Id = :UserInfo.getUserId];
testUser.profileId = "sales rep" //this would be in the form of an ID
update testUser;
Then run your tests
This changes aren't committed to the database so no worries about changing the profile.
This changes aren't committed to the database so no worries about changing the profile.
Message Edited by TehNrd on 05-19-2008 11:27 AM
http://community.salesforce.com/sforce/board/message?board.id=apex&thread.id=4967&jump=true
Tehnrd , your logic in test class is not working. Is there something I am missing here ?
Thanks for the help.