Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/silverlight/4.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 SoapUI:当我使用Testrunner运行所有测试时,为什么项目属性没有更新_Groovy_Soapui - Fatal编程技术网

Groovy SoapUI:当我使用Testrunner运行所有测试时,为什么项目属性没有更新

Groovy SoapUI:当我使用Testrunner运行所有测试时,为什么项目属性没有更新,groovy,soapui,Groovy,Soapui,当我使用LaunchTestRunner运行项目中的所有测试时,我在SoapUI中更新项目属性时遇到一些问题 我有两个带有测试的测试套件。所有测试用例都有第一步-groovy脚本。此脚本在所有测试用例中都是相同的: Integer curIdAndKey = new Integer (testRunner.testCase.testSuite.project.getPropertyValue( "IdAndKey" )) Boolean curBool = new Boolean (testRu

当我使用LaunchTestRunner运行项目中的所有测试时,我在SoapUI中更新项目属性时遇到一些问题

我有两个带有测试的测试套件。所有测试用例都有第一步-groovy脚本。此脚本在所有测试用例中都是相同的:

Integer curIdAndKey = new Integer (testRunner.testCase.testSuite.project.getPropertyValue( "IdAndKey" ))
Boolean curBool = new Boolean (testRunner.testCase.testSuite.project.getPropertyValue( "bool" ))
Integer curTestsCount =new Integer( testRunner.testCase.testSuite.project.getPropertyValue( "countOfTests" ))
if(curBool==false){
    curBool=true
    curIdAndKey= curIdAndKey*curTestsCount
}
else {
    curIdAndKey += 1
}

testRunner.testCase.setPropertyValue("aIdCase", curIdAndKey.toString())
testRunner.testCase.testSuite.project.setPropertyValue("bool", curBool.toString())
testRunner.testCase.testSuite.project.setPropertyValue("IdAndKey", curIdAndKey.toString())
log.info "Current Id : [$curIdAndKey]"
log.info "Current bool : [$curBool]"
我有一个项目属性:IdAndKey和bool。 当我运行单个TestCase时-此项目属性正在更新,但当我运行所有测试时,它们没有更新,我只在日志中看到更新,而在属性中看不到更新。
请帮帮我。

启动TestRunner窗口的“基本”选项卡下的一个选项是:在之后保存。选择此选项并按启动。您会注意到,链接的复制文章中讨论的-S开关被添加到命令行中,该命令行显示在下一个窗口中


其他讨论虽然过时,但仍在中。

请尝试使用以下内容:

def globalProps = context.testRunner.testCase.testSuite.project;
globalProps.setPropertyValue("aIdCase", curIdAndKey.toString());

让我知道它是否有效。

这里已经回答了:不,不一样。我需要从SoapUI运行测试,而不是从命令行。。。使用LaunchTestRunner。那是一样的!我的项目属性IdAndKey是相同的,它的更改仅在日志中可见,但在测试运行后,它的值相同:关闭并打开项目。谢谢,它可以工作,但有没有其他方法不关闭和打开项目?您所做的听起来不像正常的工作流。如果你能描述一下你想要完成的是什么。在我的例子中,它是有效的,我还使用了一些全局性的道具,我将它们保存在项目的道具中。