Skip to main content
Full Circle Insights

Testing Extensibility Plugins

By default, Full Circle CRM unit tests do not instantiate plugins even if they are installed in the system and the Extensibility API is enabled.

You can enable your plugin during unit tests by creating a Set with the class names of the Apex classes that implement plugins and assigning the set to the FCRM.FCR_ExtensibilityAPI.EnablePluginsForTest field. This must be the very first thing you do in the test class (before any DML operations). The class name must match exactly that specified during installation of the plugin (case sensitive).

For example, if your class is named "MyClass", you can add the following line to your test code:

FCRM.FCR_ExtensibilityAPI.EnablePluginsForTest = new Set<String>{'MyClass'};

The class must already be registered as a plugin using the advanced configuration page or by calling the FCRM.FCR_ExtensibilityAPI.InstallPluginClass function.

Note that the Extensibility API must be enabled in Full Circle CRM configuration for your plugin to be tested and your test must be run with the "SeeAllData=True" to ensure that your current Full Circle CRM configuration will be in effect.

Additional Testing Notes

  • Be sure that the Extensibility API is enabled in Advanced Configuration and that SeeAllData is true on your test if you wish your plugin to be called by the framework. Remember to install the plugin first, and that FCRM.FCR_ExtensibilityAPI.EnablePluginsForTest is set before any DML operations.
  • You can also test your plugins by creating an Args argument and simulating a call to your plugin directly.
  • The Response Management system will process a given CampaignMember only once in a context – this includes unit test contexts. If you wish to test an update event, use DisableApplicationForContext to disable the application during the insert where you set up the test data. Be sure the fields on the CampaignMember are set (they won't be set by the application when it is off). Use UndoDIsableApplicationForContext to turn the application back on.
  • Was this article helpful?