.testrunconfig and automation Buid

Hello All,

To make my tests work correctly I need to deploy some extra text files.
So I have edited my localtestrun.testrunconfig file to add my files as deployment items.

This is working fine locally. I get my file using the following code:


string path = Assembly.GetExecutingAssembly().Location;

path = string.Format(@"{0}\{1}", Path.GetDirectoryName(path), fileName);


 



First question: Is there an easier way to get back this file
Second question : when running my tests during an automated build, it doesn't work, my files doesn't get copied. My testrunconfig file is even not deployed in the binariesroot.

Note that I am using the version Beta 3 Refresh of the server.
I would like to avoid using the attribute DeployementItemAttribute on each test method

Any Idea
Thanks,
Jarod




Answer this question

.testrunconfig and automation Buid

  • Christian Reizlein

    Hello again Amit !

    So no... still not working...
    When I check my testrunconfig file, we can see that :

    <deploymentItems type="Microsoft.VisualStudio.TestTools.Common.DeploymentItemCollection">

      <m_container type="System.Collections.Hashtable">
      <key type="Microsoft.VisualStudio.TestTools.Common.DeploymentItem">
      <path type="System.String">DH2.Test.TR.CRM\Conditions Initiales\</path>
      <outputDirectory type="System.String" />
      </key>
      <value />
      </m_container>
      </deploymentItems>

    So it is correctly a relative path to the solution folder.
    In my build log, I see the following error for the tests :

    Search path(s) for tests:

    c:\Builds\DH2\DH2 Livraison\BuildType\..\Sources\..\Binaries\Mixed Platforms\Release\

    c:\Builds\DH2\DH2 Livraison\Sources\DH2Solution

    Search path(s) for default run configuration:

    c:\Builds\DH2\DH2 Livraison\Sources\DH2Solution

    Starting execution...

    Results Top Level Tests

    ------- ---------------

    Passed (Livraison 1/Iteration 1-1/CRM/TR/)DH2.Test.TR.CRM.DemandeIntervention.SC_CRM_0005_01_TR1

    Passed (Livraison 1/Iteration 1-1/CRM/TR/)DH2.Test.TR.CRM.DemandeIntervention.SC_CRM_0005_01_TR2

    Failed (Livraison 1/Iteration 1-1/CRM/TR/)DH2.Test.TR.CRM.DemandeIntervention.SC_CRM_0010_01_TR2

    Passed (Livraison 1/Iteration 1-1/CRM/TR/)DH2.Test.TR.CRM.DemandeIntervention.SC_CRM_0005_02_TR1

    Failed (Livraison 1/Iteration 1-1/CRM/TR/)DH2.Test.TR.CRM.DemandeIntervention.SC_CRM_0010_01_TR1

    Passed (Livraison 1/Iteration 1-1/Securite/)DH2.Test.TR.Securite.Inspecteurs.SC_SEC_0004_01_TR6

    Passed (Livraison 1/Iteration 1-1/Securite/)DH2.Test.TR.Securite.DH2.SC_SEC_0001_01_TR1

    Passed (Livraison 1/Iteration 1-1/Securite/)DH2.Test.TR.Securite.CRM.SC_SEC_0004_01_TR2

    Failed (Livraison 1/Iteration 1-1/Securite/)DH2.Test.TR.Securite.CRM.SC_SEC_0005_01_TR1

    Passed (Livraison 1/Iteration 1-1/Securite/)DH2.Test.TR.Securite.Inspecteurs.SC_SEC_0004_02_TR12

    Passed (Livraison 1/Iteration 1-1/Securite/)DH2.Test.TR.Securite.Guichets.SC_SEC_0004_01_TR3

    Passed (Livraison 1/Iteration 1-1/Securite/)DH2.Test.TR.Securite.Guichets.SC_SEC_0004_02_TR4

    Passed (Livraison 1/Iteration 1-1/Securite/)DH2.Test.TR.Securite.Guichets.SC_SEC_0004_02_TR7

    Passed (Livraison 1/Iteration 1-1/Securite/)DH2.Test.TR.Securite.CRM.SC_SEC_0004_02_TR10

    Passed (Livraison 1/Iteration 1-1/Securite/)DH2.Test.TR.Securite.Guichets.SC_SEC_0004_01_TR4

    Passed (Livraison 1/Iteration 1-1/Securite/)DH2.Test.TR.Securite.DH2.SC_SEC_0001_02_TR1

    Passed (Livraison 1/Iteration 1-1/Securite/)DH2.Test.TR.Securite.Guichets.SC_SEC_0004_02_TR8

    Passed (Livraison 1/Iteration 1-1/Securite/)DH2.Test.TR.Securite.CRM.SC_SEC_0004_02_TR9

    Passed (Livraison 1/Iteration 1-1/Securite/)DH2.Test.TR.Securite.CRM.SC_SEC_0004_02_TR1

    Passed (Livraison 1/Iteration 1-1/Securite/)DH2.Test.TR.Securite.Guichets.SC_SEC_0004_02_TR3

    Passed (Livraison 1/Iteration 1-1/Securite/)DH2.Test.TR.Securite.Inspecteurs.SC_SEC_0004_01_TR5

    Passed (Livraison 1/Iteration 1-1/Securite/)DH2.Test.TR.Securite.Inspecteurs.SC_SEC_0004_02_TR6

    Passed (Livraison 1/Iteration 1-1/Securite/)DH2.Test.TR.Securite.CRM.SC_SEC_0005_02_TR1

    Passed (Livraison 1/Iteration 1-1/Securite/)DH2.Test.TR.Securite.Inspecteurs.SC_SEC_0004_02_TR5

    Passed (Livraison 1/Iteration 1-1/Securite/)DH2.Test.TR.Securite.Inspecteurs.SC_SEC_0004_02_TR11

    Passed (Livraison 1/Iteration 1-1/Securite/)DH2.Test.TR.Securite.CRM.SC_SEC_0004_02_TR2

    Passed (Livraison 1/Iteration 1-1/Securite/)DH2.Test.TR.Securite.DH2.SC_SEC_0001_01_TR2

    Passed (Livraison 1/Iteration 1-1/Securite/)DH2.Test.TR.Securite.CRM.SC_SEC_0004_01_TR1

    Run has the following issue(s):

    C:\Program Files\MSBuild\Microsoft\VisualStudio\v8.0\TeamBuild\Microsoft.TeamFoundation.Build.targets : warning : Warning: Test Run deployment issue: Failed to copy file 'c:\builds\dh2\dh2 livraison\sources\dh2solution\DH2.Test.TR.CRM\Conditions Initiales\SC_CRM_0010_01_TR1.txt' to 'c:\builds\dh2\dh2 livraison\sources\dh2solution\DH2.Test.TR.CRM\Conditions Initiales\SC_CRM_0010_01_TR1.txt': System.UnauthorizedAccessException: Access to the path 'c:\builds\dh2\dh2 livraison\sources\dh2solution\DH2.Test.TR.CRM\Conditions Initiales\SC_CRM_0010_01_TR1.txt' is denied.

    25/28 test(s) Passed, 3 Failed

    So he is trying to copy the file to the same location instead of copying it to the OUT folder of the test results.

    Any idea

    PS : when I add an attribute DeployementItem, this is working fine !



  • Patrick.Ke

    Yes I have done both !

    Note that my .testrunconfig does not get deployed during the automated build

  • CCarsella

    There is one other thing you can try, open up the test run config and locate the <path type=" ... " > line for deploymentItems and remove the final \ character for the directory location. (eg. change DH2.Test.TR.CRM\Conditions Initiales\ to DH2.Test.TR.CRM\Conditions Initiales).

    Does this work

    Thanks,
    Amit

  • Kris_Jana

    I tried this out on our latest bits (post Beta 3), and deployment of files appears to work fine through Team Build.

    Note that the testrunconfig file need not be deployed to the binaries root, as it can also be picked up from the solution directory (which is the case here). Could you post your testrunconfig file and build log file Is the test run config file created from a pre Beta3 version One reason why deployment may not be occuring during Team Build could be because the path to the file is an absolute path in the test run config.

    Thanks,
    Amit


  • Amit Chattopadhyay

    Hello Amit !

    In fact I have relaunched my builds now and it is working fine.
    I have also remarked somehting like that in the Beta 3 Refresh version. Doing something is not working. You have to undo it and redo it to make it work properly. (I have seen that when marking some DLLs as CopyLocal = true)

    So to conclude (I hope :-) ) my .testrunconfig file is NOT published but my deployement items are published. So everything is ok !

    I'll tell you here when I will add extra files to be deployed if it works correctly.

    Thanks,

  • andy_f1

    I believe this is a known issue and we have an internal bug tracking this problem.

    Thanks,
    Amit

  • Gaudéric

    Hey Amit !

    Thanks for the tip !
    I have tried to include a directory but removing the last "\" and it works correctly !

    Hope it will be corrected in the final release ! :-)

    Thanks again,
    Jarod

  • Eaglepigjim

    Jarod - A couple of qs:

    1. Have you added your text files as deployment items in the testrunconfig file
    2. Have you checked in these txt files into your repository

    If you have done 1 and 2 and still the files are not getting copied, this is a bug.




  • David Lam

    Jarod,

    Thanks for posting the file. I noticed that you are deploying a folder, while I was trying to deploy files. The problem with deploying folders, appears to be a bug. However, deploying files appears to be working fine. Can you add the files to deploy in the test run config instead of deploying the directory and try I will meanwhile follow up on the deployment of folder issue.

    Thanks,
    Amit

  • .testrunconfig and automation Buid