I tried to set SeeAllData = true for the test method with OnInstall = true. But I was not able to save the test class if I use "@isTest(OnInstall=true,SeeAllData=true)", so I saved it with "@isTest(OnInstall=true)". The package installation failed in our client's org because I'm inserting Account, Contact, and Product records in my test method and their Contact trigger is throwing the error "System.QueryException: List has no rows for assignment to SObject" (the insert statement in my test method is firing our client's trigger and they are using a query in their trigger to retrieve an existing record with a specific value in Name field "[SELECT Id from Account WHERE Name = 'XXX' limit 1]"). If I can set SeeAllData = true, then my test method will not fail, so please help me with this. Thanks in advance.


Don't use a comma for the attributes:

@isTest(SeeAllData=true OnInstall=true)

As far as I can tell, this isn't documented anywhere.

| improve this answer | |

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.