51Testing软件测试论坛

 找回密码
 (注-册)加入51Testing

QQ登录

只需一步,快速开始

微信登录,快人一步

手机号码,快捷登录

查看: 4629|回复: 6
打印 上一主题 下一主题

[原创] 关于webservice的测试

[复制链接]

该用户从未签到

跳转到指定楼层
1#
发表于 2007-8-17 19:23:31 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
我用的是LR8.1 + FP4,协议为 sap里选择 webservice + web(http/html)
加载了wsdl文件,wsdl文件内容如下:
<?xml version="1.0" encoding="UTF-8"?>
<!-- V1.2,  2007/07/11 11:19  -->
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
        xmlns:tns="http://www.dvnchina.com/itv/portal/sso/stb"
        xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
        xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="stbssorpc"
        targetNamespace="http://www.dvnchina.com/itv/portal/sso/stb">

        <wsdl:types>
                <xsd:schema
                        xmlns:tns="http://www.dvnchina.com/itv/portal/sso/stb"
                        targetNamespace="http://www.dvnchina.com/itv/portal/sso/stb">

                        <xsd:complexType name="Metadata">
                                <xsd:sequence>
                                        <xsd:element name="name" type="xsd:string" />
                                        <xsd:element name="value" type="xsd:string" />
                                </xsd:sequence>
                        </xsd:complexType>

                        <xsd:complexType name="StartLoginRequest">
                                <xsd:sequence>
                                        <xsd:element name="UserId" type="xsd:string" />
                                </xsd:sequence>
                        </xsd:complexType>
                        <xsd:complexType name="StartLoginResponse">
                                <xsd:sequence>
                                        <xsd:element name="MatchResult" type="xsd:short" />
                                        <xsd:element name="LoginToken" type="xsd:string"
                                                minOccurs="0" />
                                </xsd:sequence>
                        </xsd:complexType>


                        <xsd:complexType name="LoginRequest">
                                <xsd:sequence>
                                        <xsd:element name="UserId" type="xsd:string" />
                                        <xsd:element name="KeysMD5" type="xsd:string" />
                                        <xsd:element name="StbMac" type="xsd:string" />
                                        <xsd:element name="Metadata" type="tns:Metadata"
                                                minOccurs="0" maxOccurs="unbounded" />
                                </xsd:sequence>
                        </xsd:complexType>
                        <xsd:complexType name="LoginResponse">
                                <xsd:sequence>
                                        <xsd:element name="MatchResult" type="xsd:short" />
                                        <xsd:element name="PortalURL" type="xsd:string"
                                                minOccurs="0" />
                                        <xsd:element name="CMAURL" type="xsd:string"
                                                minOccurs="0" />
                                        <xsd:element name="ServiceGroupFrequency"
                                                type="xsd:string" minOccurs="0" />
                                        <xsd:element name="HeartbeatIP" type="xsd:string"
                                                minOccurs="0" />
                                        <xsd:element name="HeartbeatPort" type="xsd:short"
                                                minOccurs="0" />
                                        <xsd:element name="HeartbeatTime" type="xsd:short"
                                                minOccurs="0" />
                                        <xsd:element name="HeartbeatWaitTime"
                                                type="xsd:short" minOccurs="0" />
                                        <xsd:element name="HeartbeatRepeatTimes"
                                                type="xsd:short" minOccurs="0" />
                                        <xsd:element name="Metadata" type="tns:Metadata"
                                                minOccurs="0" maxOccurs="unbounded" />
                                </xsd:sequence>
                        </xsd:complexType>

                        <xsd:complexType name="LogoutRequest">
                                <xsd:sequence>
                                        <xsd:element name="UserId" type="xsd:string" />
                                        <xsd:element name="LoginToken" type="xsd:string" />
                                </xsd:sequence>
                        </xsd:complexType>
                        <xsd:complexType name="LogoutResponse">
                                <xsd:sequence>
                                        <xsd:element name="MatchResult" type="xsd:short" />
                                </xsd:sequence>
                        </xsd:complexType>

                </xsd:schema>
        </wsdl:types>

        <wsdl:message name="StartLoginRequest">
                <wsdl:part name="StartLoginRequest"
                        type="tns:StartLoginRequest" />
        </wsdl:message>
        <wsdl:message name="StartLoginResponse">
                <wsdl:part name="StartLoginResponse"
                        type="tns:StartLoginResponse" />
        </wsdl:message>

        <wsdl:message name="LoginRequest">
                <wsdl:part name="LoginRequest" type="tns:LoginRequest" />
        </wsdl:message>
        <wsdl:message name="LoginResponse">
                <wsdl:part name="LoginResponse" type="tns:LoginResponse" />
        </wsdl:message>

        <wsdl:message name="LogoutRequest">
                <wsdl:part name="LogoutRequest" type="tns:LogoutRequest" />
        </wsdl:message>
        <wsdl:message name="LogoutResponse">
                <wsdl:part name="LogoutResponse" type="tns:LogoutResponse" />
        </wsdl:message>



        <wsdl:portType name="stbssorpc">
                <wsdl:operation name="StartLogin">
                        <wsdl:input message="tns:StartLoginRequest" />
                        <wsdl:output message="tns:StartLoginResponse" />
                </wsdl:operation>

                <wsdl:operation name="Login">
                        <wsdl:input message="tns:LoginRequest" />
                        <wsdl:output message="tns:LoginResponse" />
                </wsdl:operation>

                <wsdl:operation name="Logout">
                        <wsdl:input message="tns:LogoutRequest" />
                        <wsdl:output message="tns:LogoutResponse" />
                </wsdl:operation>
        </wsdl:portType>
        <wsdl:binding name="stbssorpcSOAP" type="tns:stbssorpc">
                <soap:binding style="rpc"
                        transport="http://schemas.xmlsoap.org/soap/http" />
                <wsdl:operation name="StartLogin">
                        <soap:operation
                                soapAction="http://www.dvnchina.com/itv/portal/sso/stb/StartLogin" />
                        <wsdl:input>
                                <soap:body
                                        namespace="http://www.dvnchina.com/itv/portal/sso/stb"
                                        use="literal" />
                        </wsdl:input>
                        <wsdl:output>
                                <soap:body
                                        namespace="http://www.dvnchina.com/itv/portal/sso/stb"
                                        use="literal" />
                        </wsdl:output>
                </wsdl:operation>

                <wsdl:operation name="Logout">
                        <soap:operation
                                soapAction="http://www.dvnchina.com/itv/portal/sso/stb/Logout" />
                        <wsdl:input>
                                <soap:body
                                        namespace="http://www.dvnchina.com/itv/portal/sso/stb"
                                        use="literal" />
                        </wsdl:input>
                        <wsdl:output>
                                <soap:body
                                        namespace="http://www.dvnchina.com/itv/portal/sso/stb"
                                        use="literal" />
                        </wsdl:output>
                </wsdl:operation>

                <wsdl:operation name="Login">
                        <soap:operation
                                soapAction="http://www.dvnchina.com/itv/portal/sso/stb/Login" />
                        <wsdl:input>
                                <soap:body
                                        namespace="http://www.dvnchina.com/itv/portal/sso/stb"
                                        use="literal" />
                        </wsdl:input>
                        <wsdl:output>
                                <soap:body
                                        namespace="http://www.dvnchina.com/itv/portal/sso/stb"
                                        use="literal" />
                        </wsdl:output>
                </wsdl:operation>
        </wsdl:binding>
        <wsdl:service name="stbssorpc">
                <wsdl:port binding="tns:stbssorpcSOAP" name="stbssorpcSOAP">
                        <soap:address location="http://www.example.org/" />
                </wsdl:port>
        </wsdl:service>
</wsdl:definitions>
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏
回复

使用道具 举报

该用户从未签到

2#
 楼主| 发表于 2007-8-17 19:23:38 | 只看该作者
选择positive testing录制出脚本如下:
/* NOTE: This is an automatically generated script, and serves as a template.
To optimize the use of this script, it is recommended that you review its content,
run it, examine its results, and add checkpoints as necessary. */

Action()
{
/*
method: Login
argument type LoginRequest
argument type LoginResponse
*/
        web_service_call( "StepName=Login_101",
                "SOAPMethod=stbssorpc.stbssorpcSOAP.Login",
                "ResponseParam=response",
                "Service=stbssorpc",
                "Snapshot=t1187348589.inf",
                BEGIN_ARGUMENTS,
                "xml:LoginRequest=<LoginRequest><UserId>auto string</UserId><KeysMD5>auto "
                                "string</KeysMD5><StbMac>auto string</StbMac><Metadata><Metadata><name>auto "
                                "string</name><value>auto string</value></Metadata></Metadata></LoginRequest>",
                END_ARGUMENTS,
                BEGIN_RESULT,
                END_RESULT,
                LAST);

        lr_think_time(3);

/*
method: Logout
argument type LogoutRequest
argument type LogoutResponse
*/
        web_service_call( "StepName=Logout_101",
                "SOAPMethod=stbssorpc.stbssorpcSOAP.Logout",
                "ResponseParam=response",
                "Service=stbssorpc",
                "Snapshot=t1187348590.inf",
                BEGIN_ARGUMENTS,
                "xml:LogoutRequest=<LogoutRequest><UserId>auto string</UserId><LoginToken>auto "
                                "string</LoginToken></LogoutRequest>",
                END_ARGUMENTS,
                BEGIN_RESULT,
                END_RESULT,
                LAST);

        lr_think_time(3);

/*
method: StartLogin
argument type StartLoginRequest
argument type StartLoginResponse
*/
        web_service_call( "StepName=StartLogin_101",
                "SOAPMethod=stbssorpc.stbssorpcSOAP.StartLogin",
                "ResponseParam=response",
                "Service=stbssorpc",
                "Snapshot=t1187348591.inf",
                BEGIN_ARGUMENTS,
                "xml:StartLoginRequest=<StartLoginRequest><UserId>auto string</UserId>"
                                "</StartLoginRequest>",
                END_ARGUMENTS,
                BEGIN_RESULT,
                END_RESULT,
                LAST);

        lr_think_time(3);


        return 0;
}



运行一下结果如下:

Virtual User Script started
Starting action vuser_init.
Web Services replay version 8.1.0 for WINXP; Toolkit: ".Net"; WebServices78 build 959
Run-Time Settings file: "E:\Program Files\Mercury\LoadRunner\Scripts\temp\stbssorpc\PositiveTesting\\default.cfg"
Vuser directory: "E:\Program Files\Mercury\LoadRunner\Scripts\temp\stbssorpc\PositiveTesting"
Vuser output directory: "E:\Program Files\Mercury\LoadRunner\Scripts\temp\stbssorpc\PositiveTesting\"
LOCAL start date/time:  2007-08-17 19:04:57
Ending action vuser_init.
Running Vuser...
Starting iteration 1.
Starting action Action.
Action.c(12): Web service call "Login_101" started
Action.c(12): Error Exceptions:
Action.c(12): Error: InvokeMethod failure: External component has thrown an exception..
Action.c(12): Notify: Saving Parameter "response = "
Action.c(12): Error: Web service call "Login_101" execution failed
Action.c(12): Continuing after error in Vuser script.
Action.c(33): Web service call "Logout_101" started
Action.c(33): Error Exceptions:
Action.c(33): Error: InvokeMethod failure: External component has thrown an exception..
Action.c(33): Notify: Saving Parameter "response = "
Action.c(33): Error: Web service call "Logout_101" execution failed
Action.c(33): Continuing after error in Vuser script.
Action.c(53): Web service call "StartLogin_101" started
Action.c(53): Error Exceptions:
Action.c(53): Error: InvokeMethod failure: External component has thrown an exception..
Action.c(53): Notify: Saving Parameter "response = "
Action.c(53): Error: Web service call "StartLogin_101" execution failed
Action.c(53): Continuing after error in Vuser script.
Ending action Action.
Ending iteration 1.
Ending Vuser...
Starting action vuser_end.
Ending action vuser_end.
Vuser Terminated.


现在不知道问题在哪里
请各位帮忙!
谢谢!
回复 支持 反对

使用道具 举报

该用户从未签到

3#
 楼主| 发表于 2007-8-19 08:57:41 | 只看该作者
等待帮助中
回复 支持 反对

使用道具 举报

  • TA的每日心情
    开心
    2019-2-1 16:33
  • 签到天数: 1 天

    连续签到: 1 天

    [LV.1]测试小兵

    4#
    发表于 2007-8-20 09:41:58 | 只看该作者
    建议~~Webservices的方法的参数不要用auto string代替而用具体格式数据试试。
    回复 支持 反对

    使用道具 举报

    该用户从未签到

    5#
     楼主| 发表于 2007-8-20 12:50:56 | 只看该作者
    不是那个问题,我已经解决了
    是调用的本地的wsdl文件路径中包含了中文,所以抛出异常
    但是,由此看出,lr的报错机制还是有所缺陷的
    在vugen中的日志记录中的错误提示还是不完整
    回复 支持 反对

    使用道具 举报

    该用户从未签到

    6#
    发表于 2007-8-20 13:10:45 | 只看该作者
    中文路径在LR中好像会引起不少的问题...
    回复 支持 反对

    使用道具 举报

    该用户从未签到

    7#
    发表于 2007-8-21 10:10:52 | 只看该作者
    眼睛看花了~~
    回复 支持 反对

    使用道具 举报

    本版积分规则

    关闭

    站长推荐上一条 /1 下一条

    小黑屋|手机版|Archiver|51Testing软件测试网 ( 沪ICP备05003035号 关于我们

    GMT+8, 2024-9-22 14:18 , Processed in 0.105456 second(s), 27 queries .

    Powered by Discuz! X3.2

    © 2001-2024 Comsenz Inc.

    快速回复 返回顶部 返回列表