header header
Skip Navigation Links  
Feeds & tools
Digg.itDel.icio.usFURLRedditYahooBlinklistGooglema.gnoliaShadowsTechnoratiBlogLinesNewsBurstRojoRSSMailFacebookMAIN RSSPAGE RSSPrintRefresh
Sponsors & Partners

CULTURE Usage samples
Here below there are some usage samples of the NJC_TestPerformanceRecorderAttribute
Considering that all the parameters of the NJC_TestPerformanceRecorderAttribute are optional and have a default value, only the ones that should have different values from their default must be specified.
by sa (created on the 05/07/2009 02:16)
 Table of contents
Sample 1
Sample 2
Sample 3
Sample 1Sample 1
Track a test...
  • 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*/
}

Sample 2Sample 2
Track a test...
  • 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
  • without specifing a name
  • without specifing a description

[Test]
[NJC_TestPerformanceRecorder
(
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*/
}

Sample 3Sample 3
Track a test...
  • into the filesystem (default choice, no need to specify attribute parameter OutputTargetKind)
  • into a CSV file as visual report and tracking repository
  • named with the class and test method name "MyTestClass.MyTestMethod.csv"
  • 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.Csv, // Csv file output
OutputTargetIdentificationFormat = NJC_TestPerformanceTargetIdentificationFormat.ClassNameAndMethodName, // class and 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*/
}

Do you like this ?
Stats by ClustrMaps
Locations of visitors to this page
Stats by ShinyStats
FireBenchmarks
Login
 
 
Vote it !
kick it on DotNetKicks.com Shout it
Skip Navigation Links
HOME
THE PROJECT
ARCHITECTURE
OUTPUT SAMPLES
USAGE SAMPLES
FAQs
DOWNLOADS
LICENSE
WRITE US
Copyright © 2010 Firebenchmarks - NUnit driven performance testing
Email info@firebenchmarks.com


Concept by Dogma Solutions
Engine by Dogma Solutions