发送用户名和密码作为发布请求后出现404错误

时间:2016-01-07 16:54:59

标签: jmeter

我有一些jmeter脚本,这个脚本的主要目的是发布我从excel表中读取的用户名和密码。我有excel表保存在我本地系统的E:\驱动器中,我通过从excel读取用户名和密码成功发送邮件请求,但我收到的回复中有问题。请帮助我。

响应数据:

<!DOCTYPE html>
<html>
    <head>
        <title>The resource cannot be found.</title>
        <meta name="viewport" content="width=device-width" />
        <style>
         body {font-family:"Verdana";font-weight:normal;font-size: .7em;color:black;} 
         p {font-family:"Verdana";font-weight:normal;color:black;margin-top: -5px}
         b {font-family:"Verdana";font-weight:bold;color:black;margin-top: -5px}
         H1 { font-family:"Verdana";font-weight:normal;font-size:18pt;color:red }
         H2 { font-family:"Verdana";font-weight:normal;font-size:14pt;color:maroon }
         pre {font-family:"Consolas","Lucida Console",Monospace;font-size:11pt;margin:0;padding:0.5em;line-height:14pt}
         .marker {font-weight: bold; color: black;text-decoration: none;}
         .version {color: gray;}
         .error {margin-bottom: 10px;}
         .expandable { text-decoration:underline; font-weight:bold; color:navy; cursor:hand; }
         @media screen and (max-width: 639px) {
          pre { width: 440px; overflow: auto; white-space: pre-wrap; word-wrap: break-word; }
         }
         @media screen and (max-width: 479px) {
          pre { width: 280px; }
         }
        </style>
    </head>

    <body bgcolor="white">

            <span><H1>Server Error in '/' Application.<hr width=100% size=1 color=silver></H1>

            <h2> <i>The resource cannot be found.</i> </h2></span>

            <font face="Arial, Helvetica, Geneva, SunSans-Regular, sans-serif ">

            <b> Description: </b>HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. &nbsp;Please review the following URL and make sure that it is spelled correctly.
            <br><br>

            <b> Requested URL: </b>/Account/Authenticate/<br><br>

    </body>
</html>

请求: -

POST http://pulsedindev.halcyontek.com/Account/Authenticate/

POST data:
DeviceType=5&Password=halcyon12%24&Username=test04.pharma%40gmail.com

[no cookies]

Request Headers:
Connection: keep-alive
Accept-Language: en-US,en;q=0.5
Accept: application/json, text/plain, */*
User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:43.0) Gecko/20100101 Firefox/43.0
Referer: http://pulsedindev.halcyontek.com/
Accept-Encoding: gzip, deflate
Content-Type: application/x-www-form-urlencoded
Content-Length: 69
Host: pulsedindev.halcyontek.com

1 个答案:

答案 0 :(得分:1)

我发现您的测试存在问题 - 您的服务器期望GET,而不是POST以传递用户名和密码。这是一个不好的做法我建议它是POST和HTTPS。

我是怎么想出来的

  1. 我使用SeleniumIDE + JMeter Recorder来模拟流量并记录Selenium和JMeter
  2. 我在JMeter参加了测试,没有任何问题。
  3. 如果您需要,请查看Selenium记录的测试计划副本以及您网站的简单JMeter测试计划。