microsoft-test-manager - Microsoft 测试管理器如何运行自动化单元测试?

标签 microsoft-test-manager

我已经将一些测试用例与项目中的单元测试相关联。该项目已构建并复制到共享上的放置位置。当我去运行这些测试时,由于作为这些测试的一部分包含的非托管 DLL 的 System.DllNotFoundExceptions,我遇到了很多失败?

有人知道为什么会这样吗?我有一个实验室环境设置,测试(据说)正在该机器上运行。这些测试运行时的工作流程是什么? TestController 是将单元测试 DLL 复制到实验室环境中机器本地的某个位置,还是尝试直接从构建文件夹运行?

这是错误的堆栈跟踪。请注意,c:\Builds\不在我看来很可疑的测试机器上。

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

最佳答案

包含测试实现的 DLL 将被复制到测试机器。

您可以激活Test Agent 日志并检查已部署文件的日志文件。

要激活这些日志:

  1. 转到 C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE 文件夹
    (这是 Test Agent 2012 的路径,如果您使用的是旧版本,路径会稍微 不同)。
  2. 更改文件 QTAgentService.exe.config(将 EqtTraceLevel 设置为“4”并将 CreateTraceListener 设置为“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>

重新启动Test Agent,您会发现在同一目录中创建了文件VSTTAgent.log

现在开始测试,然后检查这个日志文件。您会找到类似这样的条目(只需搜索“复制远程文件”:

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>

现在您可以检查是否所有 DLL 都已部署。

注意路径位于运行Test Controller的机器上,目标路径位于测试机上(Test Agent 正在运行)。

据我所知,非托管 DLL 不会与“单元测试 DLL”一起部署,因此您必须确保它们会被部署。
您可以使用测试设置:

enter image description here

关于microsoft-test-manager - Microsoft 测试管理器如何运行自动化单元测试?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21467353/

相关文章:

c# - 使用自定义属性跳过body方法

tfs - 通过 TFS Rest API 创建测试套件时出现 "Response status code does not indicate success: 500 (Internal Server Error)"

testing - MTM 2012 - 从 MTM 创建错误时获取选定的测试步骤

NUnit 与 Microsoft 测试管理器集成

testing - 您能否在 Microsoft Test Manager 2010 的测试套件中同时运行两个测试用例?

tfs - 如何删除 Microsoft 测试管理器中的共享参数

c# - 如何停止数据驱动的编码 ui 测试

unit-testing - MTM 编码 UI 测试手动执行 : "Recording Not Found"

c# - 使用 TFS api 执行(通过/失败)测试用例?

testing - TFS 测试结果条目 "Web Test Manager"或其他测试执行选项