Performance testing is essential for ensuring software not only functions correctly but also performs reliably under real-world conditions. As part of b.ignited's Performance Testing Workgroup, I occasionally get to explore new tools or technologies, figure out how they work, what they're good at, and where we could use them. Most recently, that's been NBomber.
So what's NBomber then? It's a .NET library that helps you write performance tests for... honestly, pretty much anything. Which brings me smoothly to the first thing I discovered I really love about NBomber:
1.Performance test anything
NBomber stands out because it doesn't restrict you to "traditional" protocols like HTTP or REST. Instead, it lets you define a scenario using standard C# code, making performance testing possible across an incredibly wide range of targets.
Think about this: You can test everything from raw TCP/UDP communications to custom network protocols, message queues, and even filesystem operations. The possibilities are endless. You're not limited to communication over a network, no doubt with some fiddling you could write a load test for your favourite USB device. Not that this is the goal of Nbomber or its most useful application, but who doesn't love options?
While NBomber has additional convenience libraries for common protocols (like HTTP, use it if that's what you need!), its true power lies in its flexibility. Want to check how your UI components perform under load? Need to measure the latency of a specific database operation? NBomber can handle it all (provided you have valid C# code that represents the interaction).
2.Performance tests in your pipeline
When it comes to actually running these tests, NBomber offers two distinct approaches, each with its own strengths:
If you're looking to quickly prototype or run intensive stress tests, the simplest approach is to embed NBomber directly into a console application. Just add a main
function and go. This method gives you full control over your testing architecture without worrying about framework limitations.
However, for automated CI/CD pipelines, I've found integrating with unit test frameworks like xUnit or NUnit (or MSTest, or TUnit...) to be incredibly powerful. This approach lets NBomber automatically verify performance requirements as part of your regular build process. For example, you can set rules like "ensure no request takes longer than 100ms" and have the tests fail immediately if this requirement isn't met.
What's really cool is how well this integrates with existing development workflows. If you're already running UI or API tests as part of your pipeline, adding NBomber performance checks alongside them gives you comprehensive coverage. Both functional and non-functional requirements are validated automatically. This way, you catch potential performance issues early in development before they become painful to fix later.
3.Reporting
Like any decent performance testing framework, NBomber can output several types of reporting by default. You can for instance, simply have the console output saved to a txt file at its most basic. Then of course, there's an HTML report, which, while fancy, is nothing unusual for this type of tooling.
I must admit, however, that I got perhaps more excited than I should've about the Markdown reports. They're not really anything special, just some tables with numbers in them, but I just can't help but love Markdown (guess what format I write my blogs in). It's not really a typical reporting target, so it was a very nice bonus on top of an already solid tool.
Conclusion
In today's fast-paced development environment, effective performance testing isn’t a mere luxury, so good tooling is a necessity. NBomber's innovative approach to performance testing stands out for its versatility and integration capabilities. Whether you're building microservices, working with legacy systems, or developing modern cloud-native applications, NBomber provides the flexibility needed to ensure your software performs optimally under all conditions.
The tool's seamless integration into CI/CD pipelines and support for various reporting formats make it a valuable addition to any development team's toolkit. As someone who regularly explores performance testing solutions, I'm excited about NBomber's potential to revolutionize how we approach application performance validation in .NET environments.
If you're looking to strengthen your application's performance assurance processes or are seeking a more comprehensive performance testing solution, I strongly encourage you to explore NBomber. Its combination of flexibility, ease of use, and powerful features makes it an excellent choice for teams at any stage of their performance testing journey.
I personally don't get to work a whole lot in .NET these days, but the next time I do I'll definitely be looking at NBomber for my performance testing needs.