Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 519
Remy Avatar asked Dec 01 '25 00:12

Remy


1 Answers

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>
like image 134
Remy Avatar answered Dec 02 '25 18:12

Remy



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!