Jmeter vs Selenium websocket testing differences



  • I am researching the differences between Selenium and JMeter and I stumbled across the following statement about Selenium:

    Even though WebSocket might be encapsulated into a web session and affect the browser, the user/Selenium will not realise it. So, we will use JMeter for testing WebSockets.

    which confuses me because even though Selenium can't detect that specific scenario, Selenium still uses a programming language like JAVA, hence you can still use Java to accomplish the same thing JMeter does in this case. Or am I missing something here?



  • Both of these tools, Selenium and JMeter, are useful for different purposes.

    As mentioned on the Selenium website:

    Selenium automates browsers. That's it! Primarily, it is for automating web applications for testing purposes.

    In other words, it's used to validate user behavior and testing of end-to-end functional scenarios in the browser. This is the primary purpose. Yes, people use Selenium for other purposes like web scrapping, but these are seen as secondary uses. "Performance testing" using Selenium is not the same as using JMeter; this is meant to read as "how fast can you perform UI tests for a single user." You cannot use Selenium to simulate heavy load, web traffic, 100's or 1000's of users at a time.

    As mentioned on the JMeter website:

    Apache JMeter may be used to test performance both on static and dynamic resources, Web dynamic applications. It can be used to simulate a heavy load on a server, group of servers, network or object to test its strength or to analyze overall performance under different load types.

    In other words, the primary purpose with JMeter is as a load and performance testing tool. While it has expanded to other types of testing, load and performance is it's primary purpose.

    Yes, they both can be used with Java, but this is an implementation detail. Selenium can also be used in other programming languages like C#, PHP, JavaScript, Ruby, Python.

    What's your main purpose?

    If it's front-end/UI web app functional behavior and validation, go with Selenium.

    If it's load and performance testing, anything at the web socket layer, go with JMeter.


    Note: OP's question and quote seems to relate to this article: https://www.blazemeter.com/blog/selenium-vs-jmeter-which-one-should-you-choose-and-when/

    This article goes on to say:

    Can Selenium do everything that JMeter does?

    No. Selenium can be used for some performance testing (e.g. limited bandwidth testing), but it cannot be used to load test with accuracy like JMeter.

    Can JMeter do everything that Selenium does?

    No. JMeter can record detailed web sessions originated by web browser applications and replay the web session as the server sees them. However, each replay does not reproduce client side elaboration (e.g. Javascript logic in web browser) or web page rendering. So if our test is focused on how a web page is presented to a user, Selenium is a better choice.

    Can JMeter and Selenium collaborate? Yes. There are various situations where both tools can sync on the same testing application.

    The record and replay in JMeter is similar to using Selenium IDE browser extension.



Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2