Skip to content

Instantly share code, notes, and snippets.

@hjerpbakk
Created April 3, 2013 13:03
Show Gist options
  • Save hjerpbakk/5301029 to your computer and use it in GitHub Desktop.
Save hjerpbakk/5301029 to your computer and use it in GitHub Desktop.
Shows a message box containing the duration of all tests in an MSTest test class.
private static Stopwatch testTimer;
[ClassInitialize]
public static void ClassInit(TestContext testContext)
{
testTimer = new Stopwatch();
testTimer.Start();
}
[ClassCleanup]
public static void ClassCleanup()
{
testTimer.Stop();
MessageBox.Show(string.Format("Test duration {0} milliseconds.", testTimer.ElapsedMilliseconds));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment