Quantcast
Channel: Category Name
Viewing all articles
Browse latest Browse all 10804

Using Setup and Cleanup Script in Cloud Load Test

$
0
0

Performance and load testing is a very important part of the Application Lifecycle. You’d want to do this at least every time prior to deploying the latest changes to production. To determine how well your software responds to various levels of usage, a load test allows users to model the expected usage of a software by simulating multiple simultaneous users to generate load on the application. Cloud-based Load Testing (video) makes it super easy to get you off the ground as you get capacity on demand. Visual Studio Ultimate lets you carry out both local and cloud-based load test runs.

In some test scenarios, we might have to set the environment for the test using setup scripts while in some other cases, we might have to clean up the environment in the event of cleanup such as temporary files or folders which might be created during execution of the tests. To meet this requirement you can include Setup and Cleanup scripts in testsettings for your test solution.

Let's see some of the uses of Setup and Cleanup scripts in our cloud based load test scenario.

  1. User wants to install some software on agents that run my load tests in the cloud to collect some useful data or metrics.
    • Installing Network Monitor on agents to capture network traffic statistics. You can use setup script to install it on the agent machine and then with the use of cleanup script save data to some remote storage (ex. Azure Storage with help of SAS Key). 

      2.   User wants to install certificates on agents

    • In case of Http client authentication where web server needs to authenticate client using client's public key certificate, you will need to install the corresponding certificate on the agents that run your load tests.
    • If your unit tests have requirement to perform operations like create new storage account, deploy a windows azure website etc. using Windows Azure Management Api where you need Azure Management Certificate to be installed on client machine.

      3.   Users want to setup Registry Values

    • Some tests may require to set some key in the registry for the test scenarios.

Let's walk through how to achieve the above scenarios using Visual Studio Ultimate:

Install certificate on agent that run my load tests in the cloud

If user needs to install certificate say mycertificate.cer on the agent machine, he should add mycertificate.cer to the deployment items and install it using setup script. Here we will use Certificate Manager Tool (CertMgr) to install mycertificate.cer certificate on test computer in our setup script. In such case setup script will look like

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

This command will add the certificate mycertificate.cer to the Trusted Root Certification Authorities certificate store on the test computer. You can read more about Using CertMgr to Install Test Certificates on a Test Computer.

In case you want to import pfx on the agent machine, setup script will look like

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

You can read more about certutil.exe here.

Deployment Items go inside a DeploymentDirectory which can be accessed by environment variable %DeploymentDirectory%

How to add certificate as a deployment item?

Double click the active test settings (Local.testsettings in this case) to open Test settings window. Click on the Deployment tab on left side of window. Deployment page is displayed.

 

Make sure you tick the "Enable deployment" checkbox (Add File… and Add Directory… button would be disabled otherwise)

Now click on the "Add File…" button to Open "Add Deployment Files" browser dialog, browse to location of your certificate and add it to the deployment items.

Click on Apply and Close, we have successfully included the certificate as a deployment item.

Deployment Items go inside a DeploymentDirectory which can be accessed by environment variable %DeploymentDirectory%

How do I add install the certificate added in deployment items on test agent machine? 

User should make use of setup script in this scenario. First step is to create a script (*.bat) file, say setupscript.bat in this example.

Content of setupscript.bat

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

Next step is to include setupscript.bat in our active load and web test settings. Double click the active test settings (Local.testsettings in this case) to open Test settings window. Click on the Setup and Cleanup Scripts tab on left side of window. Click the ellipsis (…) to locate the setup script (setupscipt.bat) in this case.

 

Click on Apply and Close to add the setupscript.bat as Setup script. 

Install some software on agent that run my load tests in the cloud

User can use deployment options and a setup script in test settings. You can add the .exe or other files to the Deployment window which you want to deploy on the Agent and using the Setup script you can install them on agents.

For example, if you want to install WebDeploy on the agent machine I should add WebDeploy_x64_en-US.msi to Deployment window. In such case setup script say Setup.cmd will look like

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

Similarly you can install any software on the Agents by adding it to the deployment item and using setup script to install it.

Please give this a try and do let us know your feedback :). Feel free to reach us at vsoloadtest@microsoft.com 


Viewing all articles
Browse latest Browse all 10804

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>