当我在 VS 中的 xUnit 测试上运行构建时,所有测试都通过了,但在管道构建中,我只收到 1 个错误,这是由于超时造成的。
这是 DevOps 的代码错误: **```
Error Message: 2024-07-03T13:46:54.0677410Z System.Exception : Assertions not tested due to timeout
[VS Build][1]
[DevOps error][2]
Tried Re-Queueing build but always same thing, maybe DevOps has different timeout than VS?
[1]: https://i.sstatic.net/YFpCJPux.png
[2]: https://i.sstatic.net/v8M6khjo.png
this is log downloaded from DevOps:
2024-07-03T13:46:25.7473431Z Starting test execution, please wait...
2024-07-03T13:46:25.9228679Z A total of 1 test files matched the specified pattern.
2024-07-03T13:46:52.8484605Z [xUnit.net 00:00:17.95] MeltFieldTest.PlantUnitTest.ShouldDetectAndCancelPlantUnitEventMultipleTimes(fieldEventName: "HotMetalCarEmptyFieldEvent", antagonistFieldEventName: "LadleOnHotMetalCarFieldEvent", stateName: "HotMetalCar", initialValue: 2, finalValue: 1, plantUnitEventType: "HotMetalCarEmptyPlantUnitEvent", candidateTime: 1) [FAIL]
2024-07-03T13:46:54.0672440Z Failed MeltFieldTest.PlantUnitTest.ShouldDetectAndCancelPlantUnitEventMultipleTimes(fieldEventName: "HotMetalCarEmptyFieldEvent", antagonistFieldEventName: "LadleOnHotMetalCarFieldEvent", stateName: "HotMetalCar", initialValue: 2, finalValue: 1, plantUnitEventType: "HotMetalCarEmptyPlantUnitEvent", candidateTime: 1) [2 s]
2024-07-03T13:46:54.0677109Z Error Message:
2024-07-03T13:46:54.0677410Z System.Exception : Assertions not tested due to timeout
2024-07-03T13:46:54.0677596Z Stack Trace:
2024-07-03T13:46:54.0677874Z at MeltFieldTest.Utils.Poller.CheckUntil(Action[] assertions) in D:\a\1\s\MeltField\MeltFieldTest\Utils\Poller.cs:line 28
2024-07-03T13:46:54.0678450Z at MeltFieldTest.PlantUnitTest.ShouldDetectAndCancelPlantUnitEventMultipleTimes(String fieldEventName, String antagonistFieldEventName, String stateName, Int32 initialValue, Int32 finalValue, String plantUnitEventType, Int32 candidateTime) in D:\a\1\s\MeltField\MeltFieldTest\PlantUnitTest.cs:line 171
2024-07-03T13:48:21.9539867Z Results File: D:\a\_temp\VssAdministrator_fv-az285-59_2024-07-03_13_46_50.trx
2024-07-03T13:48:21.9543780Z
2024-07-03T13:48:21.9592259Z Failed! - Failed: 1, Passed: 207, Skipped: 0, Total: 208, Duration: 1 m 31 s - MeltFieldTest.dll (net6.0)
2024-07-03T13:48:23.3368206Z Test run for D:\a\1\s\MeltProduction\MeltProductionTest\bin\Debug\net6.0\MeltProductionTest.dll (.NETCoreApp,Version=v6.0)
2024-07-03T13:48:23.4091901Z Microsoft (R) Test Execution Command Line Tool Version 17.10.0 (x64)
2024-07-03T13:48:23.4121303Z Copyright (c) Microsoft Corporation. All rights reserved.
假设您的测试访问数据库可能是:
在本地运行良好,因为测试可以访问数据库服务器。
当测试在服务器上运行时,无法访问数据库,因此连接等待超时。在数据库连接超时之前,测试执行超时。