Take the 2-minute tour ×
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.

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.

share|improve this question

1 Answer 1

up vote 10 down vote accepted

Don't use a comma for the attributes:

@isTest(SeeAllData=true OnInstall=true)

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

share|improve this answer
    
It worked. Thanks @sfdcfox –  ynl124 May 8 at 20:55

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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