0

I have a .Net framework 4.7.1 solution with two projects. In that one is for unit tests. Those unit tests are running successfully in local but not running in Azure Pipelines.

Pipeline:

Pipeline

YAML Below,

#Your build pipeline references an undefined variable named ‘BuildPlatform’. Create or edit the build pipeline for this YAML file, define the variable on the Variables tab. See https://go.microsoft.com/fwlink/?linkid=865972 #Your build pipeline references an undefined variable named ‘BuildConfiguration’. Create or edit the build pipeline for this YAML file, define the variable on the Variables tab. See https://go.microsoft.com/fwlink/?linkid=865972

steps:

  • task: VSTest@2 displayName: 'Test Assemblies' inputs: testAssemblyVer2: | \bin\debug\VentureAccess5NunitTest.dll !*TestAdapter.dll !**\obj** vsTestVersion: toolsInstaller platform: '$(BuildPlatform)' configuration: '$(BuildConfiguration)'

Below is the error log:

Job Result

Error Log

    2021-04-21T22:17:33.7444190Z **************** Starting test execution *********************
2021-04-21T22:17:33.7577516Z [command]C:\hostedtoolcache\windows\VsTest\16.9.4\x64\tools\net451\Common7\IDE\Extensions\TestPlatform\vstest.console.exe

"@D:\a_temp\vgsj2dnktuj.tmp" 2021-04-21T22:17:33.9074880Z Microsoft (R) Test Execution Command Line Tool Version 16.9.4 2021-04-21T22:17:33.9075586Z Copyright (c) Microsoft Corporation. All rights reserved. 2021-04-21T22:17:33.9229321Z vstest.console.exe "D:\a\8\s\VentureAccess5NunitTest\bin\Debug\VentureAccess5NunitTest.dll" 2021-04-21T22:17:33.9230164Z /Settings:"D:\a_temp\j4c4nybwlvx.tmp.runsettings" 2021-04-21T22:17:33.9230650Z /Logger:"trx" 2021-04-21T22:17:33.9231040Z /TestAdapterPath:"D:\a\8\s" 2021-04-21T22:17:35.1891001Z Starting test execution, please wait... 2021-04-21T22:17:35.8177732Z A total of 1 test files matched the specified pattern. 2021-04-21T22:17:54.0142297Z Failed DocDelvAuditTest [15 s] 2021-04-21T22:17:54.0269893Z Error Message: 2021-04-21T22:17:54.0271211Z Unable to create instance of class VentureAccess5NunitTest.Model.DocDelvEmailModelTest. Error: System.Exception: Application Key: SQLCommandTimeOut not found. at System.Collections.Generic.Dictionary2.get_Item(TKey key) 2021-04-21T22:17:54.0272513Z at VentureAccess5.ApplicationSettingConfig.GetApplicationConfigurationValueByKey(String Key). 2021-04-21T22:17:54.0273141Z Stack Trace: 2021-04-21T22:17:54.0273699Z at VentureAccess5.ApplicationSettingConfig.GetApplicationConfigurationValueByKey(String Key) 2021-04-21T22:17:54.0274405Z at VentureAccess5.DAL.Database..ctor() 2021-04-21T22:17:54.0274954Z at VentureAccess5.Models.DocDelvEmail..ctor() 2021-04-21T22:17:54.0277235Z at VentureAccess5NunitTest.Model.DocDelvEmailModelTest..ctor() in D:\a\8\s\VentureAccess5NunitTest\Model\DocDelvEmailModelTest.cs:line 29 2021-04-21T22:17:54.0278511Z Standard Output Messages: 2021-04-21T22:17:54.0279077Z log4net: Configuration update mode [Merge]. 2021-04-21T22:17:54.0279660Z log4net: Logger [root] Level string is [ALL]. 2021-04-21T22:17:54.0280320Z log4net: Logger [root] level set to [name="ALL",value=-2147483648]. 2021-04-21T22:17:54.0281128Z log4net: Loading Appender [RollingLogFileAppender] type: [log4net.Appender.RollingFileAppender] 2021-04-21T22:17:54.0282039Z log4net: Setting Property [File] to String value [D:\\DebugLogs\\VentureAccess50Dev.log] 2021-04-21T22:17:54.0282811Z log4net: Setting Property [AppendToFile] to Boolean value [True] 2021-04-21T22:17:54.0283501Z log4net: Setting Property [RollingStyle] to RollingMode value [Size] 2021-04-21T22:17:54.0284203Z log4net: Setting Property [MaxSizeRollBackups] to Int32 value [10] 2021-04-21T22:17:54.0284846Z log4net: Setting Property [MaximumFileSize] to String value [1MB] 2021-04-21T22:17:54.0286546Z log4net: Setting Property [StaticLogFileName] to Boolean value [True] 2021-04-21T22:17:54.0287306Z log4net: Converter [message] Option [] Format [min=-1,max=2147483647,leftAlign=False] 2021-04-21T22:17:54.0288078Z log4net: Converter [newline] Option [] Format [min=-1,max=2147483647,leftAlign=False] 2021-04-21T22:17:54.0288908Z log4net: Setting Property [ConversionPattern] to String value [%-5p %d %5rms %-22.22c{1} %-18.18M - %m%n] 2021-04-21T22:17:54.0289714Z log4net: Converter [p] Option [] Format [min=5,max=2147483647,leftAlign=True] 2021-04-21T22:17:54.0291911Z log4net: Converter [literal] Option [ ] Format [min=-1,max=2147483647,leftAlign=False] 2021-04-21T22:17:54.0297285Z log4net: Converter [d] Option [] Format [min=-1,max=2147483647,leftAlign=False] 2021-04-21T22:17:54.0298738Z log4net: Converter [literal] Option [ ] Format [min=-1,max=2147483647,leftAlign=False] 2021-04-21T22:17:54.0300034Z log4net: Converter [r] Option [] Format [min=5,max=2147483647,leftAlign=False] 2021-04-21T22:17:54.0300823Z log4net: Converter [literal] Option [ms ] Format [min=-1,max=2147483647,leftAlign=False] 2021-04-21T22:17:54.0301568Z log4net: Converter [c] Option [1] Format [min=22,max=22,leftAlign=True] 2021-04-21T22:17:54.0302349Z log4net: Converter [literal] Option [ ] Format [min=-1,max=2147483647,leftAlign=False] 2021-04-21T22:17:54.0303092Z log4net: Converter [M] Option [] Format [min=18,max=18,leftAlign=True] 2021-04-21T22:17:54.0303851Z log4net: Converter [literal] Option [ - ] Format [min=-1,max=2147483647,leftAlign=False] 2021-04-21T22:17:54.0310200Z log4net: Converter [m] Option [] Format [min=-1,max=2147483647,leftAlign=False] 2021-04-21T22:17:54.0312287Z log4net: Converter [n] Option [] Format [min=-1,max=2147483647,leftAlign=False] 2021-04-21T22:17:54.0313144Z log4net: Setting Property [Layout] to object [log4net.Layout.PatternLayout] 2021-04-21T22:17:54.0313920Z log4net: Searched for existing files in [D:\DebugLogs] 2021-04-21T22:17:54.0314646Z log4net: curSizeRollBackups starts at [0] 2021-04-21T22:17:54.0315899Z log4net: Opening file for writing [D:\DebugLogs\VentureAccess50Dev.log] append [True] 2021-04-21T22:17:54.0316649Z log4net: Created Appender [RollingLogFileAppender] 2021-04-21T22:17:54.0317349Z log4net: Adding appender named [RollingLogFileAppender] to logger [root]. 2021-04-21T22:17:54.0317966Z log4net: Hierarchy Threshold [] 2021-04-21T22:17:54.0318406Z 2021-04-21T22:17:54.0318814Z Debug Trace: 2021-04-21T22:17:54.0319315Z log4net: Configuration update mode [Merge]. 2021-04-21T22:17:54.0319893Z log4net: Logger [root] Level string is [ALL]. 2021-04-21T22:17:54.0320554Z log4net: Logger [root] level set to [name="ALL",value=-2147483648]. 2021-04-21T22:17:54.0321380Z log4net: Loading Appender [RollingLogFileAppender] type: [log4net.Appender.RollingFileAppender] 2021-04-21T22:17:54.0322290Z log4net: Setting Property [File] to String value [D:\\DebugLogs\\VentureAccess50Dev.log] 2021-04-21T22:17:54.0323066Z log4net: Setting Property [AppendToFile] to Boolean value [True] 2021-04-21T22:17:54.0323956Z log4net: Setting Property [RollingStyle] to RollingMode value [Size] 2021-04-21T22:17:54.0324668Z log4net: Setting Property [MaxSizeRollBackups] to Int32 value [10] 2021-04-21T22:17:54.0325784Z log4net: Setting Property [MaximumFileSize] to String value [1MB] 2021-04-21T22:17:54.0326487Z log4net: Setting Property [StaticLogFileName] to Boolean value [True] 2021-04-21T22:17:54.0327224Z log4net: Converter [message] Option [] Format [min=-1,max=2147483647,leftAlign=False] 2021-04-21T22:17:54.0327944Z log4net: Converter [newline] Option [] Format [min=-1,max=2147483647,leftAlign=False] 2021-04-21T22:17:54.0328761Z log4net: Setting Property [ConversionPattern] to String value [%-5p %d %5rms %-22.22c{1} %-18.18M - %m%n] 2021-04-21T22:17:54.0329556Z log4net: Converter [p] Option [] Format [min=5,max=2147483647,leftAlign=True] 2021-04-21T22:17:54.0330315Z log4net: Converter [literal] Option [ ] Format [min=-1,max=2147483647,leftAlign=False] 2021-04-21T22:17:54.0331097Z log4net: Converter [d] Option [] Format [min=-1,max=2147483647,leftAlign=False] 2021-04-21T22:17:54.0331871Z log4net: Converter [literal] Option [ ] Format [min=-1,max=2147483647,leftAlign=False] 2021-04-21T22:17:54.0332656Z log4net: Converter [r] Option [] Format [min=5,max=2147483647,leftAlign=False] 2021-04-21T22:17:54.0333361Z log4net: Converter [literal] Option [ms ] Format [min=-1,max=2147483647,leftAlign=False] 2021-04-21T22:17:54.0333990Z log4net: Converter [c] Option [1] Format [min=22,max=22,leftAlign=True] 2021-04-21T22:17:54.0334724Z log4net: Converter [literal] Option [ ] Format [min=-1,max=2147483647,leftAlign=False] 2021-04-21T22:17:54.0336066Z log4net: Converter [M] Option [] Format [min=18,max=18,leftAlign=True] 2021-04-21T22:17:54.0336746Z log4net: Converter [literal] Option [ - ] Format [min=-1,max=2147483647,leftAlign=False] 2021-04-21T22:17:54.0337497Z log4net: Converter [m] Option [] Format [min=-1,max=2147483647,leftAlign=False] 2021-04-21T22:17:54.0338245Z log4net: Converter [n] Option [] Format [min=-1,max=2147483647,leftAlign=False] 2021-04-21T22:17:54.0339015Z log4net: Setting Property [Layout] to object [log4net.Layout.PatternLayout] 2021-04-21T22:17:54.0339633Z log4net: Searched for existing files in [D:\DebugLogs] 2021-04-21T22:17:54.0340225Z log4net: curSizeRollBackups starts at [0] 2021-04-21T22:17:54.0340980Z log4net: Opening file for writing [D:\DebugLogs\VentureAccess50Dev.log] append [True] 2021-04-21T22:17:54.0341662Z log4net: Created Appender [RollingLogFileAppender] 2021-04-21T22:17:54.0342326Z log4net: Adding appender named [RollingLogFileAppender] to logger [root]. 2021-04-21T22:17:54.0343202Z log4net: Hierarchy Threshold [] 2021-04-21T22:17:54.0492287Z log4net: Shutdown called on Hierarchy [log4net-default-repository] 2021-04-21T22:17:54.1082194Z NUnit Adapter 3.17.0.0: Test execution started 2021-04-21T22:17:54.3154715Z Running all tests in D:\a\8\s\VentureAccess5NunitTest\bin\Debug\VentureAccess5NunitTest.dll 2021-04-21T22:17:54.9317980Z NUnit3TestExecutor discovered 239 of 239 NUnit test cases 2021-04-21T22:17:55.4623137Z Failed DocDelvAuditTest_Negative [3 ms] 2021-04-21T22:17:55.4624317Z Error Message: 2021-04-21T22:17:55.4625714Z Unable to create instance of class VentureAccess5NunitTest.Model.DocDelvEmailModelTest. Error: System.Exception: Application Key: SQLCommandTimeOut not found. at System.Collections.Generic.Dictionary2.get_Item(TKey key) 2021-04-21T22:17:55.4627189Z at VentureAccess5.ApplicationSettingConfig.GetApplicationConfigurationValueByKey(String Key). 2021-04-21T22:17:55.4628800Z Stack Trace: 2021-04-21T22:17:55.4639153Z at VentureAccess5.ApplicationSettingConfig.GetApplicationConfigurationValueByKey(String Key) 2021-04-21T22:17:55.4640388Z at VentureAccess5.DAL.Database..ctor() 2021-04-21T22:17:55.4641271Z at VentureAccess5.Models.DocDelvEmail..ctor() 2021-04-21T22:17:55.4644686Z at VentureAccess5NunitTest.Model.DocDelvEmailModelTest..ctor() in D:\a\8\s\VentureAccess5NunitTest\Model\DocDelvEmailModelTest.cs:line 29 2021-04-21T22:17:55.4653553Z Failed GetEmailImageUrlTest [1 ms] 2021-04-21T22:17:55.4654749Z Error Message: 2021-04-21T22:17:55.4657218Z Unable to create instance of class VentureAccess5NunitTest.Model.DocDelvEmailModelTest. Error: System.Exception: Application Key: SQLCommandTimeOut not found. at System.Collections.Generic.Dictionary2.get_Item(TKey key) 2021-04-21T22:17:55.4658473Z at VentureAccess5.ApplicationSettingConfig.GetApplicationConfigurationValueByKey(String Key). 2021-04-21T22:17:55.4665795Z Stack Trace: 2021-04-21T22:17:55.4666361Z at VentureAccess5.ApplicationSettingConfig.GetApplicationConfigurationValueByKey(String Key) 2021-04-21T22:17:55.4666992Z at VentureAccess5.DAL.Database..ctor() 2021-04-21T22:17:55.4667461Z at VentureAccess5.Models.DocDelvEmail..ctor() 2021-04-21T22:17:55.4668265Z at VentureAccess5NunitTest.Model.DocDelvEmailModelTest..ctor() in D:\a\8\s\VentureAccess5NunitTest\Model\DocDelvEmailModelTest.cs:line 29 2021-04-21T22:17:55.4669143Z Failed GetNextUniqueIdTest [1 ms] 2021-04-21T22:17:55.4669563Z Error Message: 2021-04-21T22:17:55.4674006Z Unable to create instance of class VentureAccess5NunitTest.Model.DocDelvEmailModelTest. Error: System.Exception: Application Key: SQLCommandTimeOut not found. at System.Collections.Generic.Dictionary2.get_Item(TKey key) 2021-04-21T22:17:55.4683289Z at VentureAccess5.ApplicationSettingConfig.GetApplicationConfigurationValueByKey(String Key). 2021-04-21T22:17:55.4684012Z Stack Trace: 2021-04-21T22:17:55.4684678Z at VentureAccess5.ApplicationSettingConfig.GetApplicationConfigurationValueByKey(String Key) 2021-04-21T22:17:55.4685367Z at VentureAccess5.DAL.Database..ctor() 2021-04-21T22:17:55.4685943Z at VentureAccess5.Models.DocDelvEmail..ctor() 2021-04-21T22:17:55.4686869Z at VentureAccess5NunitTest.Model.DocDelvEmailModelTest..ctor() in D:\a\8\s\VentureAccess5NunitTest\Model\DocDelvEmailModelTest.cs:line 29 2021-04-21T22:17:55.4687746Z Failed GetRetEmail [1 ms] 2021-04-21T22:17:55.4688235Z Error Message: 2021-04-21T22:17:55.4689308Z Unable to create instance of class VentureAccess5NunitTest.Model.DocDelvEmailModelTest. Error: System.Exception: Application Key: SQLCommandTimeOut not found. at System.Collections.Generic.Dictionary2.get_Item(TKey key) 2021-04-21T22:17:55.4690713Z at VentureAccess5.ApplicationSettingConfig.GetApplicationConfigurationValueByKey(String Key). 2021-04-21T22:17:55.4691348Z Stack Trace: 2021-04-21T22:17:55.4691976Z at VentureAccess5.ApplicationSettingConfig.GetApplicationConfigurationValueByKey(String Key) 2021-04-21T22:17:55.4692959Z at VentureAccess5.DAL.Database..ctor() 2021-04-21T22:17:55.4693514Z at VentureAccess5.Models.DocDelvEmail..ctor() 2021-04-21T22:17:55.4694411Z at VentureAccess5NunitTest.Model.DocDelvEmailModelTest..ctor() in D:\a\8\s\VentureAccess5NunitTest\Model\DocDelvEmailModelTest.cs:line 29 2021-04-21T22:17:55.4695281Z Failed GetRetEmail2 [1 ms] 2021-04-21T22:17:55.4695762Z Error Message: 2021-04-21T22:17:55.4696850Z Unable to create instance of class VentureAccess5NunitTest.Model.DocDelvEmailModelTest. Error: System.Exception: Application Key: SQLCommandTimeOut not found. at System.Collections.Generic.Dictionary2.get_Item(TKey key) 2021-04-21T22:17:55.4698326Z at VentureAccess5.ApplicationSettingConfig.GetApplicationConfigurationValueByKey(String Key). 2021-04-21T22:17:55.4698938Z Stack Trace: 2021-04-21T22:17:55.4699578Z at VentureAccess5.ApplicationSettingConfig.GetApplicationConfigurationValueByKey(String Key) 2021-04-21T22:17:55.4700226Z at VentureAccess5.DAL.Database..ctor() 2021-04-21T22:17:55.4700806Z at VentureAccess5.Models.DocDelvEmail..ctor() 2021-04-21T22:17:55.4701713Z at VentureAccess5NunitTest.Model.DocDelvEmailModelTest..ctor() in D:\a\8\s\VentureAccess5NunitTest\Model\DocDelvEmailModelTest.cs:line 29 2021-04-21T22:17:55.4702577Z Failed GetSkipEmailData [1 ms] 2021-04-21T22:17:55.4703074Z Error Message: 2021-04-21T22:17:55.4704340Z Unable to create instance of class VentureAccess5NunitTest.Model.DocDelvEmailModelTest. Error: System.Exception: Application Key: SQLCommandTimeOut not found. at System.Collections.Generic.Dictionary2.get_Item(TKey key) 2021-04-21T22:17:55.4705809Z at VentureAccess5.ApplicationSettingConfig.GetApplicationConfigurationValueByKey(String Key). 2021-04-21T22:17:55.4706424Z Stack Trace: 2021-04-21T22:17:55.4707047Z at VentureAccess5.ApplicationSettingConfig.GetApplicationConfigurationValueByKey(String Key) 2021-04-21T22:17:55.4707729Z at VentureAccess5.DAL.Database..ctor() 2021-04-21T22:17:55.4708295Z at VentureAccess5.Models.DocDelvEmail..ctor() 2021-04-21T22:17:55.4709203Z at VentureAccess5NunitTest.Model.DocDelvEmailModelTest..ctor() in D:\a\8\s\VentureAccess5NunitTest\Model\DocDelvEmailModelTest.cs:line 29 2021-04-21T22:17:55.4710089Z Failed DocDelvAuditTest [3 ms] 2021-04-21T22:17:55.4710716Z Error Message: 2021-04-21T22:17:55.4711786Z Unable to create instance of class VentureAccess5NunitTest.Model.DocDelvFaxTest. Error: System.Exception: Application Key: SQLCommandTimeOut not found. at System.Collections.Generic.Dictionary2.get_Item(TKey key) 2021-04-21T22:17:55.4712961Z at VentureAccess5.ApplicationSettingConfig.GetApplicationConfigurationValueByKey(String Key).

1 Answers1

0

Firstly, you can use self-hosted agent if you don't mind, then your apps are equivalent to running locally and won't be subject to Azure DevOps billing restrictions.

Click this document for detailed information about self-hosted agent and Microsoft-hosted agent.

Click Self-hosted Windows agents for tutorials on creating self-hosted agents:

If you want to use Microsoft-hosted agent, here are some troubleshooting advices:

  1. The Classic UI pipeline uses vs2017-win2016 agent by default, which does not support many new features. I suggest you use the windows-2019 agent.

    enter image description here

  2. Make sure all paths in your apps are relative paths. Microsoft-hosted agents don't read your local content, so if you need local references, you should upload them to the repository, or download them to the agent via NuGet restore, cmd etc.

  3. Similar to 2, here is a list of downloaded software of the Microsoft-hosted agent. Please check if there are any software you need, but the Microsoft agent does not have downloaded. You need to download them before your run test task.

Jane Ma-MSFT
  • 4,461
  • 1
  • 6
  • 12