Partager via


CustomChannelsTester

Download sample

The CustomChannelsTester is a tool that you can use to test your custom channel implementations against a set of predefined service contracts. You can select the set of service contracts and pass it to the tool using an XML file. The tool then generates the service and client that exercises your custom channel implementations during message exchange.

To build the tool

  1. To build the solution, follow the instructions in Building the Windows Communication Foundation Samples.

  2. Building the solution generates three files: CustomChannelsTester.exe, TestSpec.xml and SampleRun.cmd. The file SampleRun.cmd has a sample command line that shows how to use this tool to test the Transport: UDP sample.

To run the tool

  • At the command prompt type the following command:

    CustomChannelsTester.exe /binding:YourCustomBindngName /dll:TheAssemblyWhereThisTypeisDefined /testspec:XmlFileNameWhichContainsTestOptions
    

    Using the /binding option is required.

    /dll is required if "binding" is not a system-provided binding provided by Windows Communication Foundation (WCF).

    /testspec is optional.

    This creates server and clients based on the test specifications and the binding.

    Executes the client and server and returns the results.

    The following is the sample XML for the description of the test specifications (testspec.xml):

    <TestSpec xmlns="http://WCF/TestSpec" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
    <ServiceContract>
    <!-- Test a contract which has oneway / twoway operations. If you set ExpandAll = true, both types of contracts are tested -->    <IsOneWay ExpandAll="true">true</IsOneWay>
    <!-- Test a contract with Asynchronous / Synchronous Operations-->
        <IsAsync>false</IsAsync> 
    <!-- Test a sessionful / sessionless contract-->    
        <IsSession ExpandAll="true">true</IsSession>
    <!-- If the Service Contract includes a CallBack Contract-->    
        <IsCallBack ExpandAll="true">true</IsCallBack>
    </ServiceContract>
    <TestDetails>
    <!-- Name of the machine that runs the server - required if you want to run the test crossmachine-->
        <ServerName>ReplaceThisWithTheServerMachineName</ServerName>
    <!-- Port Number - Optional-->
        <Port>8000</Port>
    <!--URI for the callBack address for the CLient. The client will receive the messages from the server on this address in case of a CallBack Contract-->
        <ClientCallBackAddress/>    
    <!-- Duration (in sec) after the server has started, it times out - optional(default = 300sec) -->
        <ServerTimeout>300</ServerTimeout>
    <!-- Duration (in sec) before the Client initializes -optional(default = 60sec) -->
        <ClientTimeout>60</ClientTimeout>
    <!-- Number of clients for each service - optional(default = 1) -->
        <NumberOfClients>1</NumberOfClients>
    <!-- Number of messages each client sends to the service - optional(default = 1) -->
        <MessagesPerClient>1</MessagesPerClient>
    </TestDetails>
    </TestSpec>
    

Footer image

Send comments about this topic to Microsoft.
© Microsoft Corporation. All rights reserved.