Stub method for Customization

May 31, 2010 at 1:21 PM

Hi all,

I got a question regarding customization methods that are generated and included into each wcf service call:

Contracts.AddRequest request = new Contracts.AddRequest();
request.A = 10;
request.B = 5;
this.CustomiseAdd(request); //Parameters are sent to a stub method for customisation so that they can be randomised for load tests. Value and string parameters are passed as ref.

_testContext.BeginTimer("WCFTest1_Add");
try
{
    return arithmeticClient.Add(request);
}
finally
{
    _testContext.EndTimer("WCFTest1_Add");
}

Is there any setting in code generator that might turn these off? This tool is quite useful for creating and running load test scenarios , however the need either to implement all generated Custom methods or delete calls to them from each service call is making this tool not so user-friendly and usable.

 

Regards,

Allexey

Coordinator
Jun 1, 2010 at 7:38 AM

Unfortunately there is no switch to turn this off. However you do have the source code, so you could remove this yourself if you like. I have added this to my to-do list, but I cannot say when I will get to it.

I am curious though why this causes you a problem, except in a couple of edge cases the stub methods always work as generated. Do you re-generate the same scenario multiple times? If so then perhaps the easiest thing to do is to use the newly generated stubs file each time (just copying the the proxy setup code each time). I am also curious though as to whether or not you actually use the stubs. If not, how do you manage to generate a load test that is representative of real-world traffic with varied data in the requests?

Regards

Rob

Jun 1, 2010 at 7:58 AM

Hi Rob,

thank for your reply.

The problem with generated custom method is that all of them are generated with 'ref' parameters, thus generated code even does not compile, saying that all parameters with ref should be initialized before leaving method body.

Our load scenarios might contain about a hundred calls, so we will need to go through all hundred methods to remove calls to custom methods. 

And we cannot implement custom methods to re-use them later just because for each service call unique method is generated (like having 10 calls to GetSmth() even with same input there will be 10 separate calls called GetSmth0(), GetSmth1() etc.). And of course, for different scenarios GetSmth0() and GetSmth0() will differ.

Both cases can be used, however this assumes huge amount of hand work.

 

Regards,

Allexey

Coordinator
Jun 1, 2010 at 8:48 AM

I'll take a closer look to see if there is something I can do to at least make the code compile for you without having to make changes by hand.

Jun 1, 2010 at 10:05 AM

Great thanx,

really looking forward to these changes.

Coordinator
Jun 11, 2010 at 9:45 AM

Can you post the generated code from a sample method call which shows the problem with ref paramters. I am curious to see both the stub method and the method that calls the stub method. Please post the code as generated by the tool, before you make any modifications.

Regards

Rob

Jun 14, 2010 at 4:02 PM

Code in WCFTest1.cs:
        private System.Collections.ObjectModel.ObservableCollection<PlugIn> GetPlugins()
        {
            string name = null;
            System.Nullable<System.DateTime> from = null;
            this.CustomiseGetPlugins(ref name, out from);
            _testContext.BeginTimer("WCFTest1_GetPlugins");
            try
            {
                return ieClient.GetPlugins(name, from);
            }
            finally
            {
                _testContext.EndTimer("WCFTest1_GetPlugins");
            }
        }
and method in "WCFTest1 Custom.cs":
        private void CustomiseGetPlugins(ref string name, out System.Nullable<System.DateTime> from)
        {
        }

the last one throws exception that "name" should be initialized prior to leaving CustomiseGetPlugins() body.

Regards,
allexey

Aug 20, 2010 at 7:01 AM

Hii Rob,

I want to use Wcf Load Test Tool, however I need to adept this tool to our framework standards. I can do it manuely but its too expensive way for me. You said that "Unfortunately there is no switch to turn this off. However you do have the source code, so you could remove this yourself if you like", But I don't  see source code. How can I take source code?

Best Regards,

Firat

Coordinator
Sep 1, 2010 at 7:55 AM

Sorry for the delayed reply. I am sure one of the downloads has the sources. If not I will be releasing a new version in the next week or so and I will put the sources in there too.

Regards

Rob