NLoad icon indicating copy to clipboard operation
NLoad copied to clipboard

A simple and easy to use load testing framework for .NET

NLoad

NuGet Build status

NLoad is a simple and easy to use load testing framework for .NET that helps testing Websites, WCF Services and small bits of code to identify and eliminate bottlenecks and concurrency issues.

Installation

To install NLoad via NuGet, run the following command in the Package Manager Console

Install-Package NLoad

Getting Started

Implement a class that inherits the ITest interface.

For example:

public class MyTest : ITest
{
  public void Initialize()
  {
    // Initialize the test, e.g., create a WCF client, load files into memory, etc.
  }

  public TestResult Execute()
  {
    // Send an http request, invoke a WCF service or whatever you want to load test.
    
    return TestResult.Success; // or TestResult.Failure
  }
}

This class will be created and initialized multiple times during the load test.

Create and configure a load test:

var loadTest = NLoad.Test<MyTest>()
		  .WithNumberOfThreads(5)
		  .WithDurationOf(TimeSpan.FromMinutes(5))
		  .OnHeartbeat((s, e) => Console.WriteLine(e.Throughput))
		.Build();

Run it

var result = loadTest.Run();

Load Test Result

  • Total Errors
  • Total Runtime
  • Total Iterations
  • Min/Max/Average Throughput
  • Min/Max/Average Response Time

Events

Event Description
Heartbeat Fired every one second
Starting Fired when the load test is starting
Finished Fired when the load test completes
Aborted Fired when the load test is aborted

License

Apache 2.0