Reputation: 93
I've read and read and read for days, and I give up. There are articles that tell you how to do this -- almost. Either how to rename a specific results file, or for testing within MSBuild (TONS of these), or changing the ROOT of the file placement folder structure. Those answers are not helpful. I'm testing directly in VS 2012. [SadFace] Google was not my friend this time.
On our test machines, VS 2012 creates test output files at the bottom of a long folder structure. It looks like this (including the files):
<solutionFolder>\
TestResults\
<TestNameFrom.testSettingsFileWithDateAndTime>\
In\
<GuidForThisTestRun>\
<machineName>\
RecordedMedia.trmx
ScreenCapture.wmv
UITestActionLog.html
This file structure is not only unreasonable (as there is no correlation between a test and it's folder) it is also hard to navigate. And there's NOTHING in any of the folders from TestResults on down until the machine name folder. That means we have to navigate three extra folders EVERY TIME we need to look through the test results or forward them to the developers (assuming we can figure out which to look in).
If there are multiple tests in the run, there will be multiple GUIDs in the "In" folder, with a folder named "machine-name" in that, and the test result files in the machine name folder. For example (including the files):
RegressionTesting\
TestResults\
WebRegressionTests _2015-09-23 14_27_20_\
In\
36fe2581-7e14-c3d0-b0fa-1956665ab20d\
DEV0282C\
RecordedMedia.trmx
ScreenCapture.wmv
UITestActionLog.html
e3448182-eb47-1840-cbde-ca5bd5660270\
DEV0282C\
RecordedMedia.trmx
ScreenCapture.wmv
UITestActionLog.html
ed71d0f3-4fc5-42ab-96e3-b68efecdf4d8\
DEV0282C\
RecordedMedia.trmx
ScreenCapture.wmv
UITestActionLog.html
(There's also an "Out" folder, a sibling to "In", but it's always empty.)
What I'd like is to specify the folder structure myself, to include (beside the date and time) the test case name and number (from Microsoft Test Manager), but to EXCLUDE those three empty, unused, useless folder layers. My ideal folder structure looks like this:
Regression\
TestResults\
64105 Delete Bumpuses Dogs 2015-09-23 14_27_20\
RecordedMedia.trmx
ScreenCapture.wmv
UITestActionLog.html
By exploration, I found that TestContext.TestResultsDirectory contains the absolute path to the results folder. I considered trying to set the folder name in code, but TestContext.TestResultsDirectory is read-only. Sad. Would'a been so easy . . .
I've also considered just manually renaming folders and moving files at the end of the test after the browser closes. Problem: The files are (apparently) created in some temp folder somewhere, and are not moved to their documented folders until after the user code has exited.
Here are two of the pages I've read (that's all I'm allowed to post!?!?):
VS2012 Unit Tests: How to change the location of the TestResults folder (Poor Thomans never got an answer to this question. I fear I'll be in the same boat.)
https://msdn.microsoft.com/en-us/library/jj635153.aspx
Upvotes: 0
Views: 1096
Reputation: 14038
The name of the folder can be changed via the "Test results names" page in the editor for the .testsettings
file. The page can be seen in this image from Visual Studio 2013 Ultimate edition.
I do not know of any way to alter the layout of the directories that hold test results.
The out
directory is where files used for the tests are deployed. Depending on the type of test, the files here include .dll
, .webtest
, .loadtest
, .csv
(or .xml
, etc, as used for data driving) and others.
The in
directory holds files generated when running the tests. The names in
and out
make some sense when viewed from the non-test-execution phases of the work. The outputs of deploying are written to the out
directory. The inputs to the analysis of test results are in the in
directory.
Upvotes: 2