2014-07-04 24 views
0

我正在構建一個測試計劃,用JMeter測試XMPP。但是,即使身份驗證字符串正確,我仍然會向服務器發送身份驗證字符串時遇到錯誤。有沒有人有同樣的問題,或知道如何解決這個問題?謝謝。JMeter - XMPP身份驗證

2014/07/04 10:23:22 INFO - jmeter.engine.StandardJMeterEngine: Running the test! 
2014/07/04 10:23:22 INFO - jmeter.gui.util.JMeterMenuBar: setRunning(true,*local*) 
2014/07/04 10:23:22 INFO - jmeter.engine.StandardJMeterEngine: Starting ThreadGroup: 1 : Thread Group 
2014/07/04 10:23:22 INFO - jmeter.engine.StandardJMeterEngine: Starting 1 threads for group Thread Group. 
2014/07/04 10:23:22 INFO - jmeter.engine.StandardJMeterEngine: Thread will continue on error 
2014/07/04 10:23:22 INFO - jmeter.threads.ThreadGroup: Starting thread group number 1 threads 1 ramp-up 1 perThread 1000.0 delayedStart=false 
2014/07/04 10:23:22 INFO - jmeter.threads.ThreadGroup: Started thread group number 1 
2014/07/04 10:23:22 INFO - jmeter.engine.StandardJMeterEngine: All thread groups have been started 
2014/07/04 10:23:22 INFO - jmeter.threads.JMeterThread: Thread started: Thread Group 1-1 
2014/07/04 10:23:22 ERROR - ru.yandex.jmeter.XMPPClientImpl: Error reading data java.lang.RuntimeException: Retries more than 1000, aborting read 
at ru.yandex.jmeter.XMPPClientImpl.read(XMPPClientImpl.java:116) 
at org.apache.jmeter.protocol.tcp.sampler.TCPSampler.sample(TCPSampler.java:414) 
at org.apache.jmeter.threads.JMeterThread.process_sampler(JMeterThread.java:428) 
at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:256) 
at java.lang.Thread.run(Unknown Source) 

2014/07/04 10:23:22 ERROR - jmeter.protocol.tcp.sampler.TCPSampler: java.lang.RuntimeException: Error reading data 
at ru.yandex.jmeter.XMPPClientImpl.read(XMPPClientImpl.java:152) 
at org.apache.jmeter.protocol.tcp.sampler.TCPSampler.sample(TCPSampler.java:414) 
at org.apache.jmeter.threads.JMeterThread.process_sampler(JMeterThread.java:428) 
at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:256) 
at java.lang.Thread.run(Unknown Source) 
Caused by: java.lang.RuntimeException: Retries more than 1000, aborting read 
at ru.yandex.jmeter.XMPPClientImpl.read(XMPPClientImpl.java:116) 
... 4 more 

2014/07/04 10:23:22 INFO - jmeter.threads.JMeterThread: Thread finished: Thread Group 1-1 
2014/07/04 10:23:22 INFO - jmeter.engine.StandardJMeterEngine: Notifying test listeners of end of test 
2014/07/04 10:23:22 INFO - jmeter.gui.util.JMeterMenuBar: setRunning(false,*local*) 
+0

你能顯示在XMPPSampler你的測試計劃,放大並顯示你配置 –

+0

@ PMDUBIK-INGENIERIE https://www.dropbox.com/s/v8hlav0md nmmhrw/xmpp.png Youc可以參考鏈接來檢查我的配置。 – Aaronsoso

+0

你能解決這個問題嗎?我遇到了與XMPPClientImpl插件相同的問題。我已經添加了BeanShell Listener來查看我是否可以獲得任何額外的調試信息,但沒有用,我只是得到像上面發佈的無用信息。我試圖測試的服務器是Openfire聊天服務器,其日誌甚至不顯示來自Jmeter前端的任何連接嘗試。我的下一步是使用Wireshark來查看在測試計劃運行時是否可以獲取任何有用的響應,但我並不抱希望。 – Wulf

回答

0

使用XMPPClientImpl插件我試過,但總是得到同樣的錯誤(「重試次數超過1000,中止讀」),所以我決定離開它,我自己寫的代碼。

我使用BeanShell取樣器,在其中運行以下代碼(使用smack庫)連接到XMPP服務器。

String CLASS_PATH = "C:/JMeter/apache-jmeter-2.13/lib/ext/smack/"; 

addClassPath(CLASS_PATH + "smack-android-extensions-4.1.3.jar"); 
addClassPath(CLASS_PATH + "smack-tcp-4.1.3.jar"); 
addClassPath(CLASS_PATH + "smack-android-4.1.3.jar"); 

// explicitly import every class you need 
import org.jivesoftware.smack.XMPPConnection; 
import org.jivesoftware.smack.ConnectionConfiguration; 
import org.jivesoftware.smack.ConnectionListener; 

import org.jivesoftware.smack.tcp.XMPPTCPConnection; 
import org.jivesoftware.smack.tcp.XMPPTCPConnectionConfiguration; 

import org.jivesoftware.smack.SmackException; 
import org.jivesoftware.smack.XMPPException; 
import org.jivesoftware.smack.XMPPException.XMPPErrorException; 

String jabberId = "..."; 
String jabberPass = "..."; 

String SERVER_ADDRESS = "..."; 
int PORT = 5222; // or any other port 

XMPPTCPConnection getConnection() { 

    XMPPTCPConnectionConfiguration config = 
     XMPPTCPConnectionConfiguration.builder() 
      .setUsernameAndPassword(jabberId, jabberPass) 
      .setHost(SERVER_ADDRESS) 
      .setServiceName(SERVER_ADDRESS) 
      .setPort(DEFAULT_PORT) 
     // .setSecurityMode(ConnectionConfiguration.SecurityMode.disabled) 
      .setSendPresence(true) 
     // .setDebuggerEnabled(YouMe.DEBUG) 
      .build(); 

    XMPPTCPConnection con = new XMPPTCPConnection(config); 

    int REPLY_TIMEOUT = 50000; // 50 seconds, but can be shorter 
    con.setPacketReplyTimeout(REPLY_TIMEOUT); 

    return con; 
} 

不要忘記添加咂嘴路徑(例如C:\ JMeter的\ Apache的JMeter的2.13 \ LIB \分機\嫌)到庫場(在 「添加目錄或jar的classpath」 )在測試計劃的測試計劃節點中。

要連接 -

con = getConnection(); 
con.connect(); 

登陸 -

con.login(jabberId, jabberPass); 

您還可以添加連接監聽器 -

ConnectionListener listener = new ConnectionListener() { 

    public void connected(XMPPConnection xmppConnection) { 
      // run main code incl. the login code 
      runMain(); 
    } 
    public void authenticated(XMPPConnection xmppConnection, boolean resumed) { 
    } 
    public void connectionClosed() { 
    } 
    public void connectionClosedOnError(Exception e) { 
    } 
    public void reconnectingIn(int i) { 
    } 
    public void reconnectionSuccessful() { 
    } 
    public void reconnectionFailed(Exception e) { 
    } 
    }; 

con.addConnectionListener(listener); 

// connect 
con.connect(); 

runMain() { 
    con.login(jabberId, jabberPass); 

    // ... 
}