unit-testingvisual-studio-2015mstestordered-test

runsettings' DeploymentEnabled flag not taken into account in Ordered Tests


For some reason, the DeploymentEnabled flag is not taken into account when I run my tests from an orderedtest; i.e., the DirectoryPath is as if DeploymentEnabled was True, although I explicitly set it to False in the .runsettings file.

My question seems to be closely related to this one although no solution was found there.

I run VS Enterprise 2015.

Any clue?


Solution

  • My understanding is that, by design, ordered tests need files to be deployed to work.

    Hence, I added similar code everywhere needed in my unit test classes:

    <TestMethod()>
    <DeploymentItem("Test Files\MyInputFile.txt", "Test Files")>
    Public Sub ...
    

    In my .runsettings file I set DeployementEnabled to True, and it works. The downside being I had many unit tests to update with DeploymentItem ...

    From Microsoft:

    In an ordered test, each test is self-contained and independent. So the environment state is not retained between each test that is run.

    I guess that answers the question.