Skip to content

Adds an attribute to easily track perfomance tests using NUnit and Application Insights

License

Notifications You must be signed in to change notification settings

MasterDevs/TestInsights

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TestInsights Build status NuGet version

Adds an attribute to easily track performance tests using NUnit and Application Insights

Prerequisites:

NUnit

TestInsights is build on top of NUnit. With it, you can add instrumentation to any of your existing unit tests.

Application Insights configured on Azure

In order to use TestInsights, you need to have an Application insights endpoint configured in Azure.

Quick Start

1. Get From NuGet

Install-Package MasterDevs.TestInsights

2. Add the PerfSetup attribute with your InstrumentationKey

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")]

3. Add the Perf attribute to any test you want to instrument

[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);
}

4. Log on to App Insights and look at your data

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.

Sample Data:

Settings For Sample Data:

          |   |

------------- | --- Chart Type| Grid Aggregation | Avg Chart height | 4 Custom | JoshLongTest, JoshShortTest, LongTest, ShortTest

Thanks

About

Adds an attribute to easily track perfomance tests using NUnit and Application Insights

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages