sy-huss
sy-huss

Reputation: 193

Run a console application as a build task that outputs results of a test

I'm trying to find a way to run a console app written in .net, that outputs a return value as true or false, based on this value, I would like to cancel or progress with the build stage.

My console app runs a simple test to see if certain data exist on a users profile.

Does anyone know how I might go about achieving this?

Upvotes: 0

Views: 1981

Answers (2)

Daniel Mann
Daniel Mann

Reputation: 59020

Returning a value of true or false is not how applications typically report success or failure. The idiom is to exit with a return code of 0 for success, and non-zero for failure.

You can continue to have it print true/false, but have it return an appropriate exit code.

You can then run the application using a Command Line task in your build, and check the "Fail on Standard Error" flag

Upvotes: 2

Jim Wolff
Jim Wolff

Reputation: 5210

AzureDevOps does have support for test results from different test frameworks.

Maybe you could return a supported .xml from your console app instead.

I wouldn't suggest rolling your own test app but use the existing build task Visual Studio Test instead:

Visual Studio Test Task

However if you do roll your own you should return .xml in one of these formats (JUnit, NUnit, VSTest, XUnit) and then use the build task to publish them to AzureDevOps to see the results there.

Publish Test Results

Upvotes: -1

Related Questions