简体   繁体   English

如何使用Java获取SoapUI TestStep的API端点

[英]How to get the API Endpoint of a SoapUI TestStep using Java

I would like to know how to get the API end point of a TestStep in SoapUI Xml using Java. 我想知道如何使用Java在SoapUI Xml中获得TestStep的API端点。 SoapUI图片

I have used the following, 我已经使用了以下内容,

        for (int i=0; i<numberOfTestSteps; i++) {
                WsdlTestStep testStep = testCase.getTestStepAt(i);

                WsdlTestCaseRunner runner = new WsdlTestCaseRunner(testCase, new StringToObjectMap());
                runner.runTestStep(testStep);

                List<TestStepResult> resultList = runner.getResults();
                for (TestStepResult result : resultList) {
        String endPoint = ((MessageExchange)result).getEndpoint();
        System.out.println("End Point = " + endPoint);
    }
}

It only gives "www.test.com:8080". 它仅给出“ www.test.com:8080”。 But I need the API end point as in the image. 但是我需要如图所示的API端点。

Please someone help me to solve this. 请有人帮我解决这个问题。

Below should give you what you are looking for: 以下应为您提供所需的信息:

String resourcePath = ((MessageExchange)result).getResource().getFullPath();
System.out.println("Resource Path = " + resourcePath);

You may look at respective SoapUI's API 您可以查看各自的SoapUI的API

There is very simply way too if you wish to show that value from with SoapUI Project itself. 如果您希望通过SoapUI Project本身展示其价值,也有非常简单的方法。

In the test case, there might be a REST Request Test step type. 在测试用例中,可能存在“ REST Request测试”步骤类型。 Add a Script Assertion as shown below: 添加脚本声明 ,如下所示:

log.info messageExchange.endpoint

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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