1
我對SoapUI中的所有測試用例都有一些自定義屬性。如何使用java從SOAPUI測試用例中刪除custome屬性?
我能夠使用Groovy腳本的步驟如下問題描述刪除:
How to remove Custom Properties from a SoapUI TestCase using Groovy?
testRunner.testCase.removeProperty("Testcase_Property");
,但我想刪除JAVA這些屬性。下面是我寫的代碼:
String soapuiProjectPath = "ProjectLocation";
WsdlProject project = new WsdlProject(soapuiProjectPath);
StringToObjectMap context = new StringToObjectMap();
TestSuite testSuite = project.getTestSuiteByName("TestSuiteName");
WsdlTestSuite wsdlSuite = (WsdlTestSuite) testSuite;
List<TestCase> allTestCaseList = wsdlSuite.getTestCaseList();
for (TestCase testCase : allTestCaseList) {
WsdlTestCaseRunner testCaseRunner = new WsdlTestCaseRunner((WsdlTestCase) testCase, context);
List<TestProperty> testCasePropertyList = testCase.getPropertyList();
for (TestProperty testProperty : testCasePropertyList) {
WsdlTestRunContext runContext = testCaseRunner.getRunContext();
runContext.removeProperty(testProperty.getName());
}
}
System.out.println("Completed execution.");
project.save();
它沒有拋出任何異常。但是實際上並沒有刪除自定義屬性。
這是工作的罰款。謝謝你的回覆:) – HemaSundar
@HemaSundar很高興幫助你':)' – albciff