Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/eclipse/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何使用groovy更改端点url_Groovy_Soapui - Fatal编程技术网

如何使用groovy更改端点url

如何使用groovy更改端点url,groovy,soapui,Groovy,Soapui,我在测试套件级别使用了下面的 result = com.eviware.soapui.support.UISupport.prompt("Please select the enviornment", "Environment", ['SIT', 'UAT']); 在运行测试套件时,我使用下拉菜单选择一个属性。现在,在选择属性之后,它必须为所有测试用例设置端点URL并执行运行 谢谢每个testStep都有一个endpoint属性,它是为此testStep调用的端点url。如果您想更改testS

我在测试套件级别使用了下面的

result = com.eviware.soapui.support.UISupport.prompt("Please select the enviornment", "Environment", ['SIT', 'UAT']);
在运行测试套件时,我使用下拉菜单选择一个属性。现在,在选择属性之后,它必须为所有测试用例设置端点URL并执行运行


谢谢

每个
testStep
都有一个
endpoint
属性,它是为此
testStep
调用的端点url。如果您想更改
testSuite
中每个
testCase
中每个
testStep
的所有端点,您可以在每个端点之间循环更改此属性。为此,您可以使用groovy
testStep
和以下代码:

def result = com.eviware.soapui.support.UISupport.prompt("Please select the enviornment", "Environment", ['SIT', 'UAT'])
def testcases = testRunner.testCase.testSuite.getTestCaseList()
// for all testCases in your test suite...
testcases.each { testcase ->
    // for all testStep inside testCase...
    def teststeps = testcase.getTestStepList() 
    teststeps.each { teststep ->
        teststep.setPropertyValue('endpoint','http://yourUrl')
    }
}
def result = com.eviware.soapui.support.UISupport.prompt("Please select the enviornment", "Environment", ['SIT', 'UAT'])
def testcases = testSuite.getTestCaseList()
testcases.each { testcase ->
    def teststeps = testcase.getTestStepList() 
    teststeps.each { teststep ->
        teststep.setPropertyValue('endpoint','http://yourUrl')
    }
}
如果您喜欢在
testSuite
上的
Setup脚本中执行相同的操作,您必须稍微更改代码,因为上下文中没有
testrunner
(您可以直接使用
testSuite
var)。因此,如果要将代码放在
设置脚本
中,而不是放在groovy
testStep
中,可以使用以下代码:

def result = com.eviware.soapui.support.UISupport.prompt("Please select the enviornment", "Environment", ['SIT', 'UAT'])
def testcases = testRunner.testCase.testSuite.getTestCaseList()
// for all testCases in your test suite...
testcases.each { testcase ->
    // for all testStep inside testCase...
    def teststeps = testcase.getTestStepList() 
    teststeps.each { teststep ->
        teststep.setPropertyValue('endpoint','http://yourUrl')
    }
}
def result = com.eviware.soapui.support.UISupport.prompt("Please select the enviornment", "Environment", ['SIT', 'UAT'])
def testcases = testSuite.getTestCaseList()
testcases.each { testcase ->
    def teststeps = testcase.getTestStepList() 
    teststeps.each { teststep ->
        teststep.setPropertyValue('endpoint','http://yourUrl')
    }
}

希望这有帮助,

您还可以设置所有
端点
属性,以及
用户名
密码
,如下所示:

  • 打开界面查看器(右键单击界面)
  • 转到“服务端点”选项卡
  • 选择要用于测试会话的端点
  • 单击“分配”,然后选择要分配此端点的位置

快乐测试

您的问题不清楚-您在问什么?我试图做的是使用groovy更改SOAP UI中的端点URL。我想使用“提示”对话框进行更改并选择属性值。选择该属性时,测试套件应运行。