0

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

Community
  • 1
  • 1
Barniferous
  • 93
  • 11

1 Answers1

2

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.

enter image description here

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.

AdrianHHH
  • 13,492
  • 16
  • 50
  • 87
  • Thanks for the reply, but I don't see a "Test Results Names" page. The "General" page has a "User-Defined Scheme". It creates the "WebRegressionTests _2015-09-23 14_27_20_" folder in the example, but that's the only change to the folders in the editor (I'd post the picture but I don't know how). There are folder options on the Unit Tests page, but they're all assembly and DLL load locations, and I'm doing web tests, anyway. Nothing like that on the Web Test page. BTW, I'd've posted some code, but there didn't seem to be any to post. (And why can't you enter a New-Line in this dialog box?) – Barniferous Sep 24 '15 at 15:47
  • @Barniferous Screenshot added. – AdrianHHH Sep 24 '15 at 18:31
  • Thanks again for taking the time to try to help. 1. That's not what the VS2012 page looks like. 2. That's the same setting I described, "User-Defined Scheme", even down to the name, as the setting on the General page in the VS2012 .testSettings editor. Changing the first folder name below the TestResults folder doesn't really help. (In fact, we have done so -- that's the "WebRegressionTests 2015-09-23 14_27_20" folder I mentioned). – Barniferous Sep 26 '15 at 21:54