soapUI test

declare namespace xmlns='${#Project#host}/TestDirectory/api/v1.0/automationrule/1';
/xmlns:Response/xmlns:automationRule/xmlns:id


<automationRuleReturn>
<status>OK</status>
<automationRule>
<id>1</id>
<buildTargetId>2</buildTargetId>
<buildTargetName>MIPS Linux</buildTargetName>
<deviceSubtypeId>1</deviceSubtypeId>
<priority>5</priority>
<projectId>1</projectId>
<projectName>project</projectName>
<softwareComponentId>1</softwareComponentId>
<softwareComponentName>PRoject MFL/log</softwareComponentName>
<testFolderId>10</testFolderId>
<testFolderName>MFL LOG CI</testFolderName>
<type>CI</type>
</automationRule>
</automationRuleReturn>

1. 判断返回的状态
automationRuleReturn/status
OK

2. 判断返回的ID
automationRuleReturn/automationRule/id
1

3. 判断返回的类型
automationRuleReturn/automationRule/type
CI


<automationRuleReturn>
<errorNumber>INVALID_REQUEST</errorNumber>
<errorText>Create AutomationRule[com.technicolor.project.common.core.exception.InvalidRequestException: Invalid Request: Type cannot be null]</errorText>
<status>NOK</status>
</automationRuleReturn>


1. 错误信息匹配
automationRuleReturn/errorText
Create AutomationRule[com.technicolor.project.common.core.exception.InvalidRequestException: Invalid Request: Type cannot be null]


<Response xmlns="http://10.11.59.83/TestDirectory/api/v1.0/automationrule/1">
<automationRule>
<buildTargetId>2</buildTargetId>
<buildTargetName>MIPS Linux</buildTargetName>
<deviceSubtypeId>1</deviceSubtypeId>
<id>1</id>
<priority>5</priority>
<projectId>1</projectId>
<projectName>project</projectName>
<softwareComponentId>1</softwareComponentId>
<softwareComponentName>project/log</softwareComponentName>
<testFolderId>10</testFolderId>
<testFolderName>MFL LOG CI</testFolderName>
<type>CI</type>
</automationRule>
<status>OK</status>
</Response>

1. 通过命名空间判断返回的状态
declare namespace xmlns='${#Project#host}/TestDirectory/api/v1.0/automationrule/1';
/xmlns:Response/xmlns:status
OK

2. 通过命名空间判断返回的值
declare namespace xmlns='${#Project#host}/TestDirectory/api/v1.0/automationrule/1';
/xmlns:Response/xmlns:automationRule/xmlns:id
1


<Response xmlns="http://10.11.59.83/TestDirectory/api/v1.0/automationrule/1">
<status>OK</status>
</Response>

declare namespace xmlns='${#Project#host}/TestDirectory/api/v1.0/automationrule/1';
/xmlns:Response/xmlns:status
OK


<automationRuleListReturn>
<status>OK</status>
<automationRuleList>
<automationRule>
<id>351</id>
<buildTargetId>10</buildTargetId>
<buildTargetName>SIP Server MP GoLinux</buildTargetName>
<deviceSubtypeId>12</deviceSubtypeId>
<priority>1</priority>
<projectId>16</projectId>
<projectName>CPE_ANT_R8.C.S</projectName>
<softwareComponentId>266</softwareComponentId>
<softwareComponentName>vdnt-s</softwareComponentName>
<testFolderId>100</testFolderId>
<testFolderName>TF 1P2</testFolderName>
<type>OFFICIAL</type>
</automationRule>
<automationRule>
<id>350</id>
<buildTargetId>10</buildTargetId>
<buildTargetName>SIP Server MP GoLinux</buildTargetName>
<deviceSubtypeId>12</deviceSubtypeId>
<priority>1</priority>
<projectId>16</projectId>
<projectName>CPE_ANT_R8.C.S</projectName>
<softwareComponentId>266</softwareComponentId>
<softwareComponentName>vdnt-s</softwareComponentName>
<testFolderId>10</testFolderId>
<testFolderName>MFL LOG CI</testFolderName>
<type>NIGHTLY</type>
</automationRule>
<automationRule>
<id>341</id>
<buildTargetId>23</buildTargetId>
<buildTargetName>vdnt-o</buildTargetName>
<deviceSubtypeId>10</deviceSubtypeId>
<priority>4</priority>
<projectId>13</projectId>
<projectName>Gateway Applications</projectName>
<softwareComponentId>114</softwareComponentId>
<softwareComponentName>vdnt-o</softwareComponentName>
<testFolderId>341</testFolderId>
<testFolderName>CLI_MBUS</testFolderName>
<type>CI</type>
</automationRule>
<automationRule>
<id>15</id>
<buildTargetId>3</buildTargetId>
<buildTargetName>Host Linux</buildTargetName>
<deviceSubtypeId>3</deviceSubtypeId>
<priority>3</priority>
<projectId>2</projectId>
<projectName>Project 2</projectName>
<softwareComponentId>2</softwareComponentId>
<softwareComponentName>Component 1P2</softwareComponentName>
<testFolderId>100</testFolderId>
<testFolderName>TF 1P2</testFolderName>
<type>CI</type>
</automationRule>
<automationRule>
<id>13</id>
<buildTargetId>2</buildTargetId>
<buildTargetName>MIPS Linux</buildTargetName>
<deviceSubtypeId>1</deviceSubtypeId>
<priority>3</priority>
<projectId>2</projectId>
<projectName>Project 2</projectName>
<softwareComponentId>2</softwareComponentId>
<softwareComponentName>Component 1P2</softwareComponentName>
<testFolderId>100</testFolderId>
<testFolderName>TF 1P2</testFolderName>
<type>NIGHTLY_FOR_CI</type>
</automationRule>
<automationRule>
<id>11</id>
<buildTargetId>1</buildTargetId>
<buildTargetName>x86 Linux</buildTargetName>
<deviceSubtypeId>2</deviceSubtypeId>
<priority>3</priority>
<projectId>2</projectId>
<projectName>Project 2</projectName>
<softwareComponentId>2</softwareComponentId>
<softwareComponentName>Component 1P2</softwareComponentName>
<testFolderId>100</testFolderId>
<testFolderName>TF 1P2</testFolderName>
<type>NIGHTLY_FOR_CI</type>
</automationRule>
<automationRule>
<id>14</id>
<buildTargetId>2</buildTargetId>
<buildTargetName>MIPS Linux</buildTargetName>
<deviceSubtypeId>1</deviceSubtypeId>
<priority>3</priority>
<projectId>3</projectId>
<projectName>Project 3</projectName>
<softwareComponentId>2</softwareComponentId>
<softwareComponentName>Component 1P2</softwareComponentName>
<testFolderId>100</testFolderId>
<testFolderName>TF 1P2</testFolderName>
<type>CI</type>
</automationRule>
<automationRule>
<id>12</id>
<buildTargetId>1</buildTargetId>
<buildTargetName>x86 Linux</buildTargetName>
<deviceSubtypeId>2</deviceSubtypeId>
<priority>3</priority>
<projectId>3</projectId>
<projectName>Project 3</projectName>
<softwareComponentId>2</softwareComponentId>
<softwareComponentName>Component 1P2</softwareComponentName>
<testFolderId>100</testFolderId>
<testFolderName>TF 1P2</testFolderName>
<type>CI</type>
</automationRule>
<automationRule>
<id>352</id>
<buildTargetId>2</buildTargetId>
<buildTargetName>MIPS Linux</buildTargetName>
<deviceSubtypeId>1</deviceSubtypeId>
<priority>5</priority>
<projectId>1</projectId>
<projectName>project</projectName>
<softwareComponentId>1</softwareComponentId>
<softwareComponentName>project/log</softwareComponentName>
<testFolderId>100</testFolderId>
<testFolderName>TF 1P2</testFolderName>
<type>NIGHTLY_FOR_CI</type>
</automationRule>
<automationRule>
<id>2</id>
<buildTargetId>1</buildTargetId>
<buildTargetName>x86 Linux</buildTargetName>
<deviceSubtypeId>2</deviceSubtypeId>
<priority>2</priority>
<projectId>1</projectId>
<projectName>project</projectName>
<softwareComponentId>1</softwareComponentId>
<softwareComponentName>project/log</softwareComponentName>
<testFolderId>11</testFolderId>
<testFolderName>MFL LOG QA</testFolderName>
<type>NIGHTLY_FOR_CI</type>
</automationRule>
<automationRule>
<id>355</id>
<buildTargetId>10</buildTargetId>
<buildTargetName>SIP Server MP GoLinux</buildTargetName>
<deviceSubtypeId>12</deviceSubtypeId>
<priority>1</priority>
<projectId>10</projectId>
<projectName>project Sync Rallydev</projectName>
<softwareComponentId>266</softwareComponentId>
<softwareComponentName>vdnt-s</softwareComponentName>
<testFolderId>20000</testFolderId>
<testFolderName>Test Folder For Performance</testFolderName>
<type>CI</type>
</automationRule>
</automationRuleList>
</automationRuleListReturn>

1. 对多个item下面的节点进行判断其存在
exists(automationRuleListReturn/automationRuleList/automationRule[1]/buildTargetId)
true

exists(automationRuleListReturn/automationRuleList/automationRule[1]/priority)
true


<Response xmlns="http://10.11.59.83/TestDirectory/api/v1.0/automationrule">
<automationRuleList>
<automationRule>
<e>
<buildTargetId>10</buildTargetId>
<buildTargetName>SIP Server MP GoLinux</buildTargetName>
<deviceSubtypeId>12</deviceSubtypeId>
<id>350</id>
<priority>1</priority>
<projectId>16</projectId>
<projectName>CPE_ANT_R8.C.S</projectName>
<softwareComponentId>266</softwareComponentId>
<softwareComponentName>vdnt-s</softwareComponentName>
<testFolderId>10</testFolderId>
<testFolderName>MFL LOG CI</testFolderName>
<type>NIGHTLY</type>
</e>
<e>
<buildTargetId>10</buildTargetId>
<buildTargetName>SIP Server MP GoLinux</buildTargetName>
<deviceSubtypeId>12</deviceSubtypeId>
<id>351</id>
<priority>1</priority>
<projectId>16</projectId>
<projectName>CPE_ANT_R8.C.S</projectName>
<softwareComponentId>266</softwareComponentId>
<softwareComponentName>vdnt-s</softwareComponentName>
<testFolderId>100</testFolderId>
<testFolderName>TF 1P2</testFolderName>
<type>OFFICIAL</type>
</e>
<e>
<buildTargetId>23</buildTargetId>
<buildTargetName>vdnt-o</buildTargetName>
<deviceSubtypeId>10</deviceSubtypeId>
<id>341</id>
<priority>4</priority>
<projectId>13</projectId>
<projectName>Gateway Applications</projectName>
<softwareComponentId>114</softwareComponentId>
<softwareComponentName>vdnt-o</softwareComponentName>
<testFolderId>341</testFolderId>
<testFolderName>CLI_MBUS</testFolderName>
<type>CI</type>
</e>
<e>
<buildTargetId>3</buildTargetId>
<buildTargetName>Host Linux</buildTargetName>
<deviceSubtypeId>3</deviceSubtypeId>
<id>15</id>
<priority>3</priority>
<projectId>2</projectId>
<projectName>Project 2</projectName>
<softwareComponentId>2</softwareComponentId>
<softwareComponentName>Component 1P2</softwareComponentName>
<testFolderId>100</testFolderId>
<testFolderName>TF 1P2</testFolderName>
<type>CI</type>
</e>
<e>
<buildTargetId>2</buildTargetId>
<buildTargetName>MIPS Linux</buildTargetName>
<deviceSubtypeId>1</deviceSubtypeId>
<id>13</id>
<priority>3</priority>
<projectId>2</projectId>
<projectName>Project 2</projectName>
<softwareComponentId>2</softwareComponentId>
<softwareComponentName>Component 1P2</softwareComponentName>
<testFolderId>100</testFolderId>
<testFolderName>TF 1P2</testFolderName>
<type>NIGHTLY_FOR_CI</type>
</e>
<e>
<buildTargetId>1</buildTargetId>
<buildTargetName>x86 Linux</buildTargetName>
<deviceSubtypeId>2</deviceSubtypeId>
<id>11</id>
<priority>3</priority>
<projectId>2</projectId>
<projectName>Project 2</projectName>
<softwareComponentId>2</softwareComponentId>
<softwareComponentName>Component 1P2</softwareComponentName>
<testFolderId>100</testFolderId>
<testFolderName>TF 1P2</testFolderName>
<type>NIGHTLY_FOR_CI</type>
</e>
<e>
<buildTargetId>2</buildTargetId>
<buildTargetName>MIPS Linux</buildTargetName>
<deviceSubtypeId>1</deviceSubtypeId>
<id>14</id>
<priority>3</priority>
<projectId>3</projectId>
<projectName>Project 3</projectName>
<softwareComponentId>2</softwareComponentId>
<softwareComponentName>Component 1P2</softwareComponentName>
<testFolderId>100</testFolderId>
<testFolderName>TF 1P2</testFolderName>
<type>CI</type>
</e>
<e>
<buildTargetId>1</buildTargetId>
<buildTargetName>x86 Linux</buildTargetName>
<deviceSubtypeId>2</deviceSubtypeId>
<id>12</id>
<priority>3</priority>
<projectId>3</projectId>
<projectName>Project 3</projectName>
<softwareComponentId>2</softwareComponentId>
<softwareComponentName>Component 1P2</softwareComponentName>
<testFolderId>100</testFolderId>
<testFolderName>TF 1P2</testFolderName>
<type>CI</type>
</e>
<e>
<buildTargetId>2</buildTargetId>
<buildTargetName>MIPS Linux</buildTargetName>
<deviceSubtypeId>1</deviceSubtypeId>
<id>352</id>
<priority>5</priority>
<projectId>1</projectId>
<projectName>project</projectName>
<softwareComponentId>1</softwareComponentId>
<softwareComponentName>project/log</softwareComponentName>
<testFolderId>100</testFolderId>
<testFolderName>TF 1P2</testFolderName>
<type>NIGHTLY_FOR_CI</type>
</e>
<e>
<buildTargetId>1</buildTargetId>
<buildTargetName>x86 Linux</buildTargetName>
<deviceSubtypeId>2</deviceSubtypeId>
<id>2</id>
<priority>2</priority>
<projectId>1</projectId>
<projectName>project</projectName>
<softwareComponentId>1</softwareComponentId>
<softwareComponentName>project/log</softwareComponentName>
<testFolderId>11</testFolderId>
<testFolderName>MFL LOG QA</testFolderName>
<type>NIGHTLY_FOR_CI</type>
</e>
<e>
<buildTargetId>10</buildTargetId>
<buildTargetName>SIP Server MP GoLinux</buildTargetName>
<deviceSubtypeId>12</deviceSubtypeId>
<id>355</id>
<priority>1</priority>
<projectId>10</projectId>
<projectName>project Sync Rallydev</projectName>
<softwareComponentId>266</softwareComponentId>
<softwareComponentName>vdnt-s</softwareComponentName>
<testFolderId>20000</testFolderId>
<testFolderName>Test Folder For Performance</testFolderName>
<type>CI</type>
</e>
</automationRule>
</automationRuleList>
<status>OK</status>
</Response>


1. XPath Match Configuration 通过节点判断返回值
declare namespace xmlns='${#Project#host}/TestDirectory/api/v1.0/automationrule';
/xmlns:Response/xmlns:status
OK


<html>
<head>
<meta content="HTML Tidy for Java (vers. 27 Sep 2004), see www.w3.org" name="generator"/>
<title>Apache Tomcat/7.0.32 - Error report</title>
<style type="text/css"><!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-

family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-

color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-

serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name

{color : black;}HR {color : #525D76;}--></style>
</head>
<body>
<h1>HTTP Status 404 - Not Found</h1>
<hr noshade="noshade" size="1"/>
<p>
<b>type</b>
Status report
</p>
<p>
<b>message</b>
<u>Not Found</u>
</p>
<p>
<b>description</b>
<u>The requested resource is not available.</u>
</p>
<hr noshade="noshade" size="1"/>
<h3>Apache Tomcat/7.0.32</h3>
</body>
</html>

1. Valid HTTP status codes Assertion判断返态
404


Property transfer: see the screenshot


[img]http://dl2.iteye.com/upload/attachment/0081/6195/2d34f941-9d77-3124-86a5-e8dcb9f540b2.bmp[/img]


[img]http://dl2.iteye.com/upload/attachment/0081/6197/7e94d357-899d-330e-96b4-17f78ca77f9a.bmp[/img]


[img]http://dl2.iteye.com/upload/attachment/0081/6199/1fcf4171-dd20-3941-ab3b-3ed48c39dc5a.bmp[/img]

[img]http://dl2.iteye.com/upload/attachment/0081/6201/d628ec5c-826b-38dd-a0be-3f96030ad6bf.bmp[/img]

[img]http://dl2.iteye.com/upload/attachment/0081/6203/530e6289-9e20-3981-8374-1c6a3068e750.bmp[/img]

[img]http://dl2.iteye.com/upload/attachment/0081/6205/34c72d0b-1b98-31fe-a9fa-37b9d870fa9f.bmp[/img]

[img]http://dl2.iteye.com/upload/attachment/0081/6207/17b27ef6-0370-3db9-ba08-2e8586258fea.bmp[/img]
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
在Java中,可以使用SOAPUI工具进行动态解析。SOAPUI是一款功能强大的开源Web服务测试工具,可以用于创建、执行和验证SOAP和REST接口。 首先,我们需要导入必要的依赖包,以便在Java中使用SOAPUI的功能。可以通过将SOAPUI的JAR文件添加到项目的classpath中来实现这一点。 然后,我们可以使用SOAPUI提供的API来动态解析SOAP消息。可以通过以下步骤实现此目的: 1. 创建一个SOAP项目:使用SOAPUI工具创建一个SOAP项目,其中包含要解析的SOAP消息。 2. 加载项目:在Java代码中,可以使用SOAPUI的API加载项目。可以使用`WSDLProject`类来加载项目,通过指定项目文件的路径或URL来进行加载。 3. 获取测试套件和测试用例:在加载了项目后,可以使用SOAPUI的API获取项目中的测试套件和测试用例。可以使用`TestSuite`和`TestCase`类来获取这些对象。 4. 获取请求和响应:在测试用例中,可以使用SOAPUI的API来获取请求和响应对象。可以使用`TestRequest`类来获取这些对象。 5. 解析SOAP消息:可以使用SOAPUI的API来解析SOAP消息。可以使用`WSDLTestRequestStep`类的`getMessageExchange()`方法来获取消息交换对象,然后使用`requestContent`和`responseContent`属性来获取请求和响应的内容。 6. 解析SOAP消息的内容:可以使用Java的XML解析器来解析SOAP消息的内容。可以使用DOM解析器,SAX解析器或StAX解析器来解析XML内容。 通过以上步骤,我们可以在Java中使用SOAPUI工具进行动态解析。可以根据具体的需求来操作SOAP消息的内容,并获取所需的数据。 总的来说,通过使用SOAPUI工具和相应的Java API,我们可以方便地对SOAP消息进行动态解析,并获取其中的内容。这对于进行Web服务测试和数据提取非常有用。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值