Jazz Register Log in
Jazz Forum Welcome to the Jazz Community Forum

Welcome to the Jazz Community Forum

Connect and collaborate with IBM Engineering experts and users

How can I convert a build result contribution to a JUnit Class Handle

Currently, JUnit tests are reported/displayed to the "Tests" tab of our RTC builds. I'm trying to write some custom tooling around getting the test suite/class names that fail out on each build. I've written code to get the build result contributions for each build. However, I'm having trouble converting those contributions into a form that I can use with the IJUnitTestCase and IJUnitTestClass api. Any suggestions/help with this would be really appreciated.

0 votes



One answer

Permanent link
you need to retrieve the content from the contribution object. 

I don't know how to convert that to what you need.. I don't know what the data stream looks like.
here is a post with code to get the contents
https://jazz.net/forum/questions/176187/how-to-download-log-file-from-build-result-through-plain-java-client-library

0 votes

Comments

Thanks for the info, Sam. I've written a function to return a list of Build Results and I'm able to get the buildContributionResults for each build result. Here's an example: 


com.ibm.team.build.internal.common.model.impl.BuildResultContributionsHandleImpl@6ceb6ceb (stateId: <unset>, itemId: [UUID XXXXXXXXXXXXX], origin: com.ibm.team.repository.client.internal.TeamRepository@22d022d, immutable: true)

Unfortunately, I don't see how I'm supposed to use this to get to the JUnit tests stored on the "Tests Tab".

I don't know 'exactly', but if you get the source for the
com.ibm.team.build.toolkit plugin
then look at the code in

com.ibm.team.build.internal.toolkit.unit

you will see how they create and view the unit test contributions,

to get the source, setup the sdk in eclipse, window->preferences, plugin development, target platform


then open the Plugin perspective, and find the plugin, then right click, import as source



then you can view the source in the eclipse project that matches the plugin name

Sam, I was able to get the JUnit Handles for each build result: 
IJUnitTestSuiteContributionHandle junitHandle = (IJUnitTestSuiteContributionHandle) junitContributionHandles[j].getExtendedContribution(); 


I'm now having issues converting this to a IJunitTestCase so I can go in and grab the error data associated with each build result. I keep running into an incompatible type error.

I haven't done anything with these types of objects..

as a debugging tool, you might print out the classname of the objects to see what type they are.

Your answer

Register or log in to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 12,059
× 413

Question asked: Mar 17 '15, 10:47 a.m.

Question was seen: 4,303 times

Last updated: Mar 23 '15, 2:42 p.m.

Confirmation Cancel Confirm