FireBenchmarks

FireBenchmarks is an opensource NUnit addin able to record execution time of unit tests and generate XML, CSV, HTML performances reports with charts and history tracking.

Its' main purpose is to enable a developer or a team that works using XP and agile methodologies like TDD, to increase the software quality

  • integrating performances metrics and analysis into the unit testing environment
  • controlling and monitoring the evolution of a system in terms of algorithmic complexity and system load.
  • driving to a deeper comprehension of code executions flows

Features

The FireBenchmarks architecture is mainly developed around the NUnit EventListeners interface.

Every Nunit test can be associated to the marking attribute NJC_TestPerformanceRecorder, so the addin will recognize it as a test to monitor.

The NJC_TestPerformanceRecorder attribute also contains optional properties that allows the developer to specify metadata and parameters that configure the generated output report.

Requisites

FireBenchmarks require Nunit version 2.5.0 or higher.

Examples

Example 1: a unit test enabled to track execution time...

  • into the filesystem (default choice, no need to specify attribute parameter OutputTargetKind)
  • into an XML file as tracking repository
  • named with the test method name"MyTestMethod.xml"
  • into the destination folder "C:\MyProjects\MyTests\PerformanceRepository"
  • overwriting previously recorded timings
  • without specifing a name
  • without specifing a description
[Test]
[NJC_TestPerformanceRecorder
(
OutputTargetFormat = NJC_TestPerformanceTargetFormat.Xml, // xml file output
OutputTargetIdentificationFormat = NJC_TestPerformanceTargetIdentificationFormat.MethodName, // method name
OutputTarget = "C:\\MyProjects\\MyTests\\PerformanceRepository", // in real-world code, a constant would be better
OutputTargetWriteMode = NJC_TestPerformanceTargetWriteMode.OverWrite // overwrite previous trackings
)]

public void MyTestMethod()
{
    /* place here the code to test AND benchmark*/
}

Example 2: a unit test enabled to track execution time...

  • into the filesystem (default choice, no need to specify attribute parameter OutputTargetKind)
  • into an XHTML file as visual report
  • and an XML file used as tracking repository
  • named with the class full name and test method name "MyTestNameSpace.MyTestClass.MyTestMethod.html"
  • into the destination folder "C:\MyProjects\MyTests\PerformanceRepository"
  • appending the new tracking to previously recorded timings
  • Specifing a name
  • Specifing a description
[Test]
[NJC_TestPerformanceRecorder
(
Name = "Performance test 1",
Description = "This is a unit test used as performance tracking element",
OutputTargetFormat = NJC_TestPerformanceTargetFormat.Html, // Xhtml file output
OutputTargetIdentificationFormat = NJC_TestPerformanceTargetIdentificationFormat.ClassFullNameAndMethodName, // full method name
OutputTarget = "C:\\MyProjects\\MyTests\\PerformanceRepository", // in real-world code, a constant would be better
OutputTargetWriteMode = NJC_TestPerformanceTargetWriteMode.Append // append to previous trackings
)]
public void MyTestMethod()
{
    /* place here the code to test AND benchmark*/
}

See also

  • Test automation

it:FireBenchmarks