Defining a Namespace Prefix on a Connection

Introduction

As of Provar version 1.9, you can add or remove a Namespace Prefix at the Salesforce Connection level.

This enables the execution of a test case in a Namespace Prefix org, even if the test was developed in a non-Namespace Prefix org (and vice versa). For example, if tests are created in a development org but need to be run in a package org, or an org where a managed package is deployed.

Note however that Provar ensures none of the test cases are modified and updated with the effective namespace prefix in the execution environment. These changes are done at run time and only during the execution.

In this way, only a single version of the test needs to be maintained for use across multiple environments, even when the environments have different namespace settings.

Setting the Namespace Prefix Override

When adding or editing a Connection, you will see a new Namespace Prefix Override parameter under Advanced Settings:

­­­­

This parameter will accept one or more values entered in a comma-separated list.

These values can be positive or negative, which you can define using plus (‘+’) and minus (‘-‘) characters. If no character is provided a positive value is assumed.

  1. Adding a namespace prefix in order to execute tests in an environment with a namespace prefix if they were authored in an environment without a namespace prefix.
  2. Removing a namespace prefix in order to execute tests in a non-namespace environment if they were authored in an environment with a namespace prefix.
  3. Changing the namespace prefix in order to execute tests in an environment with a different namespace prefix from the environment in which they were authored.

Adding a Namespace Prefix

Add a positive Namespace Prefix Override value in order to execute tests in an environment with a namespace prefix if they were authored in an environment without a namespace prefix.

When Provar executes the test, the namespace will be added automatically based on the value set in the Namespace Prefix Override.

Example:

Note that this will not affect any tests created in a namespace prefix org or an org with the managed package installed. These will continue to use their existing namespace prefix settings, unless a matching negative value is found in the Namespace Prefix Override (see below).

Removing a Namespace Prefix

Add a negative Namespace Prefix Override value in order to execute tests in a non-namespace environment if they were authored in an environment with a namespace prefix.

When Provar executes the test, if the negative value in the Namespace Prefix Override matches the org’s developer namespace, Provar will automatically remove the namespace prefix from the test.xml on execution.

When Provar executes the test, if the negative value in the Namespace Prefix Override matches the namespace prefix of the control (be it be managed package or org’s developer namespace), Provar will automatically remove the namespace prefix from the test.xml on execution. (Note that the test case is not updated in the file system.)

Example:

Changing the Namespace Prefix

Add a negative Namespace Prefix Override value and then a positive value in order to execute tests in an environment with a different namespace prefix from the environment in which they were authored.

When Provar executes the test, it will remove any namespace prefix that matches any negative value set in the Namespace Prefix Override, then add any positive value set in the Namespace Prefix Override.

This can be done as part of the same operation, but please ensure that you enter negative values first in the list, followed by the positive.

Example:

Note that, if a + or – character is not provided, the value is assumed positive.

During execution, every locator will be normalized based on the provided values. But the test cases are not changed.

Using Namespace Prefix Overrides with Environment Management

If you are using Environments to manage org-specific execution details, you can add Namespace Prefix Override values as Connection Overrides to toggle namespace settings automatically based on your selected Test Environment.

This means that, if you change your Test Environment, Provar will take the Namespace settings defined on the Connection Override instead of the settings defined at the default Connection level.

Refer to Environment Management for more information.