...
Changing Environments from the GUI
To change what environment is active:
- Right-click the node representing the environment you want to make active, then choose Set as Active Environment.
Exporting, Importing, and Referencing Environments
You may find that many configuration settings, such as server names and ports, will be common across multiple projects. Rather than duplicating these settings, you can export environment settings to an external file and import or reference the values in other projects.
Exporting Environments AnchorexportingEnv exportingEnv
exportingEnv | |
exportingEnv |
To export an environment:
- Right-click the node representing the environment you want to export, then choose Export Environment.
- In the file chooser that opens, specify a location for the exported environments file.
The environments configuration will be written in an XML-based text file. If one Environment is selected, a *.env
file will be created, containing a single environment. If multiple environments are selected, a *.envs
, or Environment Set, file will be created containing all of the selected environments.
Importing Environments
When you import environments, you are bringing a copy of the values from the external environment file into your project. Further modification to the XML file will not be reflected in your project.
To import an environment:
- Right-click the Environments node, then choose Import Environment.
- In the file chooser that opens, specify the location of the environments file that you want to import.
Referencing Environments
Referencing environments is the most efficient way to share a single environment configuration across multiple projects. Using environment references, you can easily modify the configurations of multiple projects from a single location.
To reference an environment:
- Right-click the Environments node, then choose Reference Environment.
- In the configuration panel that opens on the right, specify the location of the environments file that you want to reference.
Note that when an environment configuration is referenced, you cannot edit the environment variables in the environment directly. However, your project will always use the values reflected in the referenced *.env
file. Modifying the *.env
file will propagate changes to all projects that reference it.
Modifying Environment (.env) Files
Environment (.env) files are XML-based text files and can be manually modified. It is not recommended that you try to create an .env file from scratch; instead, export an environment as described in Exporting an Environment to use as a template. After exporting an environment, you can open it in any text editor to make changes. It will look similar to the sample below.
Code Block | ||||
---|---|---|---|---|
| ||||
<?xml version="1.0" encoding="UTF-8"?>
<Environment xmlns="http://www.parasoft.com/schema/environment/1.0"
name="New Environment">
<Variable>
<Name>Name1</Name>
<Value mask="false">Value1</Value>
</Variable>
<Variable>
<Name>Name2</Name>
<Value mask="false">Value2</Value>
</Variable>
</Environment> |
Existing variables can be modified directly. To add a new variable, copy an existing variable (everything between a set of <Variable></Variable> tags, including those tags) and paste on a new line, then change the name and value as needed.