Adds an attribute to easily track performance tests using NUnit and Application Insights
TestInsights is build on top of NUnit. With it, you can add instrumentation to any of your existing unit tests.
In order to use TestInsights, you need to have an Application insights endpoint configured in Azure.
Install-Package MasterDevs.TestInsights
You will need the instrumentation key that corresponds to the Application Insights configured in the prerequisites.
To find your InstrumentationKey log on to your Azure instanc and
This only needs to be added once.
using MasterDevs.TestInsights;
// ...
[assembly: PerfSetup("3d9e18a2-8c48-8c48-8c48-cb0bb325679")]
[Test]
[Perf]
public void ShortTest()
{
Assert.IsTrue(true);
}
Optionally, you can set the EventName
property on Perf. This allows you to control what the test is reported as to Application Insights
[Test]
[Perf(EventName = "TestWithAGoodName")]
public void TestWithAUselessName()
{
Assert.IsTrue(true);
}
Note: Data tends to take some time to refresh in Application Insights. If you don't see it right away, wait a 5 - 15 minutes and it should be there.
Settings For Sample Data:
| |
------------- | --- Chart Type| Grid Aggregation | Avg Chart height | 4 Custom | JoshLongTest, JoshShortTest, LongTest, ShortTest
- Thanks to NUnit