单元测试只在构建服务器失败 [英] Unit tests failing only on the build server

查看:201
本文介绍了单元测试只在构建服务器失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

它抛出一个异常,这是这样的:

It throws an exception that is something like this:

Initialization method MyAssemblyA.Initialize threw exception. 
Spring.Objects.Factory.ObjectCreationException: Spring.Objects.Factory.ObjectCreationException: 

Error thrown by a dependency of object 'messageSource' defined in 'assembly    
[MyOtherAssembly.Test, Version=1.1.1016.1, Culture=neutral, PublicKeyToken=null], 
resource [MyOtherAssembly.context.xml] 

line 256' : Initialization of object failed : Could not load file or assembly 'MyAssemblyB' 
or one of its dependencies. The system cannot find the file specified.

我不知道为什么,但很多单元测试都只是在构建服务器和引发的异常上没有类似我上面写的东西。

I don't know exactly why, but a lot of the unit tests are failing only on the build server and the exception that is thrown is something similar to what I wrote above.

在我的context.xml我有这样的事情:

In my context.xml I have something like this:

    <object name="messageSource" type="Spring.Context.Support.ResourceSetMessageSource, Spring.Core">
    <property name="resourceManagers">
      <list>
        <ref object="resMgrCoreServiceErrors"/>
        <ref object="resMgrPersonnelErrors"/>
      </list>
    </property>
  </object>

  <object name="resMgrCoreServiceErrors"
          type="Spring.Objects.Factory.Config.ResourceManagerFactoryObject, Spring.Core">
    <property name="baseName" value="MyOtherAssembly.Resources.ErrorRes"/>
    <property name="assemblyName" value="MyOtherAssembly"/>
  </object>

  <object name="resMgrPersonnelErrors"
          type="Spring.Objects.Factory.Config.ResourceManagerFactoryObject, Spring.Core">
    <property name="baseName" value="MyOtherAssemblyB.Resources.ErrorRes"/>
    <property name="assemblyName" value="MyOtherAssemblyB"/>
  </object>

在这里ErrorRes是一个资源文件(的.resx)。

where ErrorRes is a resource file (.resx).

请帮忙,有什么建​​议,欢迎!

Please help, any suggestions are welcomed !

推荐答案

都MyAssemblyB的依赖无论是安装在GAC或在bin?有什么东西在这一精神。

are all of the dependencies of MyAssemblyB either installed in the gac or in the bin? has to be something in that vein.

这篇关于单元测试只在构建服务器失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆