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 7128013
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T11:05:38+00:00 2026-05-28T11:05:38+00:00

I am using VS 2010 unit tests to create a load test. BeginTimer/EndTimer are

  • 0
  • I am using VS 2010 unit tests to create a load test.
  • BeginTimer/EndTimer are used to measure the response time.
  • On success, the timer works as expected.

If an error occurs in the application, I don’t want the timer to record the response time. This will throw off the analysis reports. As an example, an OpenOrder method on success may take 30 seconds, but on failure (eg order not found), the OpenOrder might return in 2 seconds. I want the response time metrics to represent only thebactions that were successful.

  • Alternatively, is there a way to filter out the timers/transactions
    that were not successfull?
  • Is there another way to do this? Something else besides
    BeginTimer/EndTimer?

Code Snippet:

testContextInstance.BeginTimer("trans_01");

OpenOrder("123");// Execute some code

// If the open fails, I want to disregard/kill the timer.
// If I do a 'return' here, never calling EndTimer, the timer 
// is still ended and its response time recorded.

testContextInstance.EndTimer("trans_01");
  • 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-28T11:05:38+00:00Added an answer on May 28, 2026 at 11:05 am

    This is a deficiency in the unit testing API. There is a similar lack in the web testing API. I too have wanted a way to disregard timers around failures, but I think we are out of luck here. I believe an enhancement request to Microsoft is needed.

    There is (possibly) a (lengthy) workaround: add in your own timer (using Stopwatch class) that you can ignore/terminate at will, and also add the relevant code to insert a result row directly into the transactions table in the load test results database (asynchronously for best performance).

    But that’s awful. It would much easier if the API simply offered a ‘KillTimer’ method.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using MS Test with Visual Studio 2010 to write unit Tests. When
I am writing some unit tests in VS 2010 using Selenium and C#. I
When I create new NUnit unit tests in my test project, the ReSharper Unit
I am writing unit tests in visual studio 2010. For test some functionality, I
I'm setting up some unit tests in VS 2010 using .Net 4.0 using the
I've tried to test SQL Server database stored procedures (write tests like unit) using
I'm using Visual Studio 2010 and created a bunch of unit tests. Here is
We're using TFS 2010 Team Build which automatically runs our unit tests during the
Using Visual Studio 2010, is there a way to run all unit tests in
When writing unit tests, there are cases where one can create an Assert for

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.