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.
To install NLoad via NuGet, run the following command in the Package Manager Console
Install-Package NLoad
Implement a class that inherits the ITest interface.
For example:
publicclassMyTest:ITest{publicvoidInitialize(){// Initialize the test, e.g., create a WCF client, load files into memory, etc.}publicTestResultExecute(){// Send an http request, invoke a WCF service or whatever you want to load test.returnTestResult.Success;// or TestResult.Failure}}This class will be created and initialized multiple times during the load test.
Create and configure a load test:
varloadTest=NLoad.Test<MyTest>().WithNumberOfThreads(5).WithDurationOf(TimeSpan.FromMinutes(5)).OnHeartbeat((s,e)=>Console.WriteLine(e.Throughput)).Build();Run it
varresult=loadTest.Run();- Total Errors
- Total Runtime
- Total Iterations
- Min/Max/Average Throughput
- Min/Max/Average Response Time
| 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 |
Apache 2.0