Test plugin using API objects.

Artemy Matvienko
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 23, 2018

I would like to create some unit/integration/functional tests for my plugin. I've done unit tests for a plugin before, but the input and output I was testing was Java Core objects, not Atlassian JIRA objects. This time, I need to create tests for a plugin servlet with functions that take in HTTP requests, projects, versions, and users, while also making use of many "manager" classes. I want to know how I can create these sorts of tests.

I looked around for documentation, tutorials, and questions about this, but couldn't find anything that quite fits my requirements that I've outlined above.

I'm not sure how I would go about setting up the HTTP requests, projects, versions, and users programmatically without it being overly complex and time consuming. I wonder if there's something that Atlassian provides for this sort of thing. I've noticed some "mock" classes in the documentation - maybe that's what I need. 

I'd love to get some help with finding documentation or tutorials on how to do this sort of testing for a JIRA plugin. Tips and recommendations are also welcome.

2 answers

1 accepted

0 votes
Answer accepted
Alexey Matveev
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 23, 2018

There are two types of integration testing Jira: wired tests and "gui" tests.

In the wired test you test all services, which are exported by your Jira plugin. You can find more info here:

https://developer.atlassian.com/server/framework/atlassian-sdk/create-and-run-traditional-integration-tests/

In the "gui" test you test Jira via gui. You can find more info here:

https://developer.atlassian.com/server/jira/platform/writing-integration-tests-for-your-jira-add-on/

Artemy Matvienko
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 23, 2018

Oh, I like the sound of jWebUnit tests! Having some trouble setting it up though.

Also, some other community posts called that an outdated tutorial. I'll see if TestKit works better with QuickReload.

0 votes
Straight Girl September 7, 2020

pls i need someone to help me with my github profile setup and i won mind having some from this platform has a mentor

Suggest an answer

Log in or Sign up to answer