Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Possible to mock Jira data in unit tests?

Edited

Is there any sort of unit test fixture (besides integration tests) that allow me to create users, issues, and the like in order to create test data in memory for quick and efficient unit testing without waiting for a Jira instance to start?

I'm implementing test fixture mock data manually, such as a test fixture that instantiates a new ApplicationUser or new CustomField, in order to create dummy data for unit testing my Jira plugin (java) backend. Doing so let's me prototype without slowly testing and debugging against a Jira dev server. Each of these Jira data classes mentioned above is an interface with 20 - 50 methods that must be implemented - quite a lot of code! Also, the implementation details I am dangerously guessing, such as how id and name values are set for each class following patterns I detect from REST API calls (e.g. custom field ids seem to start with "customfield_").

I'm happy with my test fixtures - they work, but it's a lot of code and I figured someone else must have done this before enough times to share a fixture? The benefit is developer efficiency with lightning fast unit tests. Starting Jira server locally takes my puny laptop a couple of minutes, then navigating pages can even take 10 - 20 seconds each ;)

 

I should clarify too - I know how to "mock" (with mockito, Junit) but that is not what I'm asking. Mocks still need to return some kind of data, which is ultimately an Issue, CustomField, or some other Jira data and that is what I'm looking to automate the creation of for testing purposes.

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Jira

Do you use Jira Cloud with Microsoft Teams?

Hi, Jira users! Do you use Jira alongside Microsoft Teams? We want to hear how you’ve used the power of Jira Cloud and Microsoft Teams (via the Jira Cloud for Microsoft Teams app) to achieve a team...

95 views 0 3
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you