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.

Advertisements

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.

Visual Studio Performance Testing Tip #1: Create random value


While running a performance test, I don’t want to provide a new set of data every time I want to run a load or performance test. I can think of couple of ways to create a random value:

  1. Add a Generate Random Integer Plug-in as shown below

  2. Or Add a Date Time Request Plugin as shown below

    Bind the QuerySpring or the Post Form parameter to the Context parameter

    The above steps if you rare unning a performance test or a load test with one agent. If you are running a load test with multiple agents, you will potentially have the same value. In this case, bind the request to a data source (e.g. csv file with sequential numbers) as such

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.

Xamarin: The previewer requires a 64bit version of Java


If you are getting “The previewer requires a 64bit version of Java” when running the Xamarin Form Previewer, you need to download the 64bit version of the JDK not the JRE.

Once downloaded and installed, go to ToolsàOptionsàXamarin

Point the JDK to the 64bit version

 

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.

Categories: Xamarin Tags:

Debug Aspnet Core HTTP Error 502.5 – Process Failure


Today after upgrading an aspnet core 1.0 to 1.1 I was getting HTTP Error 502.5 – Process Failure

In your project web.config:

  • Enable stdoutLogEnabled (set it to true)
  • Set full path for stdoutLogFile and make sure that the “logs” folder already exists
  • Then hit F5

<aspNetCore
processPath="%LAUNCHER_PATH%"
arguments="%LAUNCHER_ARGS%"
stdoutLogEnabled="true"
stdoutLogFile="C:\logs\stdout"
forwardWindowsAuthToken="false"/>

In my stdout file I got the following error:

The specified framework ‘Microsoft.NETCore.App’, version ‘1.1.0’ was not found.

– Check application dependencies and target a framework version installed at:

C:\Program Files\dotnet\shared\Microsoft.NETCore.App

– The following versions are installed:

1.0.0-rc2-3002702

1.0.1

1.0.3

– Alternatively, install the framework version ‘1.1.0’.

I was under the impression that I had already installed version 1.1.0. But it seems that I installed 1.0.3 instead J It was 1:00 AM LOL

Here is the trick part. When you go to https://www.microsoft.com/net/download/core to download .NET Core, the default selected tab is LTS instead of Current

Select Current and download the latest version of .NET Core SDK

 

Categories: asp.net Tags: ,

Use JQuery to get data from specific html table column


One of the gigs I am currently working on is to load test a web application. I needed some ids to feed my load test scripts but I didn’t have access to the database. I can view the information on a grid on one of the HTML pages. I solved the problem by using JQuery to query the HTML table and extract the ids I need. The id column is the second column on the grid and hence I am using eq(1) in the script below.

Click F12 to open the dev tools and I excuted the following scripts to get the ids  I needed.

$(‘table > tbody > tr’).each(function(i) {

console.log( $(this).find(‘td:eq(1)’).text())

});

 

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.

Categories: javaScript, Uncategorized Tags: ,