0

We have an application that has a number of projects isolated in their own solutions, each with their own UnitTest and IntegrationTest projects within those solutions. What happens on our locally hosted Azure DevOps applications is that the following code forces Azure DevOps to build each project in the solution before running tests. What I'd like to do is to run all tests sequentially on an initial build or at least cut the build time down because on the build server each build takes about a minute or 2 which is the bulk of the time. Since we have XUnit running the tests in say Rider it processes all tests across a solution from multiple projects well within a minute.

Is there a way to cut the build time or is this as good as it gets?

- task: DotNetCoreCLI@2
  displayName: Unit Tests
  inputs:
    command: test

    projects: '**/*UnitTest*/*.csproj'

    arguments: '--configuration $(BuildConfiguration)'

# run integration tests
- task: DotNetCoreCLI@2
  displayName: Integration Tests
  inputs:
    command: test
    projects: '**/*IntegrationTest*/*.csproj'
    arguments: '--configuration $(BuildConfiguration)'

Kate Orlova
  • 3,225
  • 5
  • 11
  • 35
Paul Carlton
  • 2,785
  • 2
  • 24
  • 42

1 Answers1

2

What happens on our locally hosted azure devops application is that the following code below will cause Azure Devops to build each project in the solution before running tests.

For this issue , you can add --no-build argument to skip the project build on test run.

  • --no-build:

Doesn't build the test project before running it. This is listed in the Options part of document.

- task: DotNetCoreCLI@2
  displayName: 'dotnet test'
  inputs:
    command: test
    projects: '**/*UnitTest*/*.csproj'
    arguments: '--configuration $(BuildConfiguration) --no-build'

Here is a case with similar issue , you can refer to it.

Hugh Lin
  • 17,829
  • 2
  • 21
  • 25
  • Thanks Hugh, I have implemented `--no-build` successfully. Unfortunately trying to build at the *.csproj level would run errors, I have to collapse all unit/integration tests into one line item and change `projects: '**/*UnitTest*/*.csproj'` to `projects: '*.sln'` for the build to find the appropriate DLLs. Thanks! – Paul Carlton Mar 19 '20 at 16:49