MSTest is removing Test Results when VS2013 is running as Administrator
Asked Answered
F

2

13

I know that sounds strange but that is how it is)

I'm using MSTest to run my unit tests. Using VS2013 + ReSharper 8.1 + some dll projects in C#. I'm calling some API functions, that is why I need VS to running as Administrator or those calls will fail.

The problem is:

For some reason folder TestResults is empty. While tests are running and not completed, I can see a new folder (User_Comp YYYY-mm-dd HH-MM-ss) created inside, with all test outputs, but once tests are completed this folder is deleted, so TestResults are empty.

I've checked my project Options->Web Performance Test Tools->Test Execution->Limit number of old Test Results is set to 25. I've tried to disable ReSharper UnitTesting + disabled support for MSTests, NUnit and JS, but problem still exists.

When VS is started under normal account (not Administrator)

In this case folder "TestResults\User_Comp YYYY-mm-dd HH-MM-ss" is not deleted after test. Of course in this case some of my tests are failing.

I've set full access for each user to folder "TestResults" but still results are removed.

Looks that VS is using 0 as limit for Test Results. Did anyone face this problem?

Firehouse answered 16/2, 2014 at 13:11 Comment(0)
F
18

Test results are removed when all tests pass. If any is failed, results are not removed.

Firehouse answered 16/2, 2014 at 23:10 Comment(2)
just wondering if there is a way to stop it though. (in case, I want to see what files are copied over).Ruel
@EverythingMatters, years later, no there is not. Niether setting DeleteDeploymentDirectoryAfterTestRunIsComplete in the .runsettings nor calling TestContext.AddResultFile() stopped the deletion.Dispirited
T
3

Have you tried to add a *.testsettingsfile to your Test project in Visual Studio?

Have a look at https://msdn.microsoft.com/en-us/library/jj635153.aspx and specifically the "DeleteDeploymentDirectoryAfterTestRunIsComplete" setting

Tusche answered 9/2, 2016 at 8:39 Comment(1)
Unfortunately, DeleteDeploymentDirectoryAfterTestRunIsComplete is only for .runsettings, not .testsettings. Tried the following in VS 2015.2 unsuccessfullly. <?xml version="1.0" encoding="utf-8"?> <RunSettings> <RunConfiguration> <ResultsDirectory>.\TestResults</ResultsDirectory> </RunConfiguration> <MSTest> <ForcedLegacyMode>True</ForcedLegacyMode> <SettingsFile>foo.testsettings</SettingsFile> <DeleteDeploymentDirectoryAfterTestRunIsComplete>False</DeleteDeploymentDirectoryAfterTestRunIsComplete> </MSTest> </RunSettings>Ify

© 2022 - 2024 — McMap. All rights reserved.