Avatar of ChristoferDutz
ChristoferDutzFlag for Germany asked on

Extending JUnit? / Linking JUnit and Jira?

Hi,

I am currently trying to extend JUnit. What I would like to do, is to create an Annotation that sets a Jira issue to "resolved" as soon as the test method succeeds. I was thinking of something like:

@JiraTest(issueId="XYZ-223")
public
void TestMethodForIssueXYZ223()
{
      // THE TEST CODE TESTING FOR ISSUE XYZ-223
}

Is there any way of extending JUnit in this way, or would I have to hack it in there somehow?
Is there another way, I haven't thought of, for implementing this type of functionality? ( I Hope so )
Is there allready a tool that provides this type of functionality? ( I doubt it, since I was Googling for such a tool for several hours )

Chris
SoftwareProgrammingJavaJIRA

Avatar of undefined
Last Comment
ChristoferDutz

8/22/2022 - Mon
Mick Barry

annotations aren't going to help you with that
and what you are trying does not make sense. typically the issue would be resolved once tested, not just because the unit test passed. The test could well pass but the issue not be fixed.

ASKER
ChristoferDutz

We are currently extending our Feature and Issue Tracking.

Our goal is it to add a testcase specification for Bugs or Features as Sub-Issues in our issue tracker. As soon as a dvelpers starts working on an issue, he implements a unit-test for testing this functionality and the JUnit extension should take care of seting the issue status. This functionality should only be available when run on our continuous integration server. We want to implement the thing to automatically reopen an issue, if a previously successfull test fails because of recent changes. By this we can see the progress of a Project directly in Jiras diagrams.

In the meanwhile I managed to find out, that I have to create a custom test runner class and explicitly using this runner by using the
@RunWith(IntegrationTestIgnorer.class)
By using the Jira SOAP extensions I should be able to achieve, what I want.
Mick Barry

>  that I have to create a custom test runner class and explicitly using this runner by using the
@RunWith(IntegrationTestIgnorer.class)
By using the Jira SOAP extensions I should be able to achieve, what I want.

thats right, you need something that will process your annotation to perform the jira update.


interwsting idea, must give it some more thought :)

Your help has saved me hundreds of hours of internet surfing.
fblack61
Mick Barry

updating jira should be the easy part.

ASKER
ChristoferDutz

Ok ... I finally got all parts together.

On the one side, you have to turn on the Jira SOAP interface.
I am now creating a JUnit Runner usint some help from these sites:
http://schuchert.wikispaces.com/CustomJunit4RunnerJUnit4_4
http://blog.nominet.org.uk/tech/2008/08/26/writing-a-custom-junit-45-test-runner/

And then I am using the Jira SOAP client tool described on:
http://confluence.atlassian.com/display/JIRAEXT/JIRA+Maven2+SOAP+Library

to communicate with my Jira. Hope I'll have it finished soon ;-)
SOLUTION
Mick Barry

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
ASKER CERTIFIED SOLUTION
Log in to continue reading
Log In
Sign up - Free for 7 days
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
ASKER
ChristoferDutz

For all that might be interested ... Having a look at the Perl implementation on:
http://confluence.atlassian.com/display/JIRA/Creating+a+SOAP+Client
Gave me the clue at how to Update an issues workflow ;-) (Don't look at the Java stuff ... it's a read-only-example)
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.