Microsoft Test Manager如何运行自动化单元测试?

 mobiledu2502869153 发布于 2023-01-30 12:10

我已将一些测试用例与项目中的单元测试相关联.该项目是构建并复制到共享上的放置位置.当我去运行这些测试时,由于作为这些测试的一部分包含的非托管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

Elena.. 6

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

您可以激活测试代理日志并在日志文件中签入已部署的文件.

要激活这些日志:

    转到C:\ Program Files(x86)\ Microsoft Visual Studio 11.0\Common7\IDE文件夹
    (这是Test Agent 2012的路径,如果您使用旧版本的路径略有不同).

    更改文件QTAgentService.exe.config(设置EqtTraceLevel为"4"和CreateTraceListener为"yes"):


 
  
  
   
  
  
 
  
 

重新启动Test Agent,您将在同一目录中找到创建的VSTTAgent.log文件.

立即开始测试,然后检查此日志文件.你会找到像这样的条目(只搜索"复制远程文件":

I, 5856, 4, 2014/01/31, 09:50:58.283, \QTAgentService.exe, Copying remote file: C:\Users\\AppData\Local\VSEQT\QTController\\Deployment\ to: C:\Users\\AppData\Local\VSEQT\QTAgent\\\Deployment\

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

注意:路径所在的机器上测试控制器上运行时,目的地路径位于所述试验机(其中上测试代理正在运行).

据我所知,非托管DLL不会与"单元测试DLL"一起部署,因此您必须确保它们将被部署.
你可以使用测试设置来做到这一点:

在此输入图像描述

1 个回答
  • 包含测试实现的DLL将被复制到测试机器.

    您可以激活测试代理日志并在日志文件中签入已部署的文件.

    要激活这些日志:

      转到C:\ Program Files(x86)\ Microsoft Visual Studio 11.0\Common7\IDE文件夹
      (这是Test Agent 2012的路径,如果您使用旧版本的路径略有不同).

      更改文件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.

    注意:路径所在的机器上测试控制器上运行时,目的地路径位于所述试验机(其中上测试代理正在运行).

    据我所知,非托管DLL不会与"单元测试DLL"一起部署,因此您必须确保它们将被部署.
    你可以使用测试设置来做到这一点:

    在此输入图像描述

    2023-01-30 12:13 回答
撰写答案
今天,你开发时遇到什么问题呢?
立即提问
热门标签
PHP1.CN | 中国最专业的PHP中文社区 | PNG素材下载 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有