J4N*_*J4N 6 c# nunit nunit-3.0
我们在不同的程序集中进行了大量测试(6000+)。我们使用 Nunit 测试适配器在本地 Azure 代理上运行它们。
这花了很长时间,所以我们激活了 runInParallel。
yaml 步骤现在如下:
- task: VSTest@2
timeoutInMinutes: 300
inputs:
testSelector: 'testAssemblies'
testAssemblyVer2: '*.Test*.dll'
searchFolder: '$(System.DefaultWorkingDirectory)/$(buildConfiguration)'
codeCoverageEnabled: false
platform: 'Any CPU'
uiTests: false
configuration: '$(buildConfiguration)'
rerunFailedTests: false
pathtoCustomTestAdapters: 'Solution/packages/NUnit3TestAdapter.3.12.0/build/net35'
minimumExpectedTests: 1000
runInParallel: true
distributionBatchType: basedOnAssembly
failOnMinTestsNotRun: true
resultsFolder: 'testResults'
runSettingsFile: '$(Build.SourcesDirectory)\azure-tests.runsettings'
#continueOnError: true
Run Code Online (Sandbox Code Playgroud)
现在,我们得到了一些未通过的测试。我分析了其中一个,基本上,它失败了,因为在某些时候,它执行了OfType<SomeInterface>. 集合中的对象确实实现了这个接口,所以我想我一定有这个程序集加载两次的问题,并且这个接口不被认为与创建的对象相同。
当我检查日志时,我现在看到了这一点,这似乎证实了这个理论:
##[warning]RunMessage : Exception NUnit.Engine.NUnitEngineUnloadException, Exception thrown unloading tests from C:\DevOp\2\s\debug\Acceptance.Tests.dll
##[warning]RunMessage : Exception encountered unloading application domain
##[warning]RunMessage : at NUnit.Engine.Services.DomainManager.DomainUnloader.Unload()
at NUnit.Engine.Runners.TestDomainRunner.UnloadPackage()
at NUnit.Engine.Runners.AbstractTestRunner.Dispose(Boolean disposing)
at NUnit.Engine.Runners.AbstractTestRunner.Dispose()
at NUnit.Engine.Runners.MasterTestRunner.Dispose(Boolean disposing)
at NUnit.Engine.Runners.MasterTestRunner.Dispose()
at NUnit.VisualStudio.TestAdapter.NUnit3TestExecutor.RunAssembly(String assemblyPath, TestFilter filter) in D:\repos\nunit\nunit3-vs-adapter\src\NUnitTestAdapter\NUnit3TestExecutor.cs:line 321
##[warning]RunMessage : Innerexception: NUnit.Engine.NUnitEngineException: Exception encountered unloading application domain: Error while unloading appdomain. (Exception from HRESULT: 0x80131015)
Application domain name: domain-dcec2bc8-Acceptance.Tests.dll
Application domain BaseDirectory: C:\DevOp\2\s\debug\
Run Code Online (Sandbox Code Playgroud)
我已经搜索过,但没有找到如何解决这个问题。我可以理解,我可能有一些东西阻止程序集正确卸载,但我们有超过 6000 个测试,15 个测试程序集引用了一些生产代码和一些测试代码。所有测试的执行大约需要 2 小时 45 分。
我如何知道哪些内容无法卸载(以及为什么?)您将如何解决此错误?
| 归档时间: |
|
| 查看次数: |
1396 次 |
| 最近记录: |