Explore topic-wise InterviewSolutions in .

This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.

1.

How is Ultimate thread group different from other thread groups?

Answer»

Multiple thread GROUPS are provided, each of which can be set to imitate how users interact with the app, how the load is sustained, and for how long. The Arrivals Thread GROUP is the beginning of thread iteration. It defines the schedule of the load. The Concurrency Thread group is likewise appropriate for goal-oriented scenarios, but the purpose here is to manage the number of concurrent users over TIME. Freedom Arrivals Thread Group resembles the Arrivals Thread group, the difference being that this thread group does not have choices for ramp-up time and steps. The Stepping Thread Group is an older version of the Concurrency Thread Group that takes a little more configuration. The ultimate result is essentially the same; the main difference is in the ramp-up and ramp-down phases.

The ultimate thread group is highly customizable, and unlike the arrivals, freeform, and concurrency thread groups, it kills ACTIVE threads when the set time runs out. As users exit the application tab or browser, this would convert into real-world user behaviour. Because the ramp-down is controlled by the thread group rather than the execution time of individual threads, the preview GRAPH depicting the expected simultaneous users will be extremely accurate. In the case where one thread has completed execution, the thread group also starts a new thread to keep the thread count up.

Conclusion:

We are confident that this post on JMeter interview questions has greatly enriched your knowledge of JMeter topics. A solid mastery of all of the questions provided here will enable you to confidently crack any interview. Happy learning!

2.

In JMeter, what are the different sorts of controllers?

Answer»

In JMeter, controllers are used to regulating the flow of request execution. They allow you to specify the order in which requests are processed in a Thread. It allows you to choose "when" a USER request is sent to a web server. They choose the sequence in which user requests are processed.

Some controllers used in JMeter are listed below:

  • Recording controller- JMeter has the ability to RECORD your testing steps; a recording controller is a container for these recordings.
  • IF controller- IF Controller decides whether or not to run a batch of child samplers based on particular criteria.
  • While controller- The JMeter While Controller basically runs child Samplers and keeps RUNNING until the condition in the condition field becomes false.
  • Transaction controller- The Transaction Controller in JMeter is a useful tool for organising and determining how different pieces of your test will appear in a report. The Transaction Controller creates a second sample that measures the total time it takes to complete the nested test items.
  • Loop controller- The Loop Controller causes the user request to be repeated a given number of times or to be repeated indefinitely.
  • Simple controller- Simple Controller is a container for user requests.
  • Module controller- Module Controller's purpose is to make JMeter more modular. Web applications, in GENERAL, are made up of small functional units (e.g., login, create account, logoff...). This capability can be saved as "MODULES" in Simple Controller. The Module Controller will determine which module is required to run.
  • Random Controller-In each loop period, the Random Controller causes all user requests to be processed in a random sequence.
  • Interleave Controller- Interleave Controller takes one of the user requests and makes it run in each loop of the thread.
3.

What are the most significant plugins that JMeter supports?

Answer»

JMeter comes with a lot of functionality by default, but one of the best things about it is that its open-source software! As a result, any interested party can create additions to the system that will expand its capabilities and provide new features. PLUGINS are the name for these additions. Developers have already produced a wide range of useful plugins, which is fantastic and demonstrates the JMeter community's strength. JMeter supports a variety of plugins that aid in the generation of high-quality results.

The important plugins that are supported are listed below:

  • Plugins Manager: The Plugin Manager is the most popular plugin, and for a legitimate reason: most users need to install the Plugin Manager before installing additional plugins. The most convenient approach to handle JMeter plugins is to use the Plugins Manager.
  • Custom Thread Groups: Stepping Thread Group, Ultimate Thread Group, Concurrency Thread Group, Arrivals Thread Group, and Free-Form Arrivals Thread Group are the five thread group types added by the Custom Thread Groups plugin. These five thread groups provide you with a lot of possibilities for creating test run schedules.
  • Dummy Sampler: The Dummy Sampler simulates request and RESPONSE processing without ACTUALLY running the requests. The sampler's fields define the request and response data. Debugging post-processors and extractors has never been easier.
  • PerfMon (Servers Performance Monitoring): This plugin adds the PerfMon Servers Performance Monitoring listener to JMeter. This listener allows us to keep track of the servers' CPU, memory, swap, disc I/O, and network I/O.
  • Throughput Shaping Timer: The following features are added to JMeter by this plugin: Throughput Shaping Timer, Special Property Processing, and Schedule Feedback Function. These features allow us to set a test throughput limit to guarantee that we don't go above our desired throughput.
  • Basic GRAPHS: JMeter is extended with three listeners by the 3 Basic Graphs plugin: Active Threads Over Time, Response Times Over Time, and Transactions per Second. These listeners display information and KPIs regarding the load testing results in a graphic style, allowing you to examine the success of your performance tests and make more informed decisions about your website or app's NEXT steps.
4.

What factors influence the number of threads that should be generated per system?

Answer»

It is dependent on the system's hardware.

On a 2-3 GHz CPU, for example, 400-600 threads can be produced. It also depends on the ELEMENTS included in your TEST strategy. The HIGHER the number of processors and XML processing components, the higher the CPU BURDEN and, as a result, the fewer threads. Load testing with multiple machines is recommended for large loads.

5.

What is a Root Certificate Authority (CA) certificate?

Answer»

A certificate is required to authenticate HTTPS connections, which are established when the browser connects to the webserver. JMeter creates it for the purpose of intercepting SSL traffic and recording actions. This certificate must be installed on your MOBILE device in ORDER to record actions via mobile. It is necessary to install the JMeter protected CA certificate in the browser before recording any secured web application with JMeter.

The HTTP(S) Test Script Recorder in JMeter can be used to record the protected online application. Certificates are used to authenticate the connection between the browser and the web server in secured (HTTPS) COMMUNICATIONS. The server presents the certificate to the browser when connecting through HTTPS. The browser verifies that the server certificate is signed by a Certificate Authority (CA) that is related to one of the browser's built-in root CAS. To intercept the HTTPS connection from the browser, JMeter must utilise its own certificate to enable encrypted connections. JMeter must EFFECTIVELY impersonate the target server.

6.

Write the code to write data stored in a JMeter variable to a CSV file.

Answer»

To WRITE data to a CSV file, use the lines of code below inside a BeanShell postprocessor.

 dataString = vars.get("DataToBeWritten");FILEPATH = vars.get("DataFilePath"); // you should pass true if you want to append the data to an existing file // if you wish to OVERWRITE, then do not pass the second argument FileWriter fstream = NEW FileWriter(filePath, true); BufferedWriter out = new BufferedWriter(fstream); out.write(dataString); out.write(System.getProperty("line.separator")); out.close(); fstream.close();

In the above code, the data is WRITTEN to an existing file. The path of the existing file is stored in filePath, and the data in dataString is appended to the file.

7.

What is BeanShell scripting?

Answer»

BeanShell is one of the most advanced JMeter built-in components. BeanShell is a lightweight Java scripting language that JMeter uses to do some sophisticated tasks. With the help of coding, the BeanShell sampler can execute a variety of tasks. You can get the thread NUMBER, run the current sampler, collect the cookies, and so forth. It comprehends Java syntax and provides scripting features such as loose types, commands and method closures. BeanShell can be a wonderful solution to achieve your goals if your test case is peculiar and creating it using EMBEDDED JMeter components is nearly impossible. BeanShell entities in JMeter include accessibility both to internal JMeter APIs as well as any external classes packed into the JMeter classpath (make sure to drop appropriate jars into your JMeter installation's /lib/ext folder and place the relevant "import" statements at the top of your BeanShell scripts).

The following BeanShell-enabled components are available in all JMeter versions:

  • Beanshell Sampler: A sampler that can OPERATE independently.
  • Beanshell PreProcessor: A sampler pre-processor that operates before the sampler and can be used to establish prerequisites (i.e. to generate some input).
  • Beanshell PostProcessor: A post-processor that runs after the sampler and can be used for cleanup or recovery.
  • Beanshell Assertion: A powerful assertion that ALLOWS you to use the JMeter API completely. Java conditional logic can be used to control the outcome of the assertion.
  • __Beanshell Function: A JMeter function that permits custom BeanShell code to be executed while the sampler is RUNNING.
8.

What are the crucial steps in the JDBC (Java Database Connectivity) request testing process?

Answer»

JDBC requests are used to CREATE a connection with databases and then to track query response times.

The following are important procedures to take when evaluating JDBC requests:

  • Setting up the Config Element, JDBC Connection setup, and adding the Database URL and JDBC Driver Class according to the database. Add the name of the VARIABLE for this connection configuration so that it can be used in the sampler.
  • JDBC Request should be ADDED. WRITE your queries to the test using the same variable name as before.
9.

In JMeter, how do you handle sessions and cookies?

Answer»

In JMeter, sessions and cookies may be controlled via config components like HTTP CACHE Manager, which allows you to clear cookies after each iteration and ADD user-defined cookies. The HTTP Cache Manager assists you in cleaning the cache after EVERY iteration as NEEDED in load tests, as well as limiting the number of objects that can be cached. The HTTP SAMPLER can be configured with both of these config elements.

10.

Is it possible for you to use JMeter to run Selenium scripts? If so, how would you go about doing it?

Answer»

YES, you can run Selenium scripts in JMETER in order to get an indication of how well they perform.

  • It can be done in two ways. You can either utilise JUNIT libraries to create Selenium scripts and save them as Jars, which you can then add to the JMeter directory. Then, in your test plan, add the JUnit sampler and import the Jar file.
  • Or else, you can place the WEBDRIVER sampler plugin in the JMeter ext folder. JMeter should be restarted. In the Webdriver sampler, write your Selenium code and then run it to OBSERVE how it performs.
11.

How do you perform spike testing with JMeter?

Answer»

 Spike Testing is a type of performance assessment that examines how the system behaves when the load is significantly increased on the system. Using the Synchronizing Timer in JMeter, you may perform spike testing. The threads are clogged by synchronising the timer until a certain number of threads are blocked, then releasing them all at once, resulting in a significant sudden load. 

JMeter OFFERS you two options to carry out spike testing:

  • Use the JMeter ULTIMATE Thread Group: This strategy will necessitate advance planning. Using the Ultimate Thread Group, the TESTER can perform many ramp-ups and ramp-downs in a single test. These could be gradual or more abrupt. For our purposes, you could introduce a spike during the test, for example, after 10 minutes of slow ramp-up and then stable load, ramp up to 10X in 10 seconds, then ramp down to the previous load level after 1 minute. The disadvantage of this method is that you won't be able to REGULATE concurrency during the test RUN. You won't be able to predict when the spike will occur.
  • Use JMeter Properties: This method will provide you with the most choice and flexibility. Determine how many threads you'll run at the start of the test, as well as when you'll want to create spikes dynamically. Use JMeter Properties for the number of threads, then use Real-Time Control to change the Properties while the test is executing.
12.

Why is running JMeter in Non-GUI mode recommended?

Answer»

JMETER tests can be conducted in GUI or non-GUI modes. Because the AWT (Abstract Window Toolkit) event thread can kill the tests in high LOAD conditions, it is HIGHLY advised to conduct the load test in Non-GUI mode. JMeter's GUI mode is ideal for adding and updating new configuration components, thread groups, and samplers, as well as viewing a variety of different LISTENERS for troubleshooting. The GUI option, on the other hand, has a constraint that slows down CPU consumption while running the recorded script. JMeter performance SUFFERS when several listeners are used in a script. In order to avoid this, the script should be run in non-GUI mode. In non-GUI mode, there is a benefit to driving more requests per second out of JMeter.

JMeter supports a number of non-GUI modes, including:

  • Command-line
  • ANT plugin
  • MAVEN plugin
  • Jenkins
13.

Is it possible to use JMeter to record actions using a mobile device? If so, how would you go about doing it?

Answer»

YES, JMeter can also record HTTP or HTTPS requests sent to the server through your mobile application. Mobile and JMeter must be connected to the same network.

The FOLLOWING is the needed configuration:

  • In JMeter, set your proxy server to RUN on a specific port.
  • Set up the proxy on your phone's wifi settings and use the same port number as the recorder.
  • On your mobile device, install the Root CA certificate.
  • From your mobile, send server requests and WATCH them get captured by the SELECTED controller.