Jira TestKit for Jira 9

On the suggestion of Atlassian themselves, I started trying to use Jira Testkit to write integration tests for my company’s Jira plugin. This works great for Jira 8, but:

There appears to be no Jira 9 version

Checking mvnrepository, testkit stills appear to be under active development, but the latest version is 8.2.0:

https://mvnrepository.com/artifact/com.atlassian.jira.tests/jira-testkit-client?repo=atlassian-packages-public

The git repo history seems to confirm this: Bitbucket

The readme says:

The TestKit version numbering scheme mirrors the Jira version that it is compatible with. For example, TestKit 5.0 is compatible with Jira 5.0. But because the TestKit builds on the official Jira Java API, TestKit 5.0 is also compatible with any 5.x version of Jira, as per the Java API Policy for Jira. This means you can use TestKit 5.0 in your integration tests that run against Jira 5.0, Jira 5.1, and Jira 5.2, with no additional modifications.

So, I am not surprised that…

The Jira 8 version doesn’t work on Jira 9

I get these stack traces when running this line:

 testKit.project().addProjectWithTemplate(
                "TEST", "TEST", "admin", "com.atlassian.jira-core-project-templates:jira-core-task-management");
java.lang.NoSuchMethodError: 'com.atlassian.jira.user.ApplicationUser com.atlassian.jira.user.util.UserUtil.getUser(java.lang.String)'
        at com.atlassian.jira.testkit.plugin.ProjectBackdoor.getUserWithAdminPermission(ProjectBackdoor.java:261)
        at com.atlassian.jira.testkit.plugin.ProjectBackdoor.addProject(ProjectBackdoor.java:121)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        ... 19 filtered
        at com.atlassian.plugins.rest.module.RestDelegatingServletFilter$JerseyOsgiServletContainer.doFilter(RestDelegatingServletFilter.java:171)
        ... 1 filtered
        at com.atlassian.plugins.rest.module.RestDelegatingServletFilter.doFilter(RestDelegatingServletFilter.java:75)
        ... 36 filtered
        at com.atlassian.jira.plugin.mobile.web.filter.MobileAppRequestFilter.doFilter(MobileAppRequestFilter.java:59)
        ... 4 filtered
        at com.atlassian.jira.plugin.mobile.login.MobileLoginSuccessFilter.doFilter(MobileLoginSuccessFilter.java:54)
        ... 3 filtered
        at com.atlassian.diagnostics.internal.platform.monitor.http.HttpRequestMonitoringFilter.doFilter(HttpRequestMonitoringFilter.java:54)
        ... 8 filtered
        at com.atlassian.web.servlet.plugin.request.RedirectInterceptingFilter.doFilter(RedirectInterceptingFilter.java:21)
        ... 24 filtered
        at com.atlassian.labs.httpservice.resource.ResourceFilter.doFilter(ResourceFilter.java:59)
        ... 22 filtered
        at com.atlassian.oauth2.scopes.web.ReadWriteScopeFilter.doFilter(ReadWriteScopeFilter.java:46)
        ... 3 filtered
        at com.atlassian.ratelimiting.internal.filter.RateLimitFilter.doFilter(RateLimitFilter.java:73)
        ... 3 filtered
        at com.atlassian.troubleshooting.thready.filter.AbstractThreadNamingFilter.doFilter(AbstractThreadNamingFilter.java:46)
        ... 17 filtered
        at com.atlassian.jira.security.JiraSecurityFilter.lambda$doFilter$0(JiraSecurityFilter.java:66)
        ... 1 filtered
        at com.atlassian.jira.security.JiraSecurityFilter.doFilter(JiraSecurityFilter.java:64)
        ... 16 filtered
        at com.atlassian.plugins.rest.module.servlet.RestSeraphFilter.doFilter(RestSeraphFilter.java:38)
        ... 3 filtered
        at com.atlassian.pats.web.filter.TokenBasedAuthenticationFilter.doFilter(TokenBasedAuthenticationFilter.java:82)
        ... 3 filtered
        at com.atlassian.oauth2.provider.core.web.AccessTokenFilter.doFilter(AccessTokenFilter.java:81)
        ... 19 filtered
        at com.atlassian.jira.servermetrics.CorrelationIdPopulatorFilter.doFilter(CorrelationIdPopulatorFilter.java:30)
        ... 5 filtered
        at com.atlassian.plugins.authentication.impl.basicauth.filter.DisableBasicAuthFilter.doFilter(DisableBasicAuthFilter.java:70)
        ... 8 filtered
        at com.atlassian.ratelimiting.internal.filter.RateLimitPreAuthFilter.doFilter(RateLimitPreAuthFilter.java:71)
        ... 3 filtered
        at com.atlassian.web.servlet.plugin.request.RedirectInterceptingFilter.doFilter(RedirectInterceptingFilter.java:21)
        ... 4 filtered
        at com.atlassian.troubleshooting.thready.filter.AbstractThreadNamingFilter.doFilter(AbstractThreadNamingFilter.java:46)
        ... 3 filtered
        at com.atlassian.web.servlet.plugin.LocationCleanerFilter.doFilter(LocationCleanerFilter.java:36)
        ... 26 filtered
        at com.atlassian.jira.servermetrics.MetricsCollectorFilter.doFilter(MetricsCollectorFilter.java:25)
        ... 24 filtered
        at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191)
        at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659)
        at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
        at java.base/java.lang.Thread.run(Thread.java:829)

so… What gives? Do other plugin developers just not use testkit and instead write integration tests entirely from scratch? Does anyone from Atlassian know what’s going on here?

1 Like

I discovered that many testkit functions work on Jira 9, but not the ones which have something to do with users:

  • Create project (relationship to users has to do with “project lead” field)
  • Delete project
  • Delete user
  • Add user to group

The main thrust of my question remains unanswered: It’s not clear to me where a version for Jira 9 which just works is.

I figured this out!

Checking mvnrepository, testkit stills appear to be under active development, but the latest version is 8.2.0

This turned out to not be correct - Testkit 8.1.49 is more recent than 8.2.0 and worked with Jira 9 with no issues.

1 Like