简体   繁体   中英

How to Execute two services sequential using c# automation framework(Using technologies C#, NUnit, Specflow)

I have two automation projects in c#, which includes two services automation scenarios. 1. Export Service: it generates files that need to be translated by other service. 2. Translation Service : it will translate files generated by above service.

I need help how I can run test scenarios of both services sequentially means export services scenarios will execute first then after Translation Service scenarios will execute. Please help on this . Thanks In advance.

You can use ChannelFactory class and synchronous calls:

    public static void MakeSequentialCalls1()
    {
        var fact = new ChannelFactory<IFileProcessor>("processorEndpoint");
        var processorProxy = fact.CreateChannel();

        var fact2 = new ChannelFactory<IFileTranslator>("translatorEndpoint");
        var translatorProxy = fact2.CreateChannel();

        var file = processorProxy.GetFile();
        var translatedFile = translatorProxy.Translate(file, "En");

        ProcessResult(translatedFile);

        ((IClientChannel)processorProxy).Close();
        ((IClientChannel)translatorProxy).Close();
    }

感觉方案2应该包括方案1步骤或执行方案1的捷径。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM