Archive

Archive for the ‘Load Testing’ Category

Visual Studio 2017 Enterprise: Where is Load and Performance Testing Project Template


If you are running Visual Studio 2017 Enterprise and you can find the template to create a new Performance Test Project, it basically means that it wasn’t installed. Visual Studio 2017 comes with new installer and by default the Web Performance and Load Testing component is not installed. To install the component, go through the following instructions

  • Launch the Visual Studio 2017 Installer

  • Click on Modify

  • Click on Individual components

  • Check Web performance and load testing tools
  • Click the Modify button

About Lajak Technologies

A consulting firm in Ottawa, Ontario that provides services related to Microsoft technologies, Team Foundation Server, DevOps practices, security and more. Contact us today to help you solving your complex software problems.

Visual Studio Performance Testing #7: Unique Data


Some of your test scenarios require unique data. For example, if the script adds a new user account, company, personal information, address, etc, you should use unique data because most system won’t allow you to enter duplicate data.

With Visual Studio, most likely you will be using a data source with the prepared unique data. If you are using one Agent or Visual Studio to execute your load test, the tool may not reuse the data if you have enough data for your test. However, when using multiple Test Agents, it is almost guaranteed that the tool will use the data more than once. Visual Studio allows you to configure that behavior.

 

I am assuming that you have already added the data source. Expand the datasource node, expand the Tables node and select Unique from the Access Method list as shown below

 

 

With such configuration the Test Controller divides the data among the Test Agents

About Lajak Technologies

A consulting firm in Ottawa, Ontario that provides services related to Microsoft technologies, Team Foundation Server, DevOps practices, security and more. Contact us today to help you solving your complex software problems.

Visual Studio Performance Testing #6: User login Script


In the previous post, I showed how to instruct the tool to use a new user every time it executes a test iteration. But that might not be what you need when running your load test. Most of my load testing gigs have the following requirement:

-I want x number of users to login to the system

-I want those users to run the following test cases until the completion of the test duration

In other words, users should login once and keep executing test cases.

To fulfil the requirements, we need to create two scripts: one for login the user and the other contains the requests for the scenarios

In the load test file, right click on the scenario and click Edit Test Mix

At the bottom of the dialog, check “Select an initialize test to execute before other tests for each virtual user” and select the Login script. Your other scenarios should be at the middle of the dialog where my CreateCompany script is.

About Lajak Technologies

A consulting firm in Ottawa, Ontario that provides services related to Microsoft technologies, Team Foundation Server, DevOps practices, security and more. Contact us today to help you solving your complex software problems. Visit us at http://www.lajak.com.

Visual Studio Performance Testing #5: New User Per Test Iteration While Load Testing


While running a load test, Visual Studio or Test Agents iterate though the recorded requests. After the requests are completed, the tool will re-execute the requests using the same virtual user and session.

To change the default behavour and tell the tool to use a new user per test iteration you need to set the Percentage of New Users to 100

About Lajak Technologies

A consulting firm in Ottawa, Ontario that provides services related to Microsoft technologies, Team Foundation Server, DevOps practices, security and more. Contact us today to help you solving your complex software problems. Visit us at http://www.lajak.com.

Visual Studio Performance Testing Tip #4: Plugin is not executing


In the previous post, I showed how to create a plugin for Visual Studio Performance Test to suppress dependent requests that contained certain text. In few occasion the plugin wasn’t being executed by Visual Studio. I tried many things include, GACing the assemblies, Copy to local drive, reboot and other solutions that are posted on the internet. But nothing fixed the issue.

I found out that removing the requests that invoke favicon.ico fixed the issue. I don’t know reason. It seems to be a bug

About Lajak Technologies

A consulting firm in Ottawa, Ontario that provides services related to Microsoft technologies, Team Foundation Server, DevOps practices, security and more. Contact us today to help you solving your complex software problems. Visit us at http://www.lajak.com.

Visual Studio Performance Testing Tip#3: Writing plugin


One of the websites I had to perform a performance and load test was behind a firewall and it wasn’t connected to the internet. But, the website was doing calls to googleAnalytics and other Analytics tools. I wrote a plugin to suppress dependent requests that contains certain text. The following is the source code of the plug in which was part of a Class Library project.

using Microsoft.VisualStudio.TestTools.WebTesting;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace LoadTestingPlugins
{
    public class FilterDependentRequest : WebTestPlugin
    {
        string m_containsRequests;
        //Property that is visible in the WebTest Plugin property window. User can enter comma separated phrases for suppress multiple requests
        public string FilterOutDependentRequestsThatCotains
        {
            get { return m_containsRequests; }
            set { m_containsRequests = value; }
        }

        List m_FilterDependentRequests;
        List FilterDependentRequests
        {
            get
            {
                if (m_FilterDependentRequests == null)
                {
                    m_FilterDependentRequests = new List(FilterOutDependentRequestsThatCotains.Split(','));

                }
                return m_FilterDependentRequests;
            }
        }
        public override void PostRequest(object sender, PostRequestEventArgs e)
        {
            if (string.IsNullOrEmpty(FilterOutDependentRequestsThatCotains))
            {
                return;
            }

            WebTestRequestCollection depsToRemove = new WebTestRequestCollection();
            //loop through the dependent request
            foreach (WebTestRequest r in e.Request.DependentRequests)
            {
                //Save request that contains any of the comman separated phrases into a temp array
                if (FilterDependentRequests.FirstOrDefault(s => r.Url.Contains(s)) != null)
                {
                    depsToRemove.Add(r);
                }
            }

            //remove all dependent requests that matches the criteria
            foreach (WebTestRequest r in depsToRemove)
            {
                e.Request.DependentRequests.Remove(r);
            }

        }

    }
}

About Lajak Technologies

A consulting firm in Ottawa, Ontario that provides services related to Microsoft technologies, Team Foundation Server, DevOps practices, security and more. Contact us today to help you solving your complex software problems. Visit us at http://www.lajak.com.

Visual Studio Performance Testing Tip#2: Extract a value by Id


I do few performance testing gigs a year. One of the most frequently think I do is extracting a value of an element by id from the response of a request. The extracted value is used in subsequent requests

For example, let’s say I go www.lajak.com and there is a HTML element declared as follows:

<input id=”testId” value=”testValue” />

There few ways to extract the value of the input. The most reliable way to extract the value using Visual Studio is to use the “Extract Attribute Value” Extraction Rule.

Right click on the request you want to extract the value from its response and click on Add Extraction Rule

Select Extract Attribute Value

Enter a Context Parameter Name

Tag Name is “input” which is the name of the element

Match Attribute name is the name of the attribute we want to search by. In our example, we are trying to an element’s value by id. Hence the value of the property is id

Match Attribute value is the value of the above attribute. In our example, the value is testid

Attribute name, is the attribute name that we want get its value. In our example it is value

The above extraction rule should extract “testValue” and save it into TestIdValue.

In subsequent requests, bind to your querystring or form to TestIdValue parameter

About Lajak Technologies

A consulting firm in Ottawa, Ontario that provides services related to Microsoft technologies, Team Foundation Server, DevOps practices, security and more. Contact us today to help you solving your complex software problems. Visit us at http://www.lajak.com.