Documentation > UCP Implementation Guide > Testing

General Functional Testing

It can be a challenge to test the UCP scripts in non-production environments. For example, if you configure a notice for “www.mycompany.com” and you are trying to test from “test.mycompany.com” the notice will not function as the domain won’t match. There are several strategies to overcome this.

Duplicate Notice Testing


The first strategy is to create a notice for “test.mycompany.com” that is configured exactly the same way as “www.mycompany.com” (same countries, translations, consent settings, themes, etc.).  This is an easy way to run some initial tests but may not satisfy all the acceptance criteria of your testers.

One of the downsides of this testing is the list of vendors for “test.mycompany.com” won’t match the vendors for “www.mycompany.com” since it is unlikely you have set up all the advertising vendors on that site.  And, even if you have, it may not be publicly accessible for our scanners to pull vendors from.

Root Domain Testing


Depending on how your domains are set up you may be able to set up a notice for the root domain that covers both “www.mycompany.com” and “test.mycompany.com”.  This will show the same notice for both environments with the list of vendors and everything.  However, it may not be appropriate based on your environment to set up a root domain notice.

Javascript Domain Override


UCP has a full JavaScript API that can be used to force a specific Domain to be registered for the script to execute on. This is available so you can test on a site other than the one to which you will push to production. This requires a JavaScript call to fire on your test site.  Here is an example of what that would look like:

setTimeout(function () {

window.evidon.notice.setDomain('www.mycompany.com');

}, 2000);

This is handled in a timeout because the script needs to load and try to detect the current domain first.  If the script hasn’t loaded this setDomain call will fail.

Ask your CSM for a copy of our Javascript API documentation for more details on this and other API functions.

Connect with Crownpeak