Unit testing 找不到Jenkins单元测试连接字符串

Unit testing 找不到Jenkins单元测试连接字符串,unit-testing,jenkins,mstest,Unit Testing,Jenkins,Mstest,我的詹金斯单元测试返回了以下堆栈跟踪 <ErrorInfo> <Message>Initialization method UpstreamBatchTest.Initialize threw exception. System.InvalidOperationException: System.InvalidOperationException: No connection string named 'DBEntities' could be found in the

我的詹金斯单元测试返回了以下堆栈跟踪

<ErrorInfo>
<Message>Initialization method UpstreamBatchTest.Initialize threw exception. System.InvalidOperationException: System.InvalidOperationException: No connection string named 'DBEntities' could be found in the application config file..</Message>
              <StackTrace>    at System.Data.Entity.Internal.LazyInternalConnection.get_ConnectionHasModel()
       at System.Data.Entity.Internal.LazyInternalContext.InitializeContext()
       at System.Data.Entity.Internal.InternalContext.ExecuteSqlCommand(String sql, Object[] parameters)
       at System.Data.Entity.Database.ExecuteSqlCommand(String sql, Object[] parameters)

初始化方法UpstreamBatchTest.Initialize引发异常。System.InvalidOperationException:System.InvalidOperationException:在应用程序配置文件中找不到名为“DBEntities”的连接字符串。。
在System.Data.Entity.Internal.LazyInternalConnection.get_ConnectionHasModel()中
在System.Data.Entity.Internal.LazyInternalContext.InitializeContext()中
位于System.Data.Entity.Internal.InternalContext.ExecuteSqlCommand(字符串sql,对象[]参数)
at System.Data.Entity.Database.ExecuteSqlCommand(字符串sql,对象[]参数)

但是,我的app.config中有连接字符串。单元测试在VisualStudio本身上也运行良好。如果有人能解释一下,我将不胜感激。

您的app.config是否复制到运行单元测试的输出目录中?如果您能详细说明如何执行,我将不胜感激,是手动复制并粘贴,还是从ide(visual studio)等中手动复制并查看是否解决了问题。如果是,那么在单元测试中添加一个构建后步骤来进行复制。这是如何进行的?