QTP测试WCF Web服务

3

我想使用QTP的WebServices添加组件来自动化测试WCF Web服务(通过TCP)。然而,当我指定WSDL文件的路径时,它会给我报错。是否有人尝试过使用QTP?或者有其他工具可以用于测试吗?

3个回答

2
据我所知,QTP无法用于测试使用NetTcpBinding的WCF服务。它们应该使用普通的BasicHttpBinding才能正常工作。

1

当我调用Web服务时,我为QTP指定了3个必需参数,然后是实际Web服务的参数。这总是有效的(除非Web服务没有运行)

以下是一个示例:

'=============================================================================
' Define WebService
qtpP1 = "wsdl:=http://172.16.69.84:8080/testframeworkwebapp/services/STFSQLExecutionService?WSDL"
' Define service & port
qtpP2 = "service:=GenericSQLExecutorService"
qtpP3= "port:=STFSQLExecutionService"
' Define Webservice calling parameters
wsP1 = "Select Count(*) From PERSON_TABLE"

'====================================================================
' Call to the WebService
executeSQLByDBName = WebService(qtpP1, qtpP2, qtpP3).executeSQLByDBName(wsP1)

If WebService(qtpP1, qtpP2, qtpP3).GetLastError > "" Then
  MsgBox "WebService Issue"
Else
  MsgBox "WebServices Call Worked OK"
End If
'====================================================================

0
你可以使用QEngine。这是测试你的WCF和其他类型服务的好方法。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接