Install certificates and custom software on agent machines

Azure Test Plans

Note

While Azure DevOps cloud-based load testing service is deprecated, Azure Load Testing Preview is available. Azure Load Testing Preview is a fully managed load testing service that enables you to use existing Apache JMeter scripts to generate high-scale load. To learn more, see What is Azure Load Testing Preview?. To learn more about the deprecation of Azure DevOps load testing and other, alternative services see Changes to load test functionality in Visual Studio and cloud load testing in Azure DevOps.

In some test scenarios you might need to set up the environment for the test, such as installing certificates or custom software, and then clean up the environment afterwards (such as removing temporary files or folders created during test execution). To do this you can include artifact deployments, setup, and cleanup scripts in the Test Settings of your test solution.

Some examples are:

  • Install client certificates on agent machines; for example, when you are using HTTP client authentication the web server authenticates the client using the client's public key certificate. You can use a setup script to install the relevant certificate on the agent machines that run your load tests.

  • Install an Azure Management Certificate; for example, if your unit tests must perform operations such as creating a new storage subscription or deploying an Azure website by using Windows Azure Management API. You can use a setup script to install the certificate.

  • Install software on the machines running the load test agents in the cloud to collect data or metrics; for example, installing Network Monitor to capture network traffic statistics. You can use a setup script to install it on the agent machine and use a cleanup script to save the data to remote storage such as Azure Storage (by using a SAS key).

  • Change settings on the agent machine before and after running the test; for example, you can use a setup script and a cleanup script to modify and reset values such as registry entries or other settings as required.

Add certificates and scripts to deploy

  1. Double-click the active test settings (such as Local.testsettings) to open Test Settings dialog.

  2. Select the Deployment page and set the Enable deployment checkbox.

    Enable deployment of artifacts

  3. Choose Add File, browse to the location of your certificate, and add it to the deployment items list.

    Add certificate to deploy

  4. Select the Setup and Cleanup Scripts page in left-hand navigation bar.

  5. Choose the ellipsis (...), browse to the location of the file or other artifact you want to deploy, and add it to the deployment items list.

    Add script to deploy

  6. Choose Apply and then Close.

Deployment Items are in a folder named DeploymentDirectory, which can be accessed through the environment variable %DeploymentDirectory%

Examples of setup scripts

Script to install a certificate into the Trusted Root Certification Authorities certificate store on the test computer. This assumes you have added the Certificate Manager Tool CertMgr.exe to the deployment list:

%DeploymentDirectory%/CertMgr.exe -add -c %DeploymentDirectory%\mycertificate.cer -s -r localMachine root

Script to import a certificate into the Trusted Root Certification Authorities certificate store on the test computer:

certutil.exe -f -user -p password -importpfx %DeploymentDirectory%\mycertitficate.pfx NoRoot

See CertMgr and Certutil for more information about using these utilities.

You can use the deployment options and a setup script to add .exe files or other files you want to deploy to the machines running the agent, and use a setup script to install software on these machines. For example, a script to install Web Deploy on an agent machine that runs load tests in the cloud, assuming you have added WebDeploy_x64_en-US.msi to the deployment list:

%DeploymentDirectory%\WebDeploy_x64_en-US.msi /passive.

See also

Help and support

Report any problems on Developer Community, get advice on Stack Overflow, and get support via our Support page.