51Testing软件测试论坛

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

QQ登录

只需一步,快速开始

微信登录,快人一步

手机号码,快捷登录

查看: 2901|回复: 5
打印 上一主题 下一主题

[原创] 脚本只能运行一遍,运行两边遍时就出错,请问是什么原因呢?

[复制链接]

该用户从未签到

跳转到指定楼层
1#
发表于 2009-6-3 10:34:28 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
录制的脚本如下:
Action()
{
        web_service_call( "StepName=SearchRestaurants_103",
                "SOAPMethod=ContentService.IContentService.SearchRestaurants",
                "ResponseParam=response",
                "WSDL=http://10.10.50.65/LBCMSLite?WSDL",
                "UseWSDLCopy=1",
                "Snapshot=t1243933951.inf",
                BEGIN_ARGUMENTS,
                "Culture=en-GB",
                "MaximumResults=100",
                "StartIndex=0",
                "xml:Search=<Search><For><CompanyNumber>C-001</CompanyNumber></For>"
                                "<ReturnDeleted>1</ReturnDeleted><ReturnDisabled>1</ReturnDisabled></Search>",
                END_ARGUMENTS,
                BEGIN_RESULT,
                "Restaurant/Id=Param_Id",
                END_RESULT,
                LAST);
        lr_think_time(3);
        return 0;
}
奇怪的是如果用两个用户迭代一次或者一个用户迭代两次执行,都会报错:提示不能输入多个companynumber(程序里设计的只能传递一个)。当用一个用户迭代一次就没有问题,是不是有缓存需要清除?还是别的什么原因,希望大家给予一些帮助,谢谢啦~
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏
回复

使用道具 举报

该用户从未签到

2#
 楼主| 发表于 2009-6-3 11:04:29 | 只看该作者
怎么没有人回答呀?
回复 支持 反对

使用道具 举报

  • TA的每日心情

    2016-12-30 10:59
  • 签到天数: 6 天

    连续签到: 1 天

    [LV.2]测试排长

    3#
    发表于 2009-6-3 11:40:14 | 只看该作者
    回放日志看看
    回复 支持 反对

    使用道具 举报

    该用户从未签到

    4#
     楼主| 发表于 2009-6-3 12:24:46 | 只看该作者
    Log如下,不知道问什么第二次迭代时就会报:红色部分显示的错
    Virtual User Script started
    Starting action vuser_init.
    Ending action vuser_init.
    Running Vuser...
    Starting iteration 1.Starting action Action.
    Action.c(6): Web service call "SearchRestaurants_103" started
    Action.c(6): Using working copy of the WSDL file "http://10.10.50.65/LBCMSLite?WSDL"
    Action.c(6): Using client emulation General
    Action.c(6): Removed Web headers not matching the emulated client
    Action.c(6): Notice: "CompanyNumber" was selected as the optional <choice> element.Action.c(6): t=1385ms: 148-byte response headers for "http://10.10.50.65/LBCMSLite" (RelFrameId=1)
    Action.c(6):     HTTP/1.1 200 OK\r\n
    Action.c(6):     Content-Length: 2472\r\n
    Action.c(6):     Content-Type: text/xml; charset=utf-8\r\n
    Action.c(6):     Server: Microsoft-HTTPAPI/1.0\r\n
    Action.c(6):     Date: Wed, 03 Jun 2009 04:03:57 GMT\r\n
    Action.c(6):     \r\n
    Action.c(6): t=1434ms: 2472-byte response body for "http://10.10.50.65/LBCMSLite" (RelFrameId=1)
    Action.c(6):     <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Body xmlns:xsi="http://
    Action.c(6):     www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><SearchRe
    Action.c(6):     staurantResponse xmlns="http://schemas.livebookings.net/services/cms/1/0/"><Restaurant><Id
    Action.c(6):     >88</Id(此处省略了一些数据信息)
    Action.c(6): Web service call "SearchRestaurants_103" was successful
    Ending action Action.
    Ending iteration 1.
    Starting iteration 2.Starting action Action.
    Action.c(6): Web service call "SearchRestaurants_103" started
    Action.c(6): Using working copy of the WSDL file "http://10.10.50.65/LBCMSLite?WSDL"
    Action.c(6): Using client emulation General
    Action.c(6): Removed Web headers not matching the emulated client
    Action.c(6): Error: More than one element was selected for <choice>. You can choose only one element. Defaulting to a soap_request.Action.c(6): t=2233ms: 167-byte response headers for "http://10.10.50.65/LBCMSLite" (RelFrameId=1)
    Action.c(6):     HTTP/1.1 500 Internal Server Error\r\n
    Action.c(6):     Content-Length: 4480\r\n
    Action.c(6):     Content-Type: text/xml; charset=utf-8\r\n
    Action.c(6):     Server: Microsoft-HTTPAPI/1.0\r\n
    Action.c(6):     Date: Wed, 03 Jun 2009 04:03:57 GMT\r\n
    Action.c(6):     \r\n
    Action.c(6): t=2308ms: 4480-byte response body for "http://10.10.50.65/LBCMSLite" (RelFrameId=1)
    Action.c(6):     <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Body><s:Fault><faultcod
    Action.c(6):     e xmlns:a="http://schemas.microsoft.com/net/2005/12/windowscommunicationfoundation/dispatc
    Action.c(6):     her">a:InternalServiceFault</faultcode><faultstring xml:lang="zh-CN">Error in deserializin
    Action.c(6):     g body of request message for operation 'SearchRestaurants'.</faultstring><detail><Excepti
    Action.c(6):     onDetail xmlns="http://schemas.datacontract.org/2004/07/System.ServiceModel" xmlns:i="http
    Action.c(6):     ://www.w3.org/2001/XMLSchema-instance"><HelpLink i:nil="true"/><InnerException><HelpLink i
    Action.c(6):     :nil="true"/><InnerException><HelpLink i:nil="true"/><InnerException i:nil="true"/><Messag
    Action.c(6):     e>Start element 'For' does not match end element 'Search'. Line 1, position 424.</Message>
    Action.c(6):     <StackTrace>   at System.Xml.XmlExceptionHelper.ThrowXmlException(XmlDictionaryReader read
    Action.c(6):     er, String res, String arg1, String arg2, String arg3)&#xD;\n
    Action.c(6):        at System.Xml.XmlExceptionHelper.ThrowTagMismatch(XmlDictionaryReader reader, String ex
    Action.c(6):     pectedPrefix, String expectedLocalName, String foundPrefix, String foundLocalName)&#xD;\n
    Action.c(6):        at System.Xml.XmlUTF8TextReader.ReadEndElement()&#xD;\n
    Action.c(6):        at System.Xml.XmlUTF8TextReader.Read()&#xD;\n
    Action.c(6):        at System.Xml.XmlBaseReader.ReadStartElement()&#xD;\n
    Action.c(6):        at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderIContentService.
    Action.c(6):     Read5_Item(Boolean isNullable, Boolean checkType)&#xD;\n
    Action.c(6):        at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderIContentService.
    Action.c(6):     Read6_SearchRestaurantRequestSearch(Boolean isNullable, Boolean checkType)&#xD;\n
    Action.c(6):        at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderIContentService.
    Action.c(6):     Read58_SearchRestaurantRequest()&#xD;\n
    Action.c(6):        at Microsoft.Xml.Serialization.GeneratedAssembly.ArrayOfObjectSerializer5.Deserialize(X
    Action.c(6):     mlSerializationReader reader)&#xD;\n
    Action.c(6):        at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encod
    Action.c(6):     ingStyle, XmlDeserializationEvents events)</StackTrace><Type>System.Xml.XmlException</Type
    Action.c(6):     ></InnerException><Message>There is an error in XML document (1, 424).</Message><StackTrac
    Action.c(6):     e>   at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String enc
    Action.c(6):     odingStyle, XmlDeserializationEvents events)&#xD;\n
    Action.c(6):        at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encod
    Action.c(6):     ingStyle)&#xD;\n
    Action.c(6):        at System.ServiceModel.Dispatcher.XmlSerializerOperationFormatter.DeserializeBody(XmlDi
    Action.c(6):     ctionaryReader reader, MessageVersion version, XmlSerializer serializer, MessagePartDescri
    Action.c(6):     ption returnPart, MessagePartDescriptionCollection bodyParts, Object[] parameters, Boolean
    Action.c(6):      isRequest)</StackTrace><Type>System.InvalidOperationException</Type></InnerException><Mes
    Action.c(6):     sage>Error in deserializing body of request message for operation 'SearchRestaurants'.</Me
    Action.c(6):     ssage><StackTrace>   at System.ServiceModel.Dispatcher.XmlSerializerOperationFormatter.Des
    Action.c(6):     erializeBody(XmlDictionaryReader reader, MessageVersion version, XmlSerializer serializer,
    Action.c(6):      MessagePartDescription returnPart, MessagePartDescriptionCollection bodyParts, Object[] p
    Action.c(6):     arameters, Boolean isRequest)&#xD;\n
    Action.c(6):        at System.ServiceModel.Dispatcher.XmlSerializerOperationFormatter.DeserializeBody(XmlDi
    Action.c(6):     ctionaryReader reader, MessageVersion version, String action, MessageDescription messageDe
    Action.c(6):     scription, Object[] parameters, Boolean isRequest)&#xD;\n
    Action.c(6):        at System.ServiceModel.Dispatcher.OperationFormatter.DeserializeBodyContents(Message me
    Action.c(6):     ssage, Object[] parameters, Boolean isRequest)&#xD;\n
    Action.c(6):        at System.ServiceModel.Dispatcher.OperationFormatter.DeserializeRequest(Message message
    Action.c(6):     , Object[] parameters)&#xD;\n
    Action.c(6):        at System.ServiceModel.Dispatcher.DispatchOperationRuntime.DeserializeInputs(MessageRpc
    Action.c(6):     &amp; rpc)&#xD;\n
    Action.c(6):        at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc&amp;
    Action.c(6):     rpc)&#xD;\n
    Action.c(6):        at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc&a
    Action.c(6):     mp; rpc)&#xD;\n
    Action.c(6):        at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage4(MessageRpc&a
    Action.c(6):     mp; rpc)&#xD;\n
    Action.c(6):        at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage3(MessageRpc&a
    Action.c(6):     mp; rpc)&#xD;\n
    Action.c(6):        at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage2(MessageRpc&a
    Action.c(6):     mp; rpc)&#xD;\n
    Action.c(6):        at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage1(MessageRpc&a
    Action.c(6):     mp; rpc)&#xD;\n
    Action.c(6):        at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)</St
    Action.c(6):     ackTrace><Type>System.ServiceModel.CommunicationException</Type></ExceptionDetail></detail
    Action.c(6):     ></s:Fault></s:Body></s:Envelope>
    Action.c(6): Warning: HTTP status code 500 returned by the server
    Action.c(6): Error: The reason for the SOAP fault is:        "Error in deserializing body of request message for operation 'SearchRestaurants'."
    Action.c(6): Error: Web service call "SearchRestaurants_103" execution failed
    Ending action Action.
    Ending iteration 2.
    Ending Vuser...
    Starting action vuser_end.
    Ending action vuser_end.
    Vuser Terminated.
    回复 支持 反对

    使用道具 举报

    该用户从未签到

    5#
    发表于 2009-6-3 15:54:26 | 只看该作者
    Action.c(6): Error: More than one element was selected for <choice>. You can choose only one element. Defaulting to a soap_request.Action.c(6): t=2233ms: 167-byte response headers for "http://10.10.50.65/LBCMSLite" (RelFrameId=1)
    Action.c(6):     HTTP/1.1 500 Internal Server Error\r\n

    从这基本可以确定是参数问题,确认一下你的参数值的规则和参数来源吧,即你的这个参数同一个值能否重复使用,及你的参数值是服务器给你的还是你自己定义的。
    回复 支持 反对

    使用道具 举报

    该用户从未签到

    6#
     楼主| 发表于 2009-6-4 11:17:59 | 只看该作者

    回复 6# 的帖子

    感谢您的回复,choice类型是要求一次只能传递一个参数的。参数的值是我设置的。
    我觉得好像第二次迭代时,应该是loadrunner传了两个companyNumber,所以才会给出这样的提示。
    我重新定义了参数:改为unique+each iteration类型,定义了两个值C-001和c-002。运行后log如下:
    g iteration 1.
    Starting action Action.
    Action.c(5): Web service call "SearchRestaurants_101" started
    Action.c(5): Using working copy of the WSDL file "D:/CMS/LBCMSLite.wsdl"
    Action.c(5): Using client emulation General
    Action.c(5): Removed Web headers not matching the emulated client
    Action.c(5): Notify: Parameter Substitution: parameter "NewParam" =  "C-001"
    Action.c(5): Notice: "CompanyNumber" was selected as the optional <choice> element.
    ........
    Action.c(5): Web service call "SearchRestaurants_101" was successful
    Ending action Action.
    Ending iteration 1.
    Starting iteration 2.
    t=3885ms: Closed connection to 10.10.50.65:80 after completing 1 request          [MsgId: MMSG-26000]
    Notify: Next row for parameter NewParam = 2 [table  = NewParam].
    Notify: Getting new value for parameter 'NewParam': table = 'NewParam.dat' column = '0' row = '2'.
    Starting action Action.
    Action.c(5): Web service call "SearchRestaurants_101" started
    Action.c(5): Using working copy of the WSDL file "D:/CMS/LBCMSLite.wsdl"
    Action.c(5): Using client emulation General
    Action.c(5): Removed Web headers not matching the emulated client
    Action.c(5): Notify: Parameter Substitution: parameter "NewParam" =  "c-002"
    Action.c(5): Error: More than one element was selected for <choice>. You can choose only one element. Defaulting to a soap_request.
    从log里看第二次迭代开始的时候定位参数的取值,然后给参数取了c-002,但是如果仅是一个参数的话,不应该会报error的呀,应该是把第一次迭代的companyNumber也试图传递给服务器造成的吧,但是为什么要传第一次迭代的companyNumber呢?不太明白,希望大家不吝赐教...
    回复 支持 反对

    使用道具 举报

    本版积分规则

    关闭

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

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

    GMT+8, 2024-11-19 10:24 , Processed in 0.068030 second(s), 27 queries .

    Powered by Discuz! X3.2

    © 2001-2024 Comsenz Inc.

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