CustomChannelsTester

CustomChannelsTester è uno strumento che può essere utilizzato per testare le implementazioni del canale personalizzato in un insieme di contratti di servizio predefiniti. È possibile selezionare il set di contratti di servizio e passarlo allo strumento utilizzando un file XML. Lo strumento genera quindi il servizio e il client che esercitano le implementazioni del canale personalizzate durante lo scambio di messaggi.

Per compilare lo strumento

  1. Per compilare la soluzione, seguire le istruzioni in Generazione degli esempi Windows Communication Foundation.

  2. La compilazione della soluzione genera tre file: CustomChannelsTester.exe, TestSpec.xml e SampleRun.cmd. File SampleRun.cmd ha una riga di comando di esempio che mostra come utilizzare questo strumento per testare l'esempio Trasporto UDP.

Per eseguire lo strumento

  • Al prompt dei comandi digitare il comando seguente:

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

    L'utilizzo dell'opzione /binding è obbligatorio.

    /dll è obbligatorio se l'"associazione" non è fornita dal sistema fornita da Windows Communication Foundation (WCF).

    /testspec è facoltativo.

    Crea server e client basati sulle specifiche del test e sull'associazione.

    Esegue il client e il server e restituisce i risultati.

    Di seguito è riportato l'esempio XML della descrizione delle specifiche del test (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>
    

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