簡體   English   中英

由於Specflow測試而導致構建失敗

[英]Build failing because of Specflow tests

當我們不忽略specflow測試時,Visual Studio Team Services構建中的構建就會失敗。 我們所有的測試返回的HTTP狀態代碼401 auth會在實際上期望200或422等失敗時失敗。這僅發生在我們的Visual Studio Team Services版本中,當這些測試在本地運行時,它們全部通過。 我們在specflow測試中指定了用戶名和密碼,這些用戶名和密碼是經過硬編碼的,因此在Team Services上構建用戶名和密碼時為什么不起作用或無法通過身份驗證?

例如

2015-11-24T16:50:48.9936518Z ##[error]Error Message:

2015-11-24T16:50:48.9936518Z ##[error]     Expected: 200

2015-11-24T16:50:48.9936518Z ##[error]  But was:  401

2015-11-24T16:50:48.9936518Z ##[error]

2015-11-24T16:50:48.9936518Z ##[error]Stack Trace:

2015-11-24T16:50:49.0092775Z ##[error]at Test.Specifications.GetImageByIdSteps.ThenTheResultShouldBe(Int32 p0) in C:\a\1\s\Web\Web.Test\Specifications\GetImageByIdSteps.cs:line 36

2015-11-24T16:50:49.0092775Z ##[error]at lambda_method(Closure , IContextManager , Int32 )

2015-11-24T16:50:49.0092775Z ##[error]at TechTalk.SpecFlow.Bindings.BindingInvoker.InvokeBinding(IBinding binding, IContextManager contextManager, Object[] arguments, ITestTracer testTracer, TimeSpan& duration)

2015-11-24T16:50:49.0092775Z ##[error]at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.ExecuteStepMatch(BindingMatch match, Object[] arguments)

2015-11-24T16:50:49.0092775Z ##[error]at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.ExecuteStep(StepInstance stepInstance)

2015-11-24T16:50:49.0092775Z ##[error]at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.OnAfterLastStep()

2015-11-24T16:50:49.0092775Z ##[error]at TechTalk.SpecFlow.TestRunner.CollectScenarioErrors()

2015-11-24T16:50:49.0092775Z ##[error]at Web.Test.Specifications.GetImageByIdFeature.ScenarioCleanup() in C:\a\1\s\Web\Web.Test\Specifications\ImageGetImage.feature.cs:line 0

2015-11-24T16:50:49.0092775Z ##[error]at Web.Test.Specifications.GetImageByIdFeature.GetImage(String imageId, String userName, String password, String http_Status_Code, String[] exampleTags) in C:\a\1\s\Web\Web.Test\Specifications\ImageGetImage.feature:line 12

之所以發生這種情況,是因為連接字符串的轉換發生在發布而不是構建上。 因此,在構建服務器時,服務器無權訪問在我的本地連接字符串上聲明的連接(因為轉換沒有發生)。 我以為在構建時轉換發生在連接字符串上。 事實並非如此,轉換僅在發布時發生。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM