steps:
- task: DotNetCoreCLI@2
displayName: dotnet build
inputs:
command: 'build'
arguments: '--configuration $(BuildConfiguration)'
- task: DotNetCoreCLI@2
displayName: dotnet test
inputs:
command: test
projects: 'Playtech.Neon.Privacy.TestPlaytech.Neon.Privacy.Test.csproj'
arguments: '--configuration $(buildConfiguration)'
I've noticed that the test step builds the solution again, which is stupid because
the solution has already been built by the build step so the tests should just use the bin directory that's already been made.
Can it do this? How?
Dotnet commands like test or pack build the project by default.
There are 2 solutions to this:
-task: DotNetCoreCLI@2
displayName: dotnet test
inputs:
command: test
projects: 'Playtech.Neon.Privacy.TestPlaytech.Neon.Privacy.Test.csproj'
arguments: '--no-build --configuration $(buildConfiguration)'
- script: dotnet test Playtech.Neon.Privacy.TestPlaytech.Neon.Privacy.Test.dll
workingDirectory: '<Path_To_The_Build_Directory>'
displayName: Run Tests
You can probably do the same with the DotNetCoreCLI@2 Task but I did not test that.
But overall reading the documentation is always a good first step ;)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With