function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
hassabhassab 

Test Methods on Non-Profit Version

Hi all,

 

I am relatively new at this and I have a simple Apex clas in the non-profit version I am trying to deploy.  The class itself has passed with 91% coverage but its inserting a contact and I'm getting low coverage on other classes that I am guessing are getting triggered by the insert.  I'm not sure we need these triggers and I have been wanting to turn them off, but figured I'd wait a while to be sure.  My question is, do I need to build tests in my method for these classes or is there something that needs to be done in the classes themselves?

 

Thanks,

H

Best Answer chosen by Admin (Salesforce Developers) 
hassabhassab

OK, figured it out.  For anyone else, you need to run all tests in the IDE even if you ran them in the browser.  Also, I discovered that tests that pass may not deploy, particularly if you have stipulated specific data that was in your sandbox but not in your production environment.

 

The actual code for the controller was not as much a learning experience as testing and deploying it...

 

Thanks again Andrew,

Hassab

All Answers

hassabhassab

To anyone who comes across this, I'm seeing that there is currently no way to turn off these triggers so it looks like I need to find a way to test them.  Since I don't have access to the actual code I'm finding that rather difficult.  They are the only ones causing problems, and the three of them seem to have only approx 50% coverage a piece - does anyone have any experience with these triggers?  I'm totally stuck here and working out this affiliation problem is a major sticking point with our users!

mtbclimbermtbclimber

What does the coverage look like if you run all tests?  Running tests in a single class may mislead you.  Not every test written for a given trigger will always be within one class.

hassabhassab

Thanks Andrew - that helped.  I was at least able to see that one of the apps I had installed from the exchange was failing a test and uninstall it.  I am over the coverage barrier now, but I'm still at 86%.  Not a big deal but I'm curious why two of the classes that seem to have come from the non-profit version have no coverage.  Here's my results:

 

 

addContactAffiliation91
AccountViewOverride0 
ContactDeleteOverride0 
IndividualAccounts97 
RecurringDonations90
Relationships97
Affiliations96
Households74

 

Any thoughts?  BTW, is there anything stopping me from just uninstalling the package?

hassabhassab

Also, now I'm getting an error in the IDE that says all coverage across all classes are at 0%, even though I've refreshed multiple times.  Is there something special I need to do to update the IDE?

hassabhassab

OK, figured it out.  For anyone else, you need to run all tests in the IDE even if you ran them in the browser.  Also, I discovered that tests that pass may not deploy, particularly if you have stipulated specific data that was in your sandbox but not in your production environment.

 

The actual code for the controller was not as much a learning experience as testing and deploying it...

 

Thanks again Andrew,

Hassab

This was selected as the best answer