Question

I have associated some test cases with unit tests in a project. That project is build and copied to a drop location on a share. When I go to run these tests I'm getting a lot of failures due to System.DllNotFoundExceptions from an unmanaged DLL that is included as part of these tests?

Does anyone know why this is happening? I have a lab environment setup and the tests are (supposedly) running on that machine. What is the workflow for when these tests run? Does the TestController copy the unit test DLLs somewhere locally on the machine in the lab environment or is it trying to run directly from the build folder?

Here is the stack trace for the error. Note that c:\Builds\ is NOT on the test machine which seems quite suspect to me.

Test method OutputProcessing.Integration.PanaceaOutputG1.ReactorCoreSimulationResults threw exception: 
System.DllNotFoundException: Unable to load DLL 'ge.gnf.cedar06.c.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)

Gnf.Cedar.NativeMethods.ATACHF(Int32& fileCode, String fileName, Int32& openMode, Int32[] stat)
Gnf.Cedar.ManagedMethods.Atachf(String fileName, FileAccess access, Int32[] stat)
Gnf.Cedar.Cypress.CedarFile.OpenCedarFile(String path, FileAccess access, FileSizeHint hint, AuditMode auditMode, ChainingOrderOption chainingOrder, Boolean createIfMissing)
Gnf.Cedar.Cypress.CedarFile..ctor(String path, FileMode mode, FileAccess access, FileSizeHint hint, AuditMode auditMode, ChainingOrderOption chainingOrder)
Gnf.Cedar.Cypress.CedarFile..ctor(String path, FileMode mode, FileAccess access)
GE.GNF.Acumen.Cedar.DataAccess.CedarRepository.GetCedarFile() in c:\Builds\11\ACUMEN\DEV Test Build\src\Acumen\Cedar\Cedar.DataAccess\CedarRepository.cs: line 67
GE.GNF.Acumen.Cedar.DataAccess.CedarRepository..ctor(String fullFilePath) in c:\Builds\11\ACUMEN\DEV Test Build\src\Acumen\Cedar\Cedar.DataAccess\CedarRepository.cs: line 40
GE.GNF.Acumen.Cedar.DataAccess.CedarRepository..ctor(String fullFilePath, String qualifier) in c:\Builds\11\ACUMEN\DEV Test Build\src\Acumen\Cedar\Cedar.DataAccess\CedarRepository.cs: line 43
OutputProcessing.Integration.PanaceaOutputG1.ReactorCoreSimulationResults() in c:\Builds\11\ACUMEN\DEV Test Build\src\Acumen\Auto Integration Tests\OutputProcessing.Integration\PanaceaOutputG1.cs: line 58
Was it helpful?

Solution

The DLLs containing test implementation will be copied to the test machine.

You can activate Test Agent logs and check in the log file which files have been deployed.

To activate these logs:

  1. Go to the C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE folder
    (this is the path for Test Agent 2012, if you are using older version the path with be slightly different).
  2. Change file QTAgentService.exe.config (set the EqtTraceLevel to "4" and CreateTraceListener to "yes"):
<configuration>
 <system.diagnostics>
  <switches>
  <!-- You must use integral values for "value".
   Use 0 for off, 1 for error, 2 for warn, 3 for info, and 4 for verbose. -->
   <add name="EqtTraceLevel" value="4" />
  </switches>
 </system.diagnostics> 
 <appSettings>
  <add key="CreateTraceListener" value="yes"/>
 </appSettings>
</configuration>

Restart Test Agent and you will find the file VSTTAgent.log created in the same directory.

Start your tests now and then check this logfile. You will find entries like this one (just search for "Copying remote file":

I, 5856, 4, 2014/01/31, 09:50:58.283, <computer name>\QTAgentService.exe, Copying remote file: C:\Users\<tfs build user>\AppData\Local\VSEQT\QTController\<test run>\Deployment\<your DLL file> to: C:\Users\<local user>\AppData\Local\VSEQT\QTAgent\<test run>\<test configuration>\Deployment\<your DLL file>

Now you can check if all your DLLs have been deployed.

Note: The source path is located on the machine Test Controller is running on, the destination path is located on the test machine (where Test Agent is running).

As much as I know unmanaged DLLs will not be deployed along with "unit tests DLLs" so you will have to make sure they will be deployed.
You can do it using Test Settings:

enter image description here

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top