Testing Web Services

  1. Create a Silk Performer .NET project. Create a project either from within Silk Performer (Project type: Web Services/.NET) or create a new .NET project by launching the Silk Performer Project Wizard from Visual Studio .NET (File > New > Project).
  2. Create a WebService client proxy. Use the Visual Studio .NET Web Service Client Proxy Wizard to generate a client proxy class:
    1. Call Add Web Reference.
    2. Insert the URL to your Web service in the Address field.
    3. Click Add Reference. A proxy class is then generated with the name of your WebService. Namespace is the name of the Web server where the service is hosted. If your URL is, for example, http://localhost/MyWebService/Service1.asmx then the full name of your proxy class would be localhost.Service1.
  3. Code your WebService calls. Instantiate an object of your proxy class and then make calls to the service in one of your transactions. A good design decision would be to define the proxy as a member variable of your test class, instantiate it in your init transaction and make calls in your main transaction. Example (C#):
    using System;
    using Silk Performer;
    namespace SPProject1
    {
    [VirtualUser("VUser")]
    public class VUser
    {
    public localhost.Service1 mService;
    
    public VUser()
    {
    }
    
    [Transaction(ETransactionType.TRANSTYPE_INIT)]
    public void TInit()
    {
    mService = new localhost.Service1();
    }
    
    [Transaction(ETransactionType.TRANSTYPE_MAIN)]
    public void TMain()
    {
    int nRetParam = mService.ServiceCall1("Testparam");
    Bdl.Print("Return value of ServiceCall1: " +
    nRetParam.ToString());
    mService.ServiceCall2(nRetParam);
    }
    
    [Transaction(ETransactionType.TRANSTYPE_END)]
    public void TEnd()
    {
    }
    }
    }
  4. Run a TryScript.

    Initiate a Try Script run by calling Silk Performer/Try Script or by pressing the F8 key.The return value is output into the Virtual User Output Window via the Bdl.Print method.

    In the TrueLog, two nodes in the main transaction represent the SOAP HTTP traffic that was responsible for the Web service calls. By default all HTTP traffic is redirected over the Silk Performer Web Engine; therefore output is available in the TrueLog. You can turn off redirection or enable it for specific Web service client proxy classes using the Web Settings dialog.

  5. Continue working in Silk Performer. When you have finished implementing your .NET test driver, you can continue working in Silk Performer and running load tests. With Silk Performer you can run load tests with multiple users distributed over multiple agents. Take advantage of the Web engine features (modem simulation, IP-address multiplexing, etc.) by testing how Web service calls perform when they are called over a slow modem and how your Web server performs when numerous users make service calls simultaneously.