Next-Level JMeter: Advanced Performance Strategies
Master JMeter with advanced strategies for performance testing. Learn how to build scalable, efficient, and real-world load tests that truly deliver results.
Next-Level JMeter: Advanced Performance Strategies
Master JMeter with advanced strategies for performance testing. Learn how to build scalable, efficient, and real-world load tests that truly deliver results.
Boost Your Application Performance with JMeter – Powered by QO-BOX
In software testing, performance is key to providing a seamless user experience. Apache JMeter is an open-source tool that helps in load testing, performance testing, and analyzing how applications perform under heavy traffic. It supports multiple protocols like Web, APIs, and Databases, making it a versatile solution for scalability, stability, and reliability testing.
At QO-BOX, we leverage tools like JMeter to ensure your application is robust and ready for real-world demands. Our expert team provides customized test plans, real-time reporting, and CI/CD integration for enhanced performance. https://qo-box.com/
Testing in software development has evolved into a critical discipline, especially for full-stack testers who must ensure applications function seamlessly across different layers. To achieve this, mastering automation and performance testing tools like Selenium, JMeter, and Postman is non-negotiable. When paired with Core Java, these tools become even more powerful, enabling testers to automate workflows efficiently.
Core Java provides the foundation for automation testing due to its:
Let’s explore how these three tools, powered by Core Java, fit into a tester’s workflow.
Selenium is an open-source tool widely used for automating web applications. When integrated with Java, testers can write scalable automation scripts that handle dynamic web elements and complex workflows.

This simple script automates login validation and ensures that the dashboard page loads upon successful login.
JMeter is a powerful performance testing tool used to simulate multiple users interacting with an application. Core Java aids in custom scripting and result analysis, making JMeter tests more versatile.

This Java-based JMeter execution script sets up a test plan with 100 virtual users.
Postman is widely used for API testing, allowing testers to validate RESTful and SOAP services. However, for advanced automation, Postman scripts can be replaced with Java-based REST clients using RestAssured or HTTPClient.

This snippet retrieves a JSON response from a dummy API and prints its contents.
Mastering these tools with Core Java sets full-stack testers apart, enabling them to build comprehensive, scalable, and efficient test automation frameworks.
Q1: Why is Core Java preferred over other languages for testing?
A: Java’s portability, object-oriented features, and vast libraries make it an ideal choice for automation testing.
Q2: Can I use Postman without Java?
A: Yes, but using Java-based libraries like RestAssured provides more control and scalability in API automation.
Q3: How do I choose between Selenium and JMeter?
A: Selenium is for UI automation, while JMeter is for performance testing. If you need both, integrate them.
Q4: Is Java mandatory for Selenium?
A: No, Selenium supports multiple languages, but Java is the most widely used due to its reliability.
Q5: What are the best Java frameworks for test automation?
A: TestNG, JUnit, Cucumber, and RestAssured are the most popular for various types of testing.

Online Class On Performance Testing Using JMeter, Batch Starts On 13th March From 8:00 AM to 9:30 AM

Become a JMeter expert through JMeter Training Institute in Noida. Performance testing with JMeter, one of the most popular tools for load testing and measuring performance, is part of our comprehensive training program. Experienced trainers guide you through real-world scenarios so that you can gain practical expertise in creating and executing performance tests.

Master performance and load testing with the JMeter Online Course. Learn how to use Apache JMeter for web application testing, explore key features like test planning, execution, and reporting, and gain practical insights into stress, performance, and scalability testing. Join now to boost your testing expertise and career opportunities.

Elevate your performance testing skills with our comprehensive JMeter Online Training course. Designed for beginners and experienced professionals alike, this course offers an in-depth understanding of Apache JMeter, a leading open-source tool for load testing and performance measurement.
Understanding Server Performance Metric with JMeter
Server performance is the backbone of any application’s stability, user satisfaction, and overall success. Without careful monitoring, systems can become sluggish or even crash under high traffic, leading to downtime and wasted resources.
That’s where #JMeter steps in. This open-source software testing tool offers robust features for monitoring, analyzing, and improving server performance, making it easier to spot issues and maintain efficiency.
This blog will cover how JMeter streamlines the process of server performance monitoring and why staying on top of these metrics is crucial for keeping your systems running smoothly.

Boost application reliability with top performance testing tools like JMeter, LoadRunner, Gatling, and Apache Bench, ensuring scalability, speed, and optimal user experience.
.

Looking for the best Performance testing Institute in Hyderabad, join Qicon. We offer the best training in Ameerpet Hyderabad, with Quality Trainers, Live projects as well as placement Assistance.

Ihr kennt das Problem sicherlich auch, der Kunde will “mal eben” einen Last und Performance Test durchführen, um an Ergebnisse zu kommen. Meistens wird dazu immer noch Jmeter genutzt, aber ich zeige euch wie man mit diesem Python Skript viel umfassender und flexibler arbeiten kann. Die Anpassungen sind für jedes mögliches Szenario auslegbar, selbst ich habe noch nicht alle Möglichkeiten dieses Skriptes hier entsprechend angepasst.
Einige Ziele, die ich noch nicht umgesetzt habe:
- Grafisches Reporting ähnlich Jmeter
- Besseres Reporting in HTML oder PDF
import requests
import threading
import time
import csv
from tqdm import tqdm
import statistics
import logging
# Todo:
## 1. Logging
## 2. CSV-Datei
## 3. Statistiken
## 4. Auswertung
## 5. Ausgabe
## 6. Dokumentation
## 7. Testen
#Author: Frank Rentmeister 2023
#URL: https://example.com
#Date: 2021-09-30
#Version: 1.0
#Description: Load and Performance Tooling
# Set the log level to DEBUG to log all messages
LOG_FORMAT = ’%(asctime)s - %(name)s - %(levelname)s - %(message)s - %(threadName)s - %(thread)d - %(lineno)d - %(funcName)s - %(process)d - %(processName)s - %(levelname)s - %(message)s - %(pathname)s - %(filename)s - %(module)s - %(exc_info)s - %(exc_text)s - %(created)f - %(relativeCreated)d - %(msecs)d - %(thread)d - %(threadName)s - %(process)d - %(processName)s - %(levelname)s - %(message)s - %(pathname)s - %(filename)s - %(module)s - %(exc_info)s - %(exc_text)s - %(created)f - %(relativeCreated)d - %(msecs)d - %(thread)d - %(threadName)s - %(process)d - %(processName)s - %(levelname)s - %(message)s - %(pathname)s - %(filename)s - %(module)s - %(exc_info)s - %(exc_text)s - %(created)f - %(relativeCreated)d - %(msecs)d - %(thread)d - %(threadName)s - %(process)d - %(processName)s - %(levelname)s - %(message)s - %(pathname)s - %(filename)s - %(module)s - %(exc_info)s - %(exc_text)s - %(created)f - %(relativeCreated)d - %(msecs)d’
logging.basicConfig(level=logging.DEBUG, format=LOG_FORMAT, filename=‘Load_and_Performance_Tooling/Logging/logfile.log’, filemode='w’)
logger = logging.getLogger()
# Example usage of logging
logging.debug('This is a debug message’)
logging.info('This is an info message’)
logging.warning('This is a warning message’)
logging.error('This is an error message’)
logging.critical('This is a critical message’)
logging.info('This is an info message with %s’, 'some parameters’)
logging.info('This is an info message with %s and %s’, 'two’, 'parameters’)
logging.info('This is an info message with %s and %s and %s’, 'three’, 'parameters’, 'here’)
logging.info('This is an info message with %s and %s and %s and %s’, 'four’, 'parameters’, 'here’, 'now’)
logging.info('This is an info message with %s and %s and %s and %s and %s’, 'five’, 'parameters’, 'here’, 'now’, 'again’)
logging.info('This is an info message with %s and %s and %s and %s and %s and %s’, 'six’, 'parameters’, 'here’, 'now’, 'again’, 'and again’)
logging.info('This is an info message with %s and %s and %s and %s and %s and %s and %s’, 'seven’, 'parameters’, 'here’, 'now’, 'again’, 'and again’, 'and again’)
logging.info('This is an info message with %s and %s and %s and %s and %s and %s and %s and %s’, 'eight’, 'parameters’, 'here’, 'now’, 'again’, 'and again’, 'and again’, 'and again’)
logging.info('This is an info message with %s and %s and %s and %s and %s and %s and %s and %s and %s’, 'nine’, 'parameters’, 'here’, 'now’, 'again’, 'and again’, 'and again’, 'and again’, 'and again’)
# URL to test
url = “https://example.com”
assert url.startswith(“http”), “URL must start with http:// or https://” # Make sure the URL starts with http:// or https://
#assert url.count(“.”) >= 2, “URL must contain at least two periods” # Make sure the URL contains at least two periods
assert url.count(“ ”) == 0, “URL must not contain spaces” # Make sure the URL does not contain spaces
# Number of users to simulate
num_users = 2000
# Number of threads to use for testing
num_threads = 10
# NEW- Create a list to hold the response times
def simulate_user_request(url):
try:
response = requests.get(url)
response.raise_for_status() # Raise an exception for HTTP errors
return response.text
except requests.exceptions.RequestException as e:
print(“An error occurred:”, e)
# Define a function to simulate a user making a request
def simulate_user_request(thread_id, progress, response_times):
for i in tqdm(range(num_users//num_threads), desc=f"Thread {thread_id}“, position=thread_id, bar_format=”{l_bar}{bar:20}{r_bar}{bar:-10b}“, colour="green”):
try:
# Make a GET request to the URL
start_time = time.time()
response = requests.get(url)
response_time = time.time() - start_time
response.raise_for_status() # Raise exception if response code is not 2xx
response.close() # Close the connection
# Append the response time to the response_times list
response_times.append(response_time)
# Increment the progress counter for the corresponding thread
progress += 1
except:
pass
# Define a function to split the load among multiple threads
def run_threads(progress, response_times):
# Create a list to hold the threads
threads =
# Start the threads
for i in range(num_threads):
thread = threading.Thread(target=simulate_user_request, args=(i, progress, response_times))
thread.start()
threads.append(thread)
# Wait for the threads to finish
for thread in threads:
thread.join()
# Define a function to run the load test
def run_load_test():
# Start the load test
start_time = time.time()
response_times =
progress = * num_threads # Define the progress list here
with tqdm(total=num_users, desc=f"Overall Progress ({url})“, bar_format=”{l_bar}{bar:20}{r_bar}{bar:-10b}“, colour="green”) as pbar:
while True:
run_threads(progress, response_times) # Pass progress list to run_threads
total_progress = sum(progress)
pbar.update(total_progress - pbar.n)
if total_progress == num_users: # Stop when all users have been simulated
break
time.sleep(0.1) # Wait for threads to catch up
pbar.refresh() # Refresh the progress bar display
# NEW - Calculate the access time statistics
mean_access_time = statistics.mean(response_times)
median_access_time = statistics.median(response_times)
max_access_time = max(response_times)
min_access_time = min(response_times)
# NEW -Print the access time statistics
print(f"Mean access time: {mean_access_time:.3f} seconds")
print(f"Median access time: {median_access_time:.3f} seconds")
print(f"Maximum access time: {max_access_time:.3f} seconds")
print(f"Minimum access time: {min_access_time:.3f} seconds")
#todo: Save the load test results to a CSV file (think about this one)
# hier werden die Zugriffszeiten gesammelt
#access_times = {
# 'https://example.com’: ,
# 'https://example.org’: ,
# 'https://example.net’:
#}
# Calculate the duration of the load test
duration = time.time() - start_time
# Calculate access times and performance metrics
access_times = )/num_threads for i in range(num_users//num_threads)]
mean_access_time = sum(access_times)/len(access_times)
median_access_time = sorted(access_times)
max_access_time = max(access_times)
min_access_time = min(access_times)
throughput = num_users/duration
requests_per_second = throughput/num_threads
# Print the load test results
print(f"Mean access time: {mean_access_time*1000:.2f} milliseconds")
print(f"Load test duration: {duration:.2f} seconds")
print(f"Mean access time: {mean_access_time:.3f} seconds")
print(f"Median access time: {median_access_time:.3f} seconds")
print(f"Maximum access time: {max_access_time:.3f} seconds")
print(f"Minimum access time: {min_access_time:.3f} seconds")
print(f"Throughput: {throughput:.2f} requests/second")
print(f"Requests per second: {requests_per_second:.2f} requests/second")
print(f"Number of users: {num_users}“)
print(f"Number of threads: {num_threads}”)
print(f"Number of requests per user: {num_users/num_threads}“)
print(f"Number of requests per thread: {num_users/num_threads/num_threads}”)
print(f"Number of requests per second: {num_users/duration}“)
print(f"Number of requests per second per thread: {num_users/duration/num_threads}”)
print(f"Number of requests per second per user: {num_users/duration/num_users}“)
print(f"Total duration: {duration:.2f} seconds”)
print(f"Total progress: {sum(progress)}“)
print(f"Total progress per second: {sum(progress)/duration:.2f}”)
print(f"Total progress per second per thread: {sum(progress)/duration/num_threads:.2f}“)
print(f"Total progress per second per user: {sum(progress)/duration/num_users:.2f}”)
print(f"Total progress per thread: {sum(progress)/num_threads:.2f}“)
print(f"Total progress per user: {sum(progress)/num_users:.2f}”)
print(f"Total progress per request: {sum(progress)/num_users/num_threads:.2f}“)
print(f"Total progress per request per second: {sum(progress)/num_users/num_threads/duration:.2f}”)
print(f"Total progress per request per second per thread: {sum(progress)/num_users/num_threads/duration/num_threads:.2f}“)
print(f"Total progress per request per second per user: {sum(progress)/num_users/num_threads/duration/num_users:.2f}”)
print(f"Total progress per request per thread: {sum(progress)/num_users/num_threads:.2f}“)
print(f"Total progress per request per user: {sum(progress)/num_users/num_threads:.2f}”)
print(f"Total progress per second per request: {sum(progress)/duration/num_users/num_threads:.2f}“)
print(f"Total progress per second per request per thread: {sum(progress)/duration/num_users/num_threads/num_threads:.2f}”)
print(f"Total progress per second per request per user: {sum(progress)/duration/num_users/num_threads/num_users:.2f}“)
# Save the load test results to a CSV file
with open("load_test_results.csv”, “w”, newline=“) as csv_file:
fieldnames =
# Create a CSV writer
csv_writer = csv.DictWriter(csv_file, fieldnames=fieldnames, delimiter=”,“, quotechar=’”’, quoting=csv.QUOTE_MINIMAL)
csv_writer.writeheader()
# Write the load test results to the CSV file
csv_writer.writerow({“Metric”: “Average Response Time (seconds)”, “Value”: mean_access_time, “Short Value”: round(mean_access_time, 3)})
csv_writer.writerow({“Metric”: “Load Test Duration (seconds)”, “Value”: duration, “Short Value”: round(duration, 2)})
csv_writer.writerow({“Metric”: “Mean Access Time (milliseconds)”, “Value”: mean_access_time * 1000, “Short Value”: round(mean_access_time * 1000, 2)})
csv_writer.writerow({“Metric”: “Median Access Time (seconds)”, “Value”: median_access_time, “Short Value”: round(median_access_time, 3)})
csv_writer.writerow({“Metric”: “Maximum Access Time (seconds)”, “Value”: max_access_time, “Short Value”: round(max_access_time, 3)})
csv_writer.writerow({“Metric”: “Minimum Access Time (seconds)”, “Value”: min_access_time, “Short Value”: round(min_access_time, 3)})
csv_writer.writerow({“Metric”: “Throughput (requests/second)”, “Value”: throughput, “Short Value”: round(throughput, 2)})
csv_writer.writerow({“Metric”: “Requests per Second (requests/second)”, “Value”: requests_per_second, “Short Value”: round(requests_per_second, 2)})
csv_writer.writerow({“Metric”: “Number of Users”, “Value”: num_users, “Short Value”: num_users})
csv_writer.writerow({“Metric”: “Number of Threads”, “Value”: num_threads, “Short Value”: num_threads})
csv_writer.writerow({“Metric”: “Number of Requests per User”, “Value”: num_users / num_threads, “Short Value”: round(num_users / num_threads)})
csv_writer.writerow({“Metric”: “Number of Requests per Thread”, “Value”: num_users / (num_threads * num_threads), “Short Value”: round(num_users / (num_threads * num_threads))})
csv_writer.writerow({“Metric”: “Number of Requests per Second”, “Value”: num_users / duration, “Short Value”: round(num_users / duration)})
csv_writer.writerow({“Metric”: “Number of Requests per Second per Thread”, “Value”: num_users / (duration * num_threads), “Short Value”: round(num_users / (duration * num_threads))})
csv_writer.writerow({“Metric”: “Number of Requests per Second per User”, “Value”: num_users / (duration * num_users), “Short Value”: round(num_users / (duration * num_users))})
csv_writer.writerow({“Metric”: “Number of Requests per Minute”, “Value”: num_users / duration * 60, “Short Value”: round(num_users / duration * 60)})
csv_writer.writerow({“Metric”: “Number of Requests per Minute per Thread”, “Value”: num_users / (duration * num_threads) * 60, “Short Value”: round(num_users / (duration * num_threads) * 60)})
csv_writer.writerow({“Metric”: “Number of Requests per Minute per User”, “Value”: num_users / (duration * num_users) * 60, “Short Value”: round(num_users / (duration * num_users) * 60)})
csv_writer.writerow({“Metric”: “Number of Requests per Hour”, “Value”: num_users / duration * 60 * 60, “Short Value”: round(num_users / duration * 60 * 60)})
csv_writer.writerow({“Metric”: “Number of Requests per Hour per Thread”, “Value”: num_users / (duration * num_threads) * 60 * 60, “Short Value”: round(num_users / (duration * num_threads) * 60 * 60)})
csv_writer.writerow({“Metric”: “Number of Requests per Hour per User”, “Value”: num_users / (duration * num_users) * 60 * 60, “Short Value”: round(num_users / (duration * num_users) * 60 * 60)})
csv_writer.writerow({“Metric”: “Number of Requests per Day”, “Value”: num_users / duration * 60 * 60 * 24, “Short Value”: round(num_users / duration * 60 * 60 * 24)})
csv_writer.writerow({“Metric”: “Number of Requests per Day per Thread”, “Value”: num_users / (duration * num_threads) * 60 * 60 * 24, “Short Value”: round(num_users / (duration * num_threads) * 60 * 60 * 24)})
csv_writer.writerow({“Metric”: “Number of Requests per Day per User”, “Value”: num_users / (duration * num_users) * 60 * 60 * 24, “Short Value”: round(num_users / (duration * num_users) * 60 * 60 * 24)})
csv_writer.writerow({“Metric”: “Number of Requests per Month”, “Value”: num_users / duration * 60 * 60 * 24 * 30, “Short Value”: round(num_users / duration * 60 * 60 * 24 * 30)})
csv_writer.writerow({“Metric”: “Number of Requests per Month per Thread”, “Value”: num_users / (duration * num_threads) * 60 * 60 * 24 * 30, “Short Value”: round(num_users / (duration * num_threads) * 60 * 60 * 24 * 30)})
csv_writer.writerow({“Metric”: “Number of Requests per Month per User”, “Value”: num_users / (duration * num_users) * 60 * 60 * 24 * 30, “Short Value”: round(num_users / (duration * num_users) * 60 * 60 * 24 * 30)})
csv_writer.writerow({“Metric”: “Number of Requests per Year”, “Value”: num_users / duration * 60 * 60 * 24 * 365, “Short Value”: round(num_users / duration * 60 * 60 * 24 * 365)})
csv_writer.writerow({“Metric”: “Number of Requests per Year per Thread”, “Value”: num_users / (duration * num_threads) * 60 * 60 * 24 * 365, “Short Value”: round(num_users / (duration * num_threads) * 60 * 60 * 24 * 365)})
csv_writer.writerow({“Metric”: “Number of Requests per Year per User”, “Value”: num_users / (duration * num_users) * 60 * 60 * 24 * 365, “Short Value”: round(num_users / (duration * num_users) * 60 * 60 * 24 * 365)})
#csv_writer.writeheader() # Add an empty row to separate the access times from the metrics
#csv_writer.writerow({“Metric”: “Access Time (seconds)”, “Value”: None})
# Write the access times to the CSV file
csv_writer.writerow({“Metric”: “Access Time (seconds)”, “Value”: None})
for access_time in response_times:
csv_writer.writerow({“Metric”: None, “Value”: access_time})
# Sort the response times and write them to the CSV file
response_times.sort()
for response_time in response_times:
csv_writer.writerow({“Metric”: None, “Value”: response_time})
# Run the load test
run_load_test()
# Path: Load_and_Performance/test_100_user.py
##### Documentation #####
“’
- The script imports the necessary modules for load testing, such as requests for making HTTP requests, threading for running multiple threads simultaneously, time for measuring time, csv for reading and writing CSV files, tqdm for displaying a progress bar, statistics for calculating performance metrics, and logging for logging messages.
- The script defines the URL to test and checks that it starts with "http://” or “https://”, that it contains at least two periods, and that it does not contain any spaces.
- The script sets the number of users to simulate and the number of threads to use for testing.
- The script defines a function called simulate_user_request() that simulates a user making a request to the URL. The function makes a GET request to the URL, measures the response time, and appends the response time to a list called response_times. The function also increments the progress counter for the corresponding thread. The function takes three arguments: thread_id, progress, and response_times.
- The script defines a function called run_threads() that splits the load among multiple threads. The function creates a list to hold the threads, starts each thread, and waits for all threads to finish. The function takes two arguments: progress and response_times.
- The script defines a function called run_load_test() that runs the load test. The function initializes the response_times list and a progress list that will keep track of the progress for each thread. The function then starts a progress bar using the tqdm module and enters a loop that runs until all users have been simulated. In each iteration of the loop, the function calls run_threads() to split the load among multiple threads, updates the progress bar, and waits for the threads to catch up.
Read the full article

Ihr kennt das Problem sicherlich auch, der Kunde will “mal eben” einen Last und Performance Test durchführen, um an Ergebnisse zu kommen. Meistens wird dazu immer noch Jmeter genutzt, aber ich zeige euch wie man mit diesem Python Skript viel umfassender und flexibler arbeiten kann. Die Anpassungen sind für jedes mögliches Szenario auslegbar, selbst ich habe noch nicht alle Möglichkeiten dieses Skriptes hier entsprechend angepasst.
Einige Ziele, die ich noch nicht umgesetzt habe:
- Grafisches Reporting ähnlich Jmeter
- Besseres Reporting in HTML oder PDF
import requests
import threading
import time
import csv
from tqdm import tqdm
import statistics
import logging
# Todo:
## 1. Logging
## 2. CSV-Datei
## 3. Statistiken
## 4. Auswertung
## 5. Ausgabe
## 6. Dokumentation
## 7. Testen
#Author: Frank Rentmeister 2023
#URL: https://example.com
#Date: 2021-09-30
#Version: 1.0
#Description: Load and Performance Tooling
# Set the log level to DEBUG to log all messages
LOG_FORMAT = ’%(asctime)s - %(name)s - %(levelname)s - %(message)s - %(threadName)s - %(thread)d - %(lineno)d - %(funcName)s - %(process)d - %(processName)s - %(levelname)s - %(message)s - %(pathname)s - %(filename)s - %(module)s - %(exc_info)s - %(exc_text)s - %(created)f - %(relativeCreated)d - %(msecs)d - %(thread)d - %(threadName)s - %(process)d - %(processName)s - %(levelname)s - %(message)s - %(pathname)s - %(filename)s - %(module)s - %(exc_info)s - %(exc_text)s - %(created)f - %(relativeCreated)d - %(msecs)d - %(thread)d - %(threadName)s - %(process)d - %(processName)s - %(levelname)s - %(message)s - %(pathname)s - %(filename)s - %(module)s - %(exc_info)s - %(exc_text)s - %(created)f - %(relativeCreated)d - %(msecs)d - %(thread)d - %(threadName)s - %(process)d - %(processName)s - %(levelname)s - %(message)s - %(pathname)s - %(filename)s - %(module)s - %(exc_info)s - %(exc_text)s - %(created)f - %(relativeCreated)d - %(msecs)d’
logging.basicConfig(level=logging.DEBUG, format=LOG_FORMAT, filename=‘Load_and_Performance_Tooling/Logging/logfile.log’, filemode='w’)
logger = logging.getLogger()
# Example usage of logging
logging.debug('This is a debug message’)
logging.info('This is an info message’)
logging.warning('This is a warning message’)
logging.error('This is an error message’)
logging.critical('This is a critical message’)
logging.info('This is an info message with %s’, 'some parameters’)
logging.info('This is an info message with %s and %s’, 'two’, 'parameters’)
logging.info('This is an info message with %s and %s and %s’, 'three’, 'parameters’, 'here’)
logging.info('This is an info message with %s and %s and %s and %s’, 'four’, 'parameters’, 'here’, 'now’)
logging.info('This is an info message with %s and %s and %s and %s and %s’, 'five’, 'parameters’, 'here’, 'now’, 'again’)
logging.info('This is an info message with %s and %s and %s and %s and %s and %s’, 'six’, 'parameters’, 'here’, 'now’, 'again’, 'and again’)
logging.info('This is an info message with %s and %s and %s and %s and %s and %s and %s’, 'seven’, 'parameters’, 'here’, 'now’, 'again’, 'and again’, 'and again’)
logging.info('This is an info message with %s and %s and %s and %s and %s and %s and %s and %s’, 'eight’, 'parameters’, 'here’, 'now’, 'again’, 'and again’, 'and again’, 'and again’)
logging.info('This is an info message with %s and %s and %s and %s and %s and %s and %s and %s and %s’, 'nine’, 'parameters’, 'here’, 'now’, 'again’, 'and again’, 'and again’, 'and again’, 'and again’)
# URL to test
url = “https://example.com”
assert url.startswith(“http”), “URL must start with http:// or https://” # Make sure the URL starts with http:// or https://
#assert url.count(“.”) >= 2, “URL must contain at least two periods” # Make sure the URL contains at least two periods
assert url.count(“ ”) == 0, “URL must not contain spaces” # Make sure the URL does not contain spaces
# Number of users to simulate
num_users = 2000
# Number of threads to use for testing
num_threads = 10
# NEW- Create a list to hold the response times
def simulate_user_request(url):
try:
response = requests.get(url)
response.raise_for_status() # Raise an exception for HTTP errors
return response.text
except requests.exceptions.RequestException as e:
print(“An error occurred:”, e)
# Define a function to simulate a user making a request
def simulate_user_request(thread_id, progress, response_times):
for i in tqdm(range(num_users//num_threads), desc=f"Thread {thread_id}“, position=thread_id, bar_format=”{l_bar}{bar:20}{r_bar}{bar:-10b}“, colour="green”):
try:
# Make a GET request to the URL
start_time = time.time()
response = requests.get(url)
response_time = time.time() - start_time
response.raise_for_status() # Raise exception if response code is not 2xx
response.close() # Close the connection
# Append the response time to the response_times list
response_times.append(response_time)
# Increment the progress counter for the corresponding thread
progress += 1
except:
pass
# Define a function to split the load among multiple threads
def run_threads(progress, response_times):
# Create a list to hold the threads
threads =
# Start the threads
for i in range(num_threads):
thread = threading.Thread(target=simulate_user_request, args=(i, progress, response_times))
thread.start()
threads.append(thread)
# Wait for the threads to finish
for thread in threads:
thread.join()
# Define a function to run the load test
def run_load_test():
# Start the load test
start_time = time.time()
response_times =
progress = * num_threads # Define the progress list here
with tqdm(total=num_users, desc=f"Overall Progress ({url})“, bar_format=”{l_bar}{bar:20}{r_bar}{bar:-10b}“, colour="green”) as pbar:
while True:
run_threads(progress, response_times) # Pass progress list to run_threads
total_progress = sum(progress)
pbar.update(total_progress - pbar.n)
if total_progress == num_users: # Stop when all users have been simulated
break
time.sleep(0.1) # Wait for threads to catch up
pbar.refresh() # Refresh the progress bar display
# NEW - Calculate the access time statistics
mean_access_time = statistics.mean(response_times)
median_access_time = statistics.median(response_times)
max_access_time = max(response_times)
min_access_time = min(response_times)
# NEW -Print the access time statistics
print(f"Mean access time: {mean_access_time:.3f} seconds")
print(f"Median access time: {median_access_time:.3f} seconds")
print(f"Maximum access time: {max_access_time:.3f} seconds")
print(f"Minimum access time: {min_access_time:.3f} seconds")
#todo: Save the load test results to a CSV file (think about this one)
# hier werden die Zugriffszeiten gesammelt
#access_times = {
# 'https://example.com’: ,
# 'https://example.org’: ,
# 'https://example.net’:
#}
# Calculate the duration of the load test
duration = time.time() - start_time
# Calculate access times and performance metrics
access_times = )/num_threads for i in range(num_users//num_threads)]
mean_access_time = sum(access_times)/len(access_times)
median_access_time = sorted(access_times)
max_access_time = max(access_times)
min_access_time = min(access_times)
throughput = num_users/duration
requests_per_second = throughput/num_threads
# Print the load test results
print(f"Mean access time: {mean_access_time*1000:.2f} milliseconds")
print(f"Load test duration: {duration:.2f} seconds")
print(f"Mean access time: {mean_access_time:.3f} seconds")
print(f"Median access time: {median_access_time:.3f} seconds")
print(f"Maximum access time: {max_access_time:.3f} seconds")
print(f"Minimum access time: {min_access_time:.3f} seconds")
print(f"Throughput: {throughput:.2f} requests/second")
print(f"Requests per second: {requests_per_second:.2f} requests/second")
print(f"Number of users: {num_users}“)
print(f"Number of threads: {num_threads}”)
print(f"Number of requests per user: {num_users/num_threads}“)
print(f"Number of requests per thread: {num_users/num_threads/num_threads}”)
print(f"Number of requests per second: {num_users/duration}“)
print(f"Number of requests per second per thread: {num_users/duration/num_threads}”)
print(f"Number of requests per second per user: {num_users/duration/num_users}“)
print(f"Total duration: {duration:.2f} seconds”)
print(f"Total progress: {sum(progress)}“)
print(f"Total progress per second: {sum(progress)/duration:.2f}”)
print(f"Total progress per second per thread: {sum(progress)/duration/num_threads:.2f}“)
print(f"Total progress per second per user: {sum(progress)/duration/num_users:.2f}”)
print(f"Total progress per thread: {sum(progress)/num_threads:.2f}“)
print(f"Total progress per user: {sum(progress)/num_users:.2f}”)
print(f"Total progress per request: {sum(progress)/num_users/num_threads:.2f}“)
print(f"Total progress per request per second: {sum(progress)/num_users/num_threads/duration:.2f}”)
print(f"Total progress per request per second per thread: {sum(progress)/num_users/num_threads/duration/num_threads:.2f}“)
print(f"Total progress per request per second per user: {sum(progress)/num_users/num_threads/duration/num_users:.2f}”)
print(f"Total progress per request per thread: {sum(progress)/num_users/num_threads:.2f}“)
print(f"Total progress per request per user: {sum(progress)/num_users/num_threads:.2f}”)
print(f"Total progress per second per request: {sum(progress)/duration/num_users/num_threads:.2f}“)
print(f"Total progress per second per request per thread: {sum(progress)/duration/num_users/num_threads/num_threads:.2f}”)
print(f"Total progress per second per request per user: {sum(progress)/duration/num_users/num_threads/num_users:.2f}“)
# Save the load test results to a CSV file
with open("load_test_results.csv”, “w”, newline=“) as csv_file:
fieldnames =
# Create a CSV writer
csv_writer = csv.DictWriter(csv_file, fieldnames=fieldnames, delimiter=”,“, quotechar=’”’, quoting=csv.QUOTE_MINIMAL)
csv_writer.writeheader()
# Write the load test results to the CSV file
csv_writer.writerow({“Metric”: “Average Response Time (seconds)”, “Value”: mean_access_time, “Short Value”: round(mean_access_time, 3)})
csv_writer.writerow({“Metric”: “Load Test Duration (seconds)”, “Value”: duration, “Short Value”: round(duration, 2)})
csv_writer.writerow({“Metric”: “Mean Access Time (milliseconds)”, “Value”: mean_access_time * 1000, “Short Value”: round(mean_access_time * 1000, 2)})
csv_writer.writerow({“Metric”: “Median Access Time (seconds)”, “Value”: median_access_time, “Short Value”: round(median_access_time, 3)})
csv_writer.writerow({“Metric”: “Maximum Access Time (seconds)”, “Value”: max_access_time, “Short Value”: round(max_access_time, 3)})
csv_writer.writerow({“Metric”: “Minimum Access Time (seconds)”, “Value”: min_access_time, “Short Value”: round(min_access_time, 3)})
csv_writer.writerow({“Metric”: “Throughput (requests/second)”, “Value”: throughput, “Short Value”: round(throughput, 2)})
csv_writer.writerow({“Metric”: “Requests per Second (requests/second)”, “Value”: requests_per_second, “Short Value”: round(requests_per_second, 2)})
csv_writer.writerow({“Metric”: “Number of Users”, “Value”: num_users, “Short Value”: num_users})
csv_writer.writerow({“Metric”: “Number of Threads”, “Value”: num_threads, “Short Value”: num_threads})
csv_writer.writerow({“Metric”: “Number of Requests per User”, “Value”: num_users / num_threads, “Short Value”: round(num_users / num_threads)})
csv_writer.writerow({“Metric”: “Number of Requests per Thread”, “Value”: num_users / (num_threads * num_threads), “Short Value”: round(num_users / (num_threads * num_threads))})
csv_writer.writerow({“Metric”: “Number of Requests per Second”, “Value”: num_users / duration, “Short Value”: round(num_users / duration)})
csv_writer.writerow({“Metric”: “Number of Requests per Second per Thread”, “Value”: num_users / (duration * num_threads), “Short Value”: round(num_users / (duration * num_threads))})
csv_writer.writerow({“Metric”: “Number of Requests per Second per User”, “Value”: num_users / (duration * num_users), “Short Value”: round(num_users / (duration * num_users))})
csv_writer.writerow({“Metric”: “Number of Requests per Minute”, “Value”: num_users / duration * 60, “Short Value”: round(num_users / duration * 60)})
csv_writer.writerow({“Metric”: “Number of Requests per Minute per Thread”, “Value”: num_users / (duration * num_threads) * 60, “Short Value”: round(num_users / (duration * num_threads) * 60)})
csv_writer.writerow({“Metric”: “Number of Requests per Minute per User”, “Value”: num_users / (duration * num_users) * 60, “Short Value”: round(num_users / (duration * num_users) * 60)})
csv_writer.writerow({“Metric”: “Number of Requests per Hour”, “Value”: num_users / duration * 60 * 60, “Short Value”: round(num_users / duration * 60 * 60)})
csv_writer.writerow({“Metric”: “Number of Requests per Hour per Thread”, “Value”: num_users / (duration * num_threads) * 60 * 60, “Short Value”: round(num_users / (duration * num_threads) * 60 * 60)})
csv_writer.writerow({“Metric”: “Number of Requests per Hour per User”, “Value”: num_users / (duration * num_users) * 60 * 60, “Short Value”: round(num_users / (duration * num_users) * 60 * 60)})
csv_writer.writerow({“Metric”: “Number of Requests per Day”, “Value”: num_users / duration * 60 * 60 * 24, “Short Value”: round(num_users / duration * 60 * 60 * 24)})
csv_writer.writerow({“Metric”: “Number of Requests per Day per Thread”, “Value”: num_users / (duration * num_threads) * 60 * 60 * 24, “Short Value”: round(num_users / (duration * num_threads) * 60 * 60 * 24)})
csv_writer.writerow({“Metric”: “Number of Requests per Day per User”, “Value”: num_users / (duration * num_users) * 60 * 60 * 24, “Short Value”: round(num_users / (duration * num_users) * 60 * 60 * 24)})
csv_writer.writerow({“Metric”: “Number of Requests per Month”, “Value”: num_users / duration * 60 * 60 * 24 * 30, “Short Value”: round(num_users / duration * 60 * 60 * 24 * 30)})
csv_writer.writerow({“Metric”: “Number of Requests per Month per Thread”, “Value”: num_users / (duration * num_threads) * 60 * 60 * 24 * 30, “Short Value”: round(num_users / (duration * num_threads) * 60 * 60 * 24 * 30)})
csv_writer.writerow({“Metric”: “Number of Requests per Month per User”, “Value”: num_users / (duration * num_users) * 60 * 60 * 24 * 30, “Short Value”: round(num_users / (duration * num_users) * 60 * 60 * 24 * 30)})
csv_writer.writerow({“Metric”: “Number of Requests per Year”, “Value”: num_users / duration * 60 * 60 * 24 * 365, “Short Value”: round(num_users / duration * 60 * 60 * 24 * 365)})
csv_writer.writerow({“Metric”: “Number of Requests per Year per Thread”, “Value”: num_users / (duration * num_threads) * 60 * 60 * 24 * 365, “Short Value”: round(num_users / (duration * num_threads) * 60 * 60 * 24 * 365)})
csv_writer.writerow({“Metric”: “Number of Requests per Year per User”, “Value”: num_users / (duration * num_users) * 60 * 60 * 24 * 365, “Short Value”: round(num_users / (duration * num_users) * 60 * 60 * 24 * 365)})
#csv_writer.writeheader() # Add an empty row to separate the access times from the metrics
#csv_writer.writerow({“Metric”: “Access Time (seconds)”, “Value”: None})
# Write the access times to the CSV file
csv_writer.writerow({“Metric”: “Access Time (seconds)”, “Value”: None})
for access_time in response_times:
csv_writer.writerow({“Metric”: None, “Value”: access_time})
# Sort the response times and write them to the CSV file
response_times.sort()
for response_time in response_times:
csv_writer.writerow({“Metric”: None, “Value”: response_time})
# Run the load test
run_load_test()
# Path: Load_and_Performance/test_100_user.py
##### Documentation #####
“’
- The script imports the necessary modules for load testing, such as requests for making HTTP requests, threading for running multiple threads simultaneously, time for measuring time, csv for reading and writing CSV files, tqdm for displaying a progress bar, statistics for calculating performance metrics, and logging for logging messages.
- The script defines the URL to test and checks that it starts with "http://” or “https://”, that it contains at least two periods, and that it does not contain any spaces.
- The script sets the number of users to simulate and the number of threads to use for testing.
- The script defines a function called simulate_user_request() that simulates a user making a request to the URL. The function makes a GET request to the URL, measures the response time, and appends the response time to a list called response_times. The function also increments the progress counter for the corresponding thread. The function takes three arguments: thread_id, progress, and response_times.
- The script defines a function called run_threads() that splits the load among multiple threads. The function creates a list to hold the threads, starts each thread, and waits for all threads to finish. The function takes two arguments: progress and response_times.
- The script defines a function called run_load_test() that runs the load test. The function initializes the response_times list and a progress list that will keep track of the progress for each thread. The function then starts a progress bar using the tqdm module and enters a loop that runs until all users have been simulated. In each iteration of the loop, the function calls run_threads() to split the load among multiple threads, updates the progress bar, and waits for the threads to catch up.
Read the full article
La calidad del software es un factor clave para garantizar el buen funcionamiento de cualquier proyecto, especialmente en las empresas, donde su correcta implementación resulta fundamental para el correcto desarrollo de los procesos. A continuación, te ofrecemos 10 consejos para asegurar la calidad de tu software.
Define tus objetivos y requisitos de calidad: Antes de comenzar cualquier proyecto…

JMeter Online Training in India | Croma Campus
Jmeter Online Training
JMeter, a Java programmer used as a traffic testing tool for behavior and performance monitoring, particularly for web applications, is the subject of the JMeter Online Training programmer, which is intended to give students technical expertise and an understanding of JMeter.

Java microservices can be as fast as Go, if they are designed and implemented correctly. Java is a compelling language, and if used effectively, it can be as performant as Go. Additionally, Java has a more extensive library of tools, making it easier to develop complex applications quickly. This article shows the effect of using GraalVM native image in the benchmark.
The increase in the need to assess the performance of applications, websites, and servers in alignment with a rising need to offer better customer services are the factors facilitating the growth of the load-testing software market. JMeter has a market share of approximately 25.76% considering the performance and load-testing market. The performance testing tools market around the world is predicted to increase by more than USD 3.02 billion by the end of 2030. Different benefits generated by the software include faster testing and streamlines, automatic operational testing, and several others. These are further enhancing the market need for load-testing tools.
How to install and conduct performance testing using Apache JMeter on your Web App
JMeter is an Open Source Java application designed to measure performance and load test applications. Apache JMeter can measure performance and load test static and dynamic web 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. We have the JMeter GUI mode and…

How to Perform Load Test on Mobile App using Apache JMeter installed on your Windows System
JMeter is an Open Source Java application designed to measure performance and load test applications. Apache JMeter can measure performance and load test static and dynamic web 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. Performance testing on your Mobile…
