51Testing软件测试论坛

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

QQ登录

只需一步,快速开始

微信登录,快人一步

手机号码,快捷登录

查看: 1553|回复: 1
打印 上一主题 下一主题

【求助】LR做性能测试,用socket录脚本,回放不成功

[复制链接]

该用户从未签到

跳转到指定楼层
1#
发表于 2014-12-9 16:31:18 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
测试程序:C/S端,主要功能门禁刷卡,使用协议.net tcp和http,后台数据库是用sql server
问题:用http协议录制,打卡的数据不能录到,代码是空的;用ms sql server录制也一样,后来直接用socket协议录制,用该协议可以录制,在data.ws中可以找到打卡的数据,但是回放的时候出现mismatch提示,还有打卡记录在数据库找不到,也就是插入数据不成功
录制的代码:
#include "lrs.h"


Action()
{
    lrs_create_socket("socket0", "TCP", "RemoteHost=172.168.1.39:200",  LrsLastArg);

    lrs_send("socket0", "buf0", LrsLastArg);

    lrs_receive("socket0", "buf1", LrsLastArg);

    lrs_send("socket0", "buf2", LrsLastArg);

    lrs_receive("socket0", "buf3", LrsLastArg);

    lrs_send("socket0", "buf4", LrsLastArg);

    lrs_receive("socket0", "buf5", LrsLastArg);

    lrs_send("socket0", "buf6", LrsLastArg);

        lrs_set_receive_option(EndMarker,EndMarker_None);

    lrs_receive("socket0", "buf7", LrsLastArg);

    lrs_create_socket("socket1", "TCP", "RemoteHost=172.168.1.39:8780",  LrsLastArg);

    lrs_send("socket1", "buf8", LrsLastArg);

    lrs_receive("socket1", "buf9", LrsLastArg);

    lrs_send("socket1", "buf10", LrsLastArg);

    lrs_receive("socket1", "buf11", LrsLastArg);

    lrs_send("socket1", "buf12", LrsLastArg);

    lr_think_time(6);

    lrs_send("socket1", "buf13", LrsLastArg);

    lrs_create_socket("socket2", "TCP", "RemoteHost=172.168.1.39:8780",  LrsLastArg);

    lrs_send("socket2", "buf14", LrsLastArg);

    lrs_receive("socket2", "buf15", LrsLastArg);

    lrs_send("socket2", "buf16", LrsLastArg);

    lrs_receive("socket2", "buf17", LrsLastArg);

    lrs_send("socket2", "buf18", LrsLastArg);

    lrs_receive("socket2", "buf19", "Flags=MSG_PEEK",LrsLastArg);

    lrs_send("socket2", "buf20", LrsLastArg);

    lrs_send("socket0", "buf21", LrsLastArg);

    lrs_receive("socket0", "buf22", LrsLastArg);

    lrs_send("socket0", "buf23", LrsLastArg);

    lrs_receive("socket0", "buf24", LrsLastArg);

    lrs_send("socket1", "buf25", LrsLastArg);

    lrs_create_socket("socket3", "TCP", "RemoteHost=172.168.1.39:8780",  LrsLastArg);

    lrs_send("socket3", "buf26", LrsLastArg);

    lrs_receive("socket3", "buf27", LrsLastArg);

    lrs_send("socket3", "buf28", LrsLastArg);

    lrs_receive("socket3", "buf29", LrsLastArg);

    lrs_send("socket3", "buf30", LrsLastArg);

    lrs_receive("socket3", "buf31", LrsLastArg);

    lrs_send("socket3", "buf32", LrsLastArg);

    lrs_send("socket1", "buf33", LrsLastArg);

    lrs_create_socket("socket4", "TCP", "RemoteHost=172.168.1.39:201",  LrsLastArg);

    lrs_send("socket4", "buf34", LrsLastArg);

    lrs_receive("socket4", "buf35", LrsLastArg);

    lrs_send("socket4", "buf36", LrsLastArg);

    lrs_receive("socket4", "buf37", LrsLastArg);

    lrs_send("socket4", "buf38", LrsLastArg);

    lrs_receive("socket4", "buf39", LrsLastArg);

    lrs_send("socket4", "buf40", LrsLastArg);

    lrs_receive("socket4", "buf41", LrsLastArg);

    lr_start_transaction("test");

    lr_think_time(13);

    lrs_send("socket1", "buf42", LrsLastArg);

    lr_think_time(6);

    lrs_send("socket1", "buf43", LrsLastArg);

    lrs_create_socket("socket5", "TCP", "RemoteHost=172.168.1.39:8780",  LrsLastArg);

    lrs_send("socket5", "buf44", LrsLastArg);

    lrs_receive("socket5", "buf45", LrsLastArg);

    lrs_send("socket5", "buf46", LrsLastArg);

    lrs_receive("socket5", "buf47", LrsLastArg);

    lrs_send("socket5", "buf48", LrsLastArg);

    lrs_receive("socket5", "buf49", LrsLastArg);

    lrs_send("socket5", "buf50", LrsLastArg);

    lrs_send("socket1", "buf51", LrsLastArg);

    lr_end_transaction("test", LR_AUTO);

    lr_think_time(10);

    lrs_send("socket0", "buf52", LrsLastArg);

    lrs_receive("socket0", "buf53", LrsLastArg);

    lrs_send("socket0", "buf54", LrsLastArg);

    lrs_receive("socket0", "buf55", LrsLastArg);

    lrs_send("socket0", "buf56", LrsLastArg);

    lrs_receive("socket0", "buf57", LrsLastArg);

    lrs_send("socket0", "buf58", LrsLastArg);

    lrs_receive("socket0", "buf59", LrsLastArg);

    lrs_close_socket("socket5");

    lrs_close_socket("socket1");

    lrs_close_socket("socket2");

    lrs_close_socket("socket3");

    lrs_close_socket("socket4");

    lrs_close_socket("socket0");

    return 0;
}


刚接触LR,对socket不是很了解,出现mismatch问题百度后方法不适用,发个求助帖,求支招

分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏
回复

使用道具 举报

该用户从未签到

2#
 楼主| 发表于 2014-12-9 16:34:38 | 只看该作者
data.ws
;WSRData 2 1

send  buf0 203
        "OST /ProjectWCF HTTP/1.1\r\n"
        "Content-Type: application/soap+xml; charset=utf-8\r\n"
        "Host: 172.168.1.39:200\r\n"
        "Content-Length: 650\r\n"
        "Expect: 100-continue\r\n"
        "Accept-Encoding: gzip, deflate\r\n"
        "Connection: Keep-Alive\r\n"
        "\r\n"

recv  buf1 25
        "HTTP/1.1 100 Continue\r\n"
        "\r\n"

send  buf2 650
        "<s:Envelope xmlns:s=\"http://www.w3.org/2003/05/soap-envelope\" xmlns:a=\""
        "http://www.w3.org/2005/08/addressing\"><s:Header><a:Action s:mustUnderstan"
        "d=\"1\">http://schemas.xmlsoap.org/ws/2005/02/rm/CreateSequence</a:Action>"
        "<a:MessageID>urn:uuid:ef50a2e2-43f9-4c73-b049-622efe9cbd01</a:MessageID><a"
        ":To s:mustUnderstand=\"1\">http://172.168.1.39:200/ProjectWCF</a:To></s:He"
        "ader><s:Body><CreateSequence xmlns=\"http://schemas.xmlsoap.org/ws/2005/02"
        "/rm\"><AcksTo><a:Address>http://www.w3.org/2005/08/addressing/anonymous</a"
        ":Address></AcksTo><Offer><Identifier>urn:uuid:8f5d5b22-2e17-4430-95dd-f5cc"
        "4d90d073</Identifier></Offer></CreateSequence></s:Body></s:Envelope>"

recv  buf3 755
        "HTTP/1.1 200 OK\r\n"
        "Content-Length: 596\r\n"
        "Content-Type: application/soap+xml; charset=utf-8\r\n"
        "Server: Microsoft-HTTPAPI/2.0\r\n"
        "Date: Mon, 08 Dec 2014 07:43:05 GMT\r\n"
        "\r\n"
        "<s:Envelope xmlns:s=\"http://www.w3.org/2003/05/soap-envelope\" xmlns:a=\""
        "http://www.w3.org/2005/08/addressing\"><s:Header><a:Action s:mustUnderstan"
        "d=\"1\">http://schemas.xmlsoap.org/ws/2005/02/rm/CreateSequenceResponse</a"
        ":Action><a:RelatesTo>urn:uuid:ef50a2e2-43f9-4c73-b049-622efe9cbd01</a:Rela"
        "tesTo></s:Header><s:Body><CreateSequenceResponse xmlns=\"http://schemas.xm"
        "lsoap.org/ws/2005/02/rm\"><Identifier>urn:uuid:dfdec823-45d9-4ef0-ad6f-3af"
        "c8bd8ad84</Identifier><Accept><AcksTo><a:Address>http://172.168.1.39:200/P"
        "rojectWCF</a:Address></AcksTo></Accept></CreateSequenceResponse></s:Body><"
        "/s:Envelope>"

send  buf4 179
        "OST /ProjectWCF HTTP/1.1\r\n"
        "Content-Type: application/soap+xml; charset=utf-8\r\n"
        "Host: 172.168.1.39:200\r\n"
        "Content-Length: 809\r\n"
        "Expect: 100-continue\r\n"
        "Accept-Encoding: gzip, deflate\r\n"
        "\r\n"

recv  buf5 25
        "HTTP/1.1 100 Continue\r\n"
        "\r\n"

send  buf6 809
        "<s:Envelope xmlns:s=\"http://www.w3.org/2003/05/soap-envelope\" xmlns:r=\""
        "http://schemas.xmlsoap.org/ws/2005/02/rm\" xmlns:a=\"http://www.w3.org/200"
        "5/08/addressing\"><s:Header><r:Sequence s:mustUnderstand=\"1\"><r:Identifi"
        "er>urn:uuid:dfdec823-45d9-4ef0-ad6f-3afc8bd8ad84</r:Identifier><r:MessageN"
        "umber>1</r:MessageNumber></r:Sequence><a:Action s:mustUnderstand=\"1\">htt"
        "p://tempuri.org/IProjectWCF/GetProjectByPID</a:Action><a:MessageID>urn:uui"
        "d:13d0fa1f-70af-4bd9-81f4-26e988ff4966</a:MessageID><a:ReplyTo><a:Address>"
        "http://www.w3.org/2005/08/addressing/anonymous</a:Address></a:ReplyTo><a:T"
        "o s:mustUnderstand=\"1\">http://172.168.1.39:200/ProjectWCF</a:To></s:Head"
        "er><s:Body><GetProjectByPID xmlns=\"http://tempuri.org/\"><projectId>f01d0"
        "a30-aa0a-4297-ab2a-721bee9ac799</projectId></GetProjectByPID></s:Body></s:"
        "Envelope>"

recv  buf7 1575
        "HTTP/1.1 200 OK\r\n"
        "Content-Length: 1415\r\n"
        "Content-Type: application/soap+xml; charset=utf-8\r\n"
        "Server: Microsoft-HTTPAPI/2.0\r\n"
        "Date: Mon, 08 Dec 2014 07:43:05 GMT\r\n"
        "\r\n"
        "<s:Envelope xmlns:s=\"http://www.w3.org/2003/05/soap-envelope\" xmlns:r=\""
        "http://schemas.xmlsoap.org/ws/2005/02/rm\" xmlns:a=\"http://www.w3.org/200"
        "5/08/addressing\"><s:Header><r:Sequence s:mustUnderstand=\"1\"><r:Identifi"
        "er>urn:uuid:8f5d5b22-2e17-4430-95dd-f5cc4d90d073</r:Identifier><r:MessageN"
        "umber>1</r:MessageNumber></r:Sequence><r:SequenceAcknowledgement><r:Identi"
        "fier>urn:uuid:dfdec823-45d9-4ef0-ad6f-3afc8bd8ad84</r:Identifier><r:Acknow"
        "ledgementRange Lower=\"1\" Upper=\"1\"/><netrm:BufferRemaining xmlns:netrm"
        "=\"http://schemas.microsoft.com/ws/2006/05/rm\">8</netrm:BufferRemaining><"
        "/r:SequenceAcknowledgement><a:Action s:mustUnderstand=\"1\">http://tempuri"
        ".org/IProjectWCF/GetProjectByPIDResponse</a:Action><a:RelatesTo>urn:uuid:1"
        "3d0fa1f-70af-4bd9-81f4-26e988ff4966</a:RelatesTo></s:Header><s:Body><GetPr"
        "ojectByPIDResponse xmlns=\"http://tempuri.org/\"><GetProjectByPIDResult xm"
        "lns:b=\"http://schemas.datacontract.org/2004/07/NGIG.Model\" xmlns:i=\"htt"
        "p://www.w3.org/2001/XMLSchema-instance\"><bCode>112-201308</bCode><b"
        "DBName>DB_NGIG_F</bDBName><bDescription>涓睍闆嗗洟鑰冨嫟</bDescrip"
        "tion><bEndTime>2013-12-31T00:00:00</bEndTime><bId>f01d0a30-aa0a-4297"
        "-ab2a-721bee9ac799</bId><b:PLogo i:nil=\"true\"/><b:PName>涓睍闆嗗洟鑰"
        "冨嫟</b:PName><b:PStartTime>2013-08-15T00:00:00</b:PStartTime><b:ServerUrl"
        ">http://localhost:92/</b:ServerUrl></GetProjectByPIDResult></GetProjectByP"
        "IDResponse></s:Body></s:Envelope>"

send  buf8 52
        "\x00\x01\x00\x01\x02\x02"
        "*net.tcp://172.168.1.39:8780/CertificateWCF"
        "\x03"
        "\b\f"

recv  buf9 1
        "\v"

send  buf10 135
        "\x06\x84\x01"
        "+*net.tcp://172.168.1.39:8780/CertificateWCFV"
        "\x02"
        "\v"
        "\x01"
        "s"
        "\x04"
        "\v"
        "\x01"
        "a"
        "\x06"
        "V\bD\n"
        "\x1e\x00"
        "偒"
        "\x9a\x05"
        "D"
        "\x1a"
        "Q"
        "\xd1"
        "\n"
        "鈘疢"
        "\x8e\xff"
        "漴檸O丏\f"
        "\x1e\x00"
        "偒"
        "\x01\x01"
        "V"
        "\x0e"
        "B"
        "\x98\x05"
        "\n"
        " B"
        "\x94\x05"
        "D*"
        "\xab\x14\x01"
        "B"
        "\xb2\x05"
        "B"
        "\x1e\xad\x7f\x1f\xa9\x11"
        "崣荗)"
        "\x0f"
        "v{]L"
        "\x01\x01\x01\x01"

recv  buf11 134
        "\x06\x83\x01\x00"
        "V"
        "\x02"
        "\v"
        "\x01"
        "s"
        "\x04"
        "\v"
        "\x01"
        "a"
        "\x06"
        "V\bD\n"
        "\x1e\x00"
        "偒"
        "\xa0\x05"
        "D"
        "\x12"
        "Q"
        "\xd1"
        "\n"
        "鈘疢"
        "\x8e\xff"
        "漴檸O丏\f"
        "\x1e\x00"
        "偒"
        "\x14\x01"
        "V"
        "\x0e"
        "B"
        "\x9e\x05"
        "\n"
        " B"
        "\x1e"
        ""
        "\x11\xfe"
        "<窜錔忨"
        "\x10"
        "*p睟"
        "\x96\x05"
        "B"
        "\x94\x05"
        "D*"
        "\x99"
        "*net.tcp://172.168.1.39:8780/CertificateWCF"
        "\x01\x01\x01\x01\x01"
回复 支持 反对

使用道具 举报

本版积分规则

关闭

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

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

GMT+8, 2024-11-16 06:04 , Processed in 0.057814 second(s), 22 queries .

Powered by Discuz! X3.2

© 2001-2024 Comsenz Inc.

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