Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7632057
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T06:31:16+00:00 2026-05-31T06:31:16+00:00

I am new on Load Testing (and in general, testing) with visual studio 2010

  • 0

I am new on Load Testing (and in general, testing) with visual studio 2010 and I am dealing with several problems.

My question is, is there any way possible, to add a custom test variable on the Load Test Results?

I have the following UnitTest:

[TestMethod]
public void Test()
{
    Stopwatch testTimer = new Stopwatch();
    testTimer.Start();
    httpClient.SendRequest();
    testTimer.Stop();

    double requestDelay = testTimer.Elapsed.TotalSeconds;
}

This UnitTest is used by many LoadTests and I want to add the requestDelay variable to the Load Test Result so I can get Min, Max and Avg values like all others Load Test Counters (e.g. Test Response Time).

Is that possible?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T06:31:18+00:00Added an answer on May 31, 2026 at 6:31 am

    Using the link from the @Pritam Karmakar comment and the walkthroughs at the end of my post I finally managed to find a solution.

    First I created a Load Test Plug-In and used the LoadTestStarting Event to create my Custom Counter Category and add to it all my counters:

    void m_loadTest_LoadTestStarting(object sender, System.EventArgs e)
    {        
        // Delete the category if already exists   
        if (PerformanceCounterCategory.Exists("CustomCounterSet"))
        {
            PerformanceCounterCategory.Delete("CustomCounterSet");
        }
    
        //Create the Counters collection and add my custom counters 
        CounterCreationDataCollection counters = new CounterCreationDataCollection();
        counters.Add(new CounterCreationData(Counters.RequestDelayTime.ToString(), "Keeps the actual request delay time", PerformanceCounterType.AverageCount64));
        // .... Add the rest counters
    
        // Create the custom counter category
        PerformanceCounterCategory.Create("CustomCounterSet", "Custom Performance Counters", PerformanceCounterCategoryType.MultiInstance, counters);
    }
    

    Then, in the LoadTest editor I right-clicked on the Agent CounterSet and selected Add Counters… In the Pick Performance Counters window I chose my performance category and add my counters to the CounterSet so the Load Test will gather their data:

    enter image description here

    Finally, every UnitTest creates instances of the Counters in the ClassInitialize method and then it updates the counters at the proper step:

    [TestClass]
    public class UnitTest1
    {
        PerformanceCounter RequestDelayTime;
    
        [ClassInitialize]
        public static void ClassInitialize(TestContext TestContext)
        {
            // Create the instances of the counters for the current test
            RequestDelaytime = new PerformanceCounter("CustomCounterSet", "RequestDelayTime", "UnitTest1", false));
            // .... Add the rest counters instances
        }
    
        [TestCleanup]
        public void CleanUp()
        {
            RequestDelayTime.RawValue = 0;
            RequestDelayTime.EndInit();
            RequestDelayTime.RemoveInstance();
            RequestDelayTime.Dispose();
        }
    
        [TestMethod]
        public void TestMethod1()
        {
             // ... Testing
             // update counters
             RequestDelayTime.Incerement(time);
             // ... Continue Testing
        }
    }
    

    Links:

    • Creating Performance Counters Programmatically
    • Setting Performance Counters
    • Including unit test variable values in load test results
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is it possible to load new lines from a text file to variables in
I am loading/unloading several swfs from one main swf. When I load a new
I see several other questions about load testing web services. But as far as
ATM, I'm testing my cart. When I load a new page with products to
I am new to Grinder load testing framework. I recorded a grinder script using
I'm pretty new to load testing with VS, but I think I've set everything
Was hoping to use Visual Studio Ultimate trial to run load tests against the
I use a JavaScript to load new pages on my webpagepage. looks like this:
I'm trying to load a new view into an existing view controller, but I
I am trying to load a new view with the following code - (void)tableView:(UITableView

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.