0

I am customizing the build process with TFS. I am integrating TIBCO build with ANT script and unit testing with JMeter. Using UpgradeTemplate and TFSBuild.proj file, I could build and unit test tibco app. Depend on unit testing result I want to pass/ fail the build. For this I have created custom Task, which reads Jmeter report, decides if it is passed or failed and returns out parameter.

I am not able to use this boolean parameter to set build status to pass/ fail. Any ideas around this? Is it possible to create custom section in build output where I can show unit test percentage like we do with WriteCustomSummaryInformation tool in template?

Also, I am confused with implementation. I see there are multiple ways to implement this 1. Like Chutzpah we can create custom Test Adapter which will also populate failed test details in build 2. Updating build template file (UpgradeTemplate.xaml), adding custom Activity to template and setting build status. 3. Using Custom Task which I am trying above.

1st approach looks much better but time consuming. How can we decide on which one is better way to implement this?

Thanks.

1 Answers1

0

How to set a build status to fail.

Example:

<mtbwa:WriteBuildError Message="Some text here..." />
<!-- The follow line will mark the build as Failed -->
<mtbwa:SetBuildProperties PropertiesToSet="Status" Status="Failed" />

Ref: http://blog.gfader.com/2011/04/tfs-fail-build-when-warning-count.html

Use WriteBuildMessage to add a message to the build log.

Morten Frederiksen
  • 5,114
  • 1
  • 40
  • 72
  • Thanks for reply. I am trying to write build error and set Build status inside TFSBuild.proj file. From your response I got one solution for setting build status. SetBuildProperties w/o namespace works. However, I am not able to set WriteBuildError in it. – user2993556 Aug 01 '14 at 17:41
  • So your question is: "How do I fail a MSBuild build, so that a TFS server will mark the build as failed"? If so - take a look at this: http://stackoverflow.com/a/1028860/600559 – Morten Frederiksen Aug 01 '14 at 18:01
  • Thank you so much. This works for me. Adding following two tags beneath Target tag sets the Build status to Failed and also shows error in build result – user2993556 Aug 01 '14 at 18:22