Unit Testing with MSTest.exe

Memory profiling for .NET developers

Moderators: Luke Jefferson, StephenC, AndrewH, melvyn.harbour, james.billings, Laura Morley, dene.boulton

Unit Testing with MSTest.exe

Postby GuyCox » Wed Aug 10, 2011 6:15 pm

I'm attempting to initiate profiling using the MSTest.exe application and the /testcontainer argument and not having much luck .

A console message pops up an error message that quickly disappears before it can be viewed.

The working directory isn't addressed in the application note.

Is there a way to capture the console message? What is the relationship of the Start Directory to the location of the resulting results file?
GuyCox
 
Posts: 5
Joined: Wed Aug 10, 2011 5:16 pm

Postby Brian Donahue » Fri Aug 12, 2011 1:19 pm

Thanks for your post. It's difficult to tell what's going on but if you want to see the console message I guess you could profile cmd.exe with arguments /K "mstest /testcontainer x" and that should theoretically keep the console open.

I don't quite understand the last bit... are you talking about Memory Profiler's current directory setting and the results produced by MSTEST?
Brian Donahue
 
Posts: 6669
Joined: Mon Aug 23, 2004 10:48 am

Postby GuyCox » Fri Aug 12, 2011 1:49 pm

There is a working directory in the options dialog -- it may have not been available when the the tech note on unit testing was writtin for version 6.3.

Whre are the testing results saved when running a unit test with MSText.exe?
GuyCox
 
Posts: 5
Joined: Wed Aug 10, 2011 5:16 pm

Postby Brian Donahue » Fri Aug 12, 2011 2:53 pm

I'd assume they go in the working directory. I'd check the documentation for mstest. I'm afraid I don't know that much about it.
Brian Donahue
 
Posts: 6669
Joined: Mon Aug 23, 2004 10:48 am

Re:

Postby GuyCox » Fri Aug 12, 2011 5:29 pm

Brian Donahue wrote:Thanks for your post. It's difficult to tell what's going on but if you want to see the console message I guess you could profile cmd.exe with arguments /K "mstest /testcontainer x" and that should theoretically keep the console open.

I don't quite understand the last bit... are you talking about Memory Profiler's current directory setting and the results produced by MSTEST?


here's the commandline -- the cmd.exe /k made it even more complex with the nested quoted paths:

C:\\Users\\Guy\\Documents\\Visual Studio 2010\\Projects\\RedGateAntsDemo\\TestProject1\bin\\Debug>profile /e:"C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\Common
7\\IDE\\mstest.exe /testcontainer:TestProject1.dll

This is the location of the compiled test.. The profiler is on the path. The error is:

=========

System.NotSupportedException:
The given path's format is not supported.
at System.Security.Util.StringExpressionSet.CanonicalizePath(String path, Boo
lean needFullPath)
at System.Security.Util.StringExpressionSet.CreateListFromExpressions(String[
] str, Boolean needFullPath)
at System.Security.Permissions.FileIOPermission.AddPathList(FileIOPermissionA
ccess access, AccessControlActions control, String[] pathListOrig, Boolean check
ForDuplicates, Boolean needFullPath, Boolean copyPathList)
at System.Security.Permissions.FileIOPermission..ctor(FileIOPermissionAccess
access, String[] pathList, Boolean checkForDuplicates, Boolean needFullPath)
at System.IO.Path.GetFullPath(String path)
at ↑☼♣.?☼♣.♦►♣(§☼♣ )
at ↑☼♣.?☼♣.♦►♣(§☼♣ )
at ↑☼♣.?☼♣.♦►♣(§☼♣ )
at ↓☼♣.¶?☻.►‼(Licence )
at ↓☼♣.¶?☻.??♥(String[] )

But, it runs fine without the /testcontainer: option, it runs and gives the results for mstest.exe starting up and exxiting...
GuyCox
 
Posts: 5
Joined: Wed Aug 10, 2011 5:16 pm

Postby Brian Donahue » Fri Aug 12, 2011 5:40 pm

I think you want to try this:
C:\\Users\\Guy\\Documents\\Visual Studio 2010\\Projects\\RedGateAntsDemo\\TestProject1bin\\Debug>profile /e:"C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\Common 7\\IDE\\mstest.exe /args:"/testcontainer:TestProject1.dll"


You must put the arguments to the app being profiled in the args argument.
Brian Donahue
 
Posts: 6669
Joined: Mon Aug 23, 2004 10:48 am

Postby GuyCox » Mon Aug 15, 2011 3:25 pm

I take it that you didn't actually try the command line. I got pretty much the same error with your commandline cut and pasted into the command shell --


C:\\Users\\Guy\\Documents\\Visual Studio 2010\\Projects\\RedGateAntsDemo\\TestProject1\\bin\\Debug>profile /e:"C:\\Program Files (x86)\\Microsoft Visual Stud
io 10.0\\Common 7\\IDE\\mstest.exe /args:"/testcontainer:TestProject1.dll"
ANTS Performance Profiler Command Line Utility V6.3.0.147
==============================================================================
Copyright c Red Gate Software Ltd 2010-2011


== Initialising profiler

ANTS Performance Profiler evaluation
log4net:WARN XmlHierarchyConfigurator: Unable to set property [securityContext] on object [log4net.Appender.FileAppender] using value [log4net.Uti
l.NullSecurityContext.Instance] (with acceptable conversion types)

Exception
=========

System.NotSupportedException:
The given path's format is not supported.
at System.Security.Util.StringExpressionSet.CanonicalizePath(String path, Boolean needFullPath)
at System.Security.Util.StringExpressionSet.CreateListFromExpressions(String[] str, Boolean needFullPath)
at System.Security.Permissions.FileIOPermission.AddPathList(FileIOPermissionAccess access, AccessControlActions control, String[] pathListOrig,
Boolean checkForDuplicates, Boolean needFullPath, Boolean copyPathList)
at System.Security.Permissions.FileIOPermission..ctor(FileIOPermissionAccess access, String[] pathList, Boolean checkForDuplicates, Boolean nee
dFullPath)
at System.IO.Path.GetFullPath(String path)
at ↑☼♣.?☼♣.♦►♣(§☼♣ )
at ↑☼♣.?☼♣.♦►♣(§☼♣ )
at ↑☼♣.?☼♣.♦►♣(§☼♣ )
at ↓☼♣.¶?☻.►‼(Licence )
at ↓☼♣.¶?☻.??♥(String[] )


C:\\Users\\Guy\\Documents\\Visual Studio 2010\\Projects\\RedGateAntsDemo\\TestProject1\\bin\\Debug>
GuyCox
 
Posts: 5
Joined: Wed Aug 10, 2011 5:16 pm

Postby Brian Donahue » Tue Aug 16, 2011 4:16 pm

Sorry didn't mean to not be thorough, but there was an obvious error with your command line. But now it looks like some bizarre error coming from Profiler. I would hazard a guess it can't write entries to the log file (%userprofile%\\local settings\\application data\\red gate\\ants performance profiler 6) Are there permissions on that folder?
Brian Donahue
 
Posts: 6669
Joined: Mon Aug 23, 2004 10:48 am

Postby jrg » Wed Aug 17, 2011 10:04 am

I think you're missing the closing " after mstest.exe.

Code: Select all
Profile.exe /e:"c:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\Common7\\IDE\\mstest.exe" /args:"/testcontainer:Foo.dll"


works for me.
jrg
 
Posts: 13
Joined: Fri Jul 02, 2010 3:13 pm


Return to ANTS Memory Profiler 7

Who is online

Users browsing this forum: No registered users and 0 guests