locked
.runsettings issue with DeploymentItemAttribute RRS feed

  • Question

  • Hi,

    I have some issue with DeploymentItemAttribute when .runsettings are in used.

    If I have TestClass where DeploymentItem is not used, when TestRunDirectory is set to "..\TestResult\Deploy_name 2016-06-21 14_42_18".

    But if I put not empty DeploymentItem attribute to TestClass, then TestRunDirectory is set to "..\bin\debug", which is desired behaviour then .runsettings are in use.

    Why is that?

    Ofcourse i can leave that useless line of code [DeploymentItem("a")], but it is not nice.

    JD

    Tuesday, June 21, 2016 11:46 AM

Answers

  • Hi JD,

    According to your description, I create a sample Unit Test project and add a .runsettings file based on the default settings in this article. The I run my Unit Test with the steps that you described and I get the same result.

    I try run my Unit Test without .runsettings file, no matter I use the DeploymentItemAttribute or not, the TestRunDirectory are all set to "..\TestResult\Deploy_name 2016-06-21 14_42_18". So this problem just occurs when I use the .runsettings file in my Unit Test project.

    After I checked my .runsettings file, I found there has a <DeploymentEnabled> setting, which is set as false. When I change it to True, the TestRunDirectDirectory is set to "..\TestResult\Deploy_name 2016-06-21 14_42_18" when I use the DeploymentItem attribute.

     <MSTest>
        <MapInconclusiveToFailed>True</MapInconclusiveToFailed>
        <CaptureTraceOutput>false</CaptureTraceOutput>
        <DeleteDeploymentDirectoryAfterTestRunIsComplete>False</DeleteDeploymentDirectoryAfterTestRunIsComplete>
        <DeploymentEnabled>True</DeploymentEnabled>
        <AssemblyResolution>
          <Directory Path="D:\" includeSubDirectories="false"/>
        </AssemblyResolution>
      </MSTest>

    Best Regards,
    Weiwei


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Proposed as answer by Weiwei Cai Monday, June 27, 2016 10:01 AM
    • Marked as answer by Weiwei Cai Thursday, June 30, 2016 8:04 AM
    Wednesday, June 22, 2016 5:52 AM