Remy
Remy

Reputation: 407

mstest how to prevent custom log file from being DELETED (and prevent .trx from being deleted too)

In a Micorosoft MSTest, I am creating a custom log file (.xlsx) dynamically in unit tests in ClassInitialize and closing it in ClassCleanup. It gets created and populated but then when the tests have finished running, the log file in the out directory is somehow getting deleted.

Any ideas on how to prevent this log file and other files in the TestResults/Out directory from being deleted?

example location:

C:\selenium\SelenMSTest4\TestResult\Deploy_ZZZ2013-01-09 10_50_03\Out

Microsoft MSTest 2012 and Selenium WebDriver are being used. The test is being run from Visual Studio 2012 by selecting Test--> Debug-->All Tests

Upvotes: 3

Views: 1741

Answers (1)

Remy
Remy

Reputation: 407

Creating a .runsettings file and setting "DeleteDeploymentDirectoryAfterTestRunIsComplete" to false fixed the problem but then caused deploymentitem not being found (more research needed on this complicated setup)

.runsettings addition:

<RunSettings> 
<MSTest>  
    <DeleteDeploymentDirectoryAfterTestRunIsComplete>False</DeleteDeploymentDirectoryAfterTestRunIsComplete>
</MSTest>
</RunSettings>

Upvotes: 2

Related Questions