Megosztás a következőn keresztül:


Reset think times to Zero or to a desired value using VSTS Web / Load Test plugin

How to reset think times to Zero or to a desired value using VSTS Web / Load Test plugin

In my case I need to reset think time to Zero to get max iteration in specified run. I can do this manually but it requires a lot amount of time to do that. I need to go through each web test request and set think time as Zero, which is tedious - as I have so many web requests and web tests.

 Adding this plug-in it navigates to all web tests and provides think time as Zero/targeted value during load test execution. So that we no need to edit each web test and web test step individually.

Plugin Code

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace MyCustomClass
{
    public class ResetThinkTime : Microsoft.VisualStudio.TestTools.WebTesting.WebTestPlugin
    {
        public override void PreRequest(object sender, Microsoft.VisualStudio.TestTools.WebTesting.PreRequestEventArgs e)
        {
            base.PreRequest(sender, e);
            e.Request.Timeout = 0;

            if (e.Request.ThinkTime > 10)
            {
                e.Request.ThinkTime = 0;
            }
        }
    }
}

After compiling the source add plug in to each web test.