如何使用Groovy从SoapUI TestCase中移除自定义属性? [英] How to remove Custom Properties from a SoapUI TestCase using Groovy?

查看:283
本文介绍了如何使用Groovy从SoapUI TestCase中移除自定义属性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在TestCase下创建了一些属性列表。例如看下面的截图。





我试图通过以下groovy脚本teststep去除 Testcase_Property 属性:

  testRunner.testCase.testSuite.removeProperty(Testcase_Property); 

当我重新加载项目时, Testcase_Property 属性仍然存在于当我点击测试用例名称时,自定义属性标签。



任何人都会向我推荐什么是删除SoapUI中的自定义属性的正确脚本。 / p>

感谢

Karunagara Pandi

解决方案

您也可以使用以下内容:

  data = context.testCase.getTestStepByName(Test Case Name); 

String [] propToRemove = new String [data.getPropertyCount()];
propToRemove = data.getPropertyNames();
for(int i = 0; i< propToRemove.size(); i ++){
data.removeProperty(propToRemove [i]);
}

希望这会有所帮助。
现在您可以移除多个道具。


I have created some list of properties under the TestCase. For example look at the following screenshot.

I tried to remove Testcase_Property property through the following groovy script teststep:

testRunner.testCase.testSuite.removeProperty( "Testcase_Property" );

when I reload the project, the Testcase_Property property is still exist in the Custom Properties tab when I click on the Test case name.

Anyone suggest me what the correct script to remove the custom properties in SoapUI.

Thanks
Karunagara Pandi

解决方案

you can also use the following:

data = context.testCase.getTestStepByName("Test Case Name");

String[] propToRemove = new String[data.getPropertyCount()];
propToRemove = data.getPropertyNames();
for ( int i = 0 ; i < propToRemove.size(); i++ ){
    data.removeProperty( propToRemove[i] );
}

Hope this helps. Now you can remove more than one prop.

这篇关于如何使用Groovy从SoapUI TestCase中移除自定义属性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆