在构建服务器TeamCity上运行测试时,我在日志中得到[主题],并且步骤失败。
该代码是大量包含代码的结果,这使得很难准确地查明我在做什么错(而且我宁愿不回滚更改,也不要一步一步地做一次)。
我怎样才能解决这个问题?我该如何找出问题所在?
我在跑
-nunit nuget 3.10.1(撰写本文时为最新官员)
-使用x64 / v4.0的构建服务器上的nunit.console 3.8.0
我在开发机器上本地运行(通过R#),没有发现任何问题。
这些测试是基于数据库的测试,其中我为测试(案例)创建了一个新数据库,然后在测试完成后将其删除。
欢迎任何建议!
BR-安德斯
[14:31:35]Step 3/6: NUnit - non-selenium (NUnit) (1m:05s)
[14:32:41]Step 4/6: OctopusDeploy: Create release (8s)
[14:32:50]Step 5/6: OctopusDeploy: Deploy release CI (OctopusDeploy: Deploy release) (1m:02s)
[14:33:52]Step 6/6: NUnit - selenium (NUnit) (1m:24s)
[14:33:53][Step 6/6] Starting: C:\TeamCity\buildAgent\tools\JetBrains.dotCover.CommandLineTools.bundled\dotCover.exe cover C:\TeamCity\buildAgent\temp\buildTmp\eBhHYI0b3Hab7OnsiQarKgWFi56r6tlg.dotCover /ReturnTargetExitCode /NoCheckForUpdates
[14:33:53][Step 6/6] in directory: C:\TeamCity\buildAgent\work\f7928b43a423b8ff\Src\JCI.ITC.COMP2.Search.IntegrationTests
[14:33:53][Step 6/6] JetBrains dotCover Console Runner 2017.2.2. Build 109.0.20171006.131113
[14:33:53][Step 6/6] Copyright (c) 2009-2018 JetBrains s.r.o. All rights reserved.
[14:33:54][Step 6/6] [JetBrains dotCover] Coverage session started [08-08-2018 14:33:54]
[14:33:57][Step 6/6] Runtime Environment
[14:33:57][Step 6/6] OS Version: Microsoft Windows NT 10.0.14393.0
[14:33:57][Step 6/6] CLR Version: 4.0.30319.42000
[14:33:57][Step 6/6]
[14:33:57][Step 6/6] Test Files
[14:33:57][Step 6/6] C:\TeamCity\buildAgent\temp\buildTmp\eWgQASs1HMWflTd4lND2sWNURPc3yFDs.nunit
[14:33:57][Step 6/6]
[14:33:57][Step 6/6] Test Filters
[14:33:57][Step 6/6] Where: cat==Integration
[14:33:57][Step 6/6]
[14:34:03][Step 6/6] JCI.ITC.COMP2.Search.IntegrationTests.dll (52s)
[14:35:12][Step 6/6]
[14:35:12][Step 6/6] Tests Not Run
[14:35:12][Step 6/6]
[14:35:12][Step 6/6] 1) Ignored : JCI.ITC.COMP2.Search.IntegrationTests.CoreSolver.Integration.IntegrationUsingHandlerDirectlyTest.ThatPostingValidCalculationIsSuccesful
[14:35:12][Step 6/6] Second wave
[14:35:12][Step 6/6]
[14:35:12][Step 6/6] 2) Ignored : JCI.ITC.COMP2.Search.IntegrationTests.CoreSolver.Integration.SeleniumTests.ThatSwaggerPageCanBeDisplayedCorrectly
[14:35:12][Step 6/6] OneTimeSetUp: Waiting
[14:35:12][Step 6/6]
[14:35:12][Step 6/6] Run Settings
[14:35:12][Step 6/6] RuntimeFramework: net-4.0
[14:35:12][Step 6/6] DisposeRunners: True
[14:35:12][Step 6/6] WorkDirectory: C:\TeamCity\buildAgent\work\f7928b43a423b8ff\Src\JCI.ITC.COMP2.Search.IntegrationTests
[14:35:12][Step 6/6] BasePath: C:\TeamCity\buildAgent\work\f7928b43a423b8ff\src\JCI.ITC.COMP2.Search.IntegrationTests\bin\Release
[14:35:12][Step 6/6] ImageRuntimeVersion: 4.0.30319
[14:35:12][Step 6/6] ImageTargetFrameworkName: .NETFramework,Version=v4.7.2
[14:35:12][Step 6/6] ImageRequiresX86: False
[14:35:12][Step 6/6] ImageRequiresDefaultAppDomainAssemblyResolver: False
[14:35:12][Step 6/6] NumberOfTestWorkers: 2
[14:35:12][Step 6/6]
[14:35:12][Step 6/6] Test Run Summary
[14:35:12][Step 6/6] Overall result: Warning
[14:35:12][Step 6/6] Test Count: 13, Passed: 11, Failed: 0, Warnings: 0, Inconclusive: 0, Skipped: 2
[14:35:12][Step 6/6] Skipped Tests - Ignored: 2, Explicit: 0, Other: 0
[14:35:12][Step 6/6] Start time: 2018-08-08 12:33:57Z
[14:35:12][Step 6/6] End time: 2018-08-08 12:35:12Z
[14:35:12][Step 6/6] Duration: 75.068 seconds
[14:35:12][Step 6/6]
[14:35:12][Step 6/6] Results (nunit3) saved as C:\TeamCity\buildAgent\temp\buildTmp\eWgQASs1HMWflTd4lND2sWNURPc3yFDs.nunit.xml
[14:35:12][Step 6/6]
[14:35:12][Step 6/6] NUnit.Engine.NUnitEngineUnloadException : Multiple exceptions encountered. Retrieve AggregatedExceptions property for more information
[14:35:12][Step 6/6] ----> NUnit.Engine.NUnitEngineUnloadException : Agent Process was terminated successfully after error.
[14:35:12][Step 6/6] ----> NUnit.Engine.NUnitEngineUnloadException : Exception encountered unloading application domain
[14:35:12][Step 6/6] ----> NUnit.Engine.NUnitEngineException : Exception encountered unloading application domain: Error while unloading appdomain. (Exception from HRESULT: 0x80131015)
[14:35:12][Step 6/6] Application domain name: domain-ffefe317-eWgQASs1HMWflTd4lND2sWNURPc3yFDs.nunit
[14:35:12][Step 6/6] Application domain BaseDirectory: C:\TeamCity\buildAgent\work\f7928b43a423b8ff\src\JCI.ITC.COMP2.Search.IntegrationTests\bin\Release\
[14:35:12][Step 6/6]
[14:35:16][Step 6/6] [JetBrains dotCover] Coverage session finished [08-08-2018 14:35:16]
[14:35:16][Step 6/6] [JetBrains dotCover] Analyzed application exited with code '-5'
[14:35:16][Step 6/6] [JetBrains dotCover] Coverage results post-processing started [08-08-2018 14:35:16]
[14:35:16][Step 6/6] [JetBrains dotCover] Coverage results post-processing finished [08-08-2018 14:35:16]
最佳答案
它对任何人都应该有帮助吗?最后,我成功了。
也可能是数据库集成测试,但下面列出了我通过它的最终更改。
StructureMap的IContainer是IDisposable的,显然,完成测试后,单元测试过程将保留在二进制文件上,从而防止了卸载。
之前
[Test]
public void ThatControllersCanBeCreatedByIocContainer()
{
// Arrange
var sut = WebIoC.Initialize();
// Act
var searchRequestController = sut.GetInstance<SearchRequestController>();
var searchStatusController = sut.GetInstance<SearchStatusController>();
// Assert
Assert.IsNotNull(searchRequestController);
Assert.IsNotNull(searchStatusController);
}
后
[Test]
public void ThatControllersCanBeCreatedByIocContainer()
{
// Arrange
using (var sut = WebIoC.Initialize())
{
// Act
var searchRequestController = sut.GetInstance<SearchRequestController>();
var searchStatusController = sut.GetInstance<SearchStatusController>();
// Assert
Assert.IsNotNull(searchRequestController);
Assert.IsNotNull(searchStatusController);
}
}
其中WebIOC.Initialize()看起来像(标准的东西):
public static class WebIoC
{
public static IContainer Initialize()
{
return new Container(c =>
{
c.AddRegistry<WebRegistry>();
c.AddRegistry<SharedRegistry>();
c.Scan(scan =>
{
scan.TheCallingAssembly();
scan.WithDefaultConventions();
});
});
}
}
关于nunit - NUnit.Engine.NUnitEngineUnloadException:遇到多个异常。检索AggregatedExceptions属性以获取更多信息,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/51747149/