Search code examples
c#visual-studio-2010performance-testing

Performance tool on CodedUI Tests


Currently I am noticing my automated tests (CodedUI) are running a bit slow at times. I want to run a performance profiling tool on them as they run through VS2010. I have tried to use Red Gate's ANTs Profiler but am confused as to what process (or other?) I am supposed to attach it to.

The closest I came was by starting the Profiler from commandline and having a Mstest.exe call that runs a few tests as the process argument. This only returns me VS method performance and not my own test code.

//e.g
Profile.exe /e:"Mstest /testcontainer:Tests\bin\debug\CodedUITests.dll /test:Login /unique" /csv:"C:\testing\results.csv"

I constructed this command from here and here.

Does anyone know a clean way to kick off a group of tests with a cpu/memory profiler (locally or otherwise) and then read the results?

Available machines in order of preference: Windows 7/XP/Server 2008 R2
Can run from: VS2010, or as part of a Build (TFS/Lab Management)


Solution

  • After reading into it further I found that I needed to instrument my binaries in order for the profiler to know about my methods at runtime. I did this using VSInstr which will convert the test dll into an instrumented one. Then when I run the profiler with my above command line the profiler works.

    i.e

    • Run: VSinstr.exe Your.Tests.dll
    • Open the ANTs Profiler.
    • Select Mstest.exe as the .Net Executable.
    • Set the test projects bin\Debug folder as the Working Directory.
    • In the arguments place:
      /testcontainer:C:\...\YOURTests\bin\debug\Your.Tests.dll /test:LoginTest