0

I have written a webtest that calls a webservice:

 public class Settings_CacheExplosion : WebTest
{
    //private static readonly ILog activityLog = LogManager.GetLogger("Activity"); 

    private static int _ctidsCounter { get; set; }

    public static int CtidsCounter
    {
        get
        {
            if (_ctidsCounter == 2000)
            {
                _ctidsCounter = 1000;
            }
            return _ctidsCounter++;
        }
        set
        {
            _ctidsCounter = value;
        }
    }

    public Settings_CacheExplosion()
    {
        this.PreAuthenticate = true;

        CtidsCounter = 1000;

        //log4net.Config.XmlConfigurator.Configure();
    }


    public override IEnumerator<WebTestRequest> GetRequestEnumerator()
    {
        WebTestRequest request1 = new WebTestRequest("http://clientservice.mam.qasite-services.com/settings");

        request1.Method = "POST";

        Debug.WriteLine(string.Format("ctid={0}", CtidsCounter));

        request1.QueryStringParameters.Add("ctid", CtidsCounter.ToString(), false, false);
        StringHttpBody request1Body = new StringHttpBody();
        request1Body.ContentType = "";
        request1Body.InsertByteOrderMark = false;
        request1Body.BodyString = "";
        request1.Body = request1Body;

        yield return request1;
        request1 = null;
    }
}

I hvae created a load test with test mix: 100% the above webtest

in the load test wizard I have allocated 1000 users (constant).

I set the test to run based on the number of virtual users.

And yet, the load test finishes after 2 seconds.

I the summary I see the above test was executed only 100 times.

What could have caused it?

btw, I tried to watch the requests table but it includes only one row.

How can I see all the made requests?

cuongle
  • 74,024
  • 28
  • 151
  • 206
Elad Benda
  • 35,076
  • 87
  • 265
  • 471
  • Somewhat unrelated to your question, but why did you make your `_ctidsCounter` a property instead of just a field? Also what's the reason to reset it to 1000 when it reaches 2000? I'd think `private static int _ctidsCounter` and `public static int CtidsCounter { get { return _ctidsCounter++; } }` would be enough. – Heki Nov 06 '12 at 09:42
  • for the second question - it's related to range of ids I want to get from the DB – Elad Benda Nov 06 '12 at 09:44
  • for you first question, it's always a good practive to use properties. see :http://stackoverflow.com/questions/2903235/auto-implemented-properties-c-sharp – Elad Benda Nov 06 '12 at 09:46
  • I know, but exposing a property with another property seems overkill to me, that's all :) – Heki Nov 06 '12 at 09:47
  • not sure what's `GetRequestEnumerator`. how do i get to it? – Elad Benda Nov 06 '12 at 09:48
  • The method that you override in your code. I don't really know anything about `WebTest`. But I'd assume you'll have to override `EndLoop` or `EndCondition`. I'm just taking wild guesses here. – Heki Nov 06 '12 at 10:11
  • @Heki I think my problem is having a proper loop at the load test level, not the web test level – Elad Benda Nov 06 '12 at 12:02

0 Answers0