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

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

问题描述

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

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

我尝试通过以下常规脚本 teststep 删除 Testcase_Property 属性:

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

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

当我重新加载项目时,当我单击测试用例名称时,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.

任何人都建议我删除 SoapUI 中的自定义属性的正确脚本.

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

谢谢
Karunagara Pandi

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 测试用例中删除自定义属性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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