Resolve unit test failures for Genesys Cloud for Salesforce External Routing package
The Genesys Cloud for Salesforce External Routing package contains unit tests that can fail in a sandbox org when certain test data is missing. The package includes the unit test only to satisfy the code coverage required for creating a package. You can change any aspect of the package, including which test data to use in the test code or the test code itself, at your own discretion.
When unit tests fail during deployment from a sandbox org, you can do the one of the following options:
- Set up test data needed for the tests to pass
- Modify tests to pass or delete them at your discretion
Set up test data for the tests
You can either create new test data in your sandbox org or reuse the existing data as test data. Unit tests in the package need the following resources to exist in the sandbox org:
- Routing Configuration: Setup > Omni-Channel > Routing Configurations
- Service Channel: Setup > Omni-Channel > Service Channel
- Queue: Setup > Users > Queues
Create new test data
To create a Routing Configuration in Salesforce:
- Create a Routing Configuration: Select Setup > Omni-Channel > Routing Configurations > New.
- Enter the following details for the configuration:
- Name: ER Config
- Routing Priority: 1
- Routing Model: External Routing
- Units of Capacity: 1
- Create a Service Channels for Case object: Select Setup > Omni-Channel >Service Channels > New.
- Enter the following details for the service channel:
- Service Channel Name: Case
- Developer Name: Case
- Create a Queue: Select Setup > Queues > New.
- Enter the following details for the queue:
- Label: ER Queue
- Queue Name: ER_Queue
- Routing Configuration: ER Config
- Supported Objects: Case
If the queue name you are using is different from what is specified in the getExternalRoutingQueue
method of GenesysCloudTestHelper.cls
, update the queue name in that file so that they match.
Use existing data as test data
If you already have a queue that matches the configurations as described in <link>, you can specify the queue name to use for unit tests in the getExternalRoutingQueue
method of GenesysCloudTestHelper.cls
to match your queue.
Modify or delete tests
You can check which unit tests are failing in your environment and modify those tests accordingly. The unit tests that can fail when test data is missing are as follows:
ExternalRoutingControllerTests.cls
ExternalRoutingDataServiceTests.cls
ExternalRoutingDeletionTests.cls
ExternalRoutingServiceTests,cls
OpenMessageServiceTests.cls
For more information about the integration, see About Genesys Cloud for Salesforce.