Why my tests with localdb works fine in Azure DevOps?

Viewed 375

I use Azure DevOps for CI process of my .NET Core app. Also I use integration tests based on localDb SQL database. When I run my ci piplene I was surprised that all tests were passed.

{
      "UseInMemoryDatabase": false, // Application.IntegrationTests are not designed to work with InMemory database.
      "DeveloperPathSqlConnectionString": "Server=(localdb)\\mssqllocaldb;Database=DeveloperPathTestDb;Trusted_Connection=True;MultipleActiveResultSets=true;",
      "Key": {
        "Type": "Development"
      },
      "Logging": {
        "LogLevel": {
          "Default": "Debug",
          "System": "Information",
          "Microsoft": "Information"
        }
      }
    }

Does Azure DevOps already contain the localdb?

1 Answers

Does Azure DevOps already contain the localdb?

The answer is yes.

The windows image contain the localdb. The hosted windows agent comes with Visual Studio which includes LocalDB.

You could use following start command to verify:

pool:
  vmImage: 'windows-latest'


- task: PowerShell@2
  displayName: 'start mssqllocaldb'
  inputs:
    targetType: 'inline'
    script: 'sqllocaldb start mssqllocaldb'

The test result:

enter image description here

Related