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.
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.
Here's how it works:
- Anybody can ask a question
- Anybody can answer
- The best answers are voted up and rise to the top