Clarifications about jira-func-test-plugin, testkit and PageObjects for integration test development

Hello,

I would like to set up a CI/CD pipeline with Bamboo with unit, integration and functional (UI) tests for Jira Server v8.16.1.
I’ve been looking at the Atlassian docs, but it seems to be quite outdated and raised more questions than it answered:

  • After reading this page I added the PageObject dependency in the POM file and the code in my IDE, but the code seems broken - there are unknown variables and methods, like csvFile, showAdvanced() or this.delimiter. Is the PageObject library deprecated or will it be in the near future?

  • What about the jira-func-test-plugin? Is it deprecated? It is also mentioned in the PageObject tutorial linked above, and it seems that you can’t use PageObject without using jira-func-test-plugin too. Do they have a dependency relation or are they completely independent form each other? I read this page. Here the author states that both libraries are used for ui.

  • How does the Wired Test framework fit with the jira-func-test-plugin and PageObject?

Thank you in advance

1 Like

Same here, been stuck on this for days. Dependencies not working with 8.x.y and / or depreciated technologies that have not been updated in years. It would be great to get an answer from Atlassian

Regarding 1

The tutorial Writing integration tests using PageObjects is too old and I do not recommend following it from A to Z. It is broken because nobody maintains it as well as jira-func-test-basics package (Bitbucket). There is a legacy package available to fix this error, but it’s more suitable for legacy codebase iterative migration than for starting a new project.

Regarding 2

What about the jira-func-test-plugin? Is it deprecated?

Func Tests are not recommended for integration testing of internal plugin logic like services and spring beans. You should use Wired Tests for this. Func Tests usage scope narrowed to E2E (functional, acceptance) testing with Page Objects and WebDriver/Selenium.

It is also mentioned in the PageObject tutorial linked above, and it seems that you can’t use PageObject without using jira-func-test-plugin too. Do they have a dependency relation or are they completely independent form each other?

com.atlassian.jira:atlassian-jira-pageobjects is the main player for E2E testing. It is released with each Jira release and it has an internal dependency com.atlassian.jira:jira-func-tests.
For more clues you may explore this package and its siblings from the com.atlassian.jira:jira-functional-tests parent package:

So, you may import jira-func-tests dependency and use Func Test classes from it where needed.

I read this page. Here the author states that both libraries are used for ui.

Yes, it is. Func Tests and Page Objects are recommended for E2E (functional/acceptance) tests only and are not recommended for internal Wired Tests for services and other spring beans.

Regarding 3

How does the Wired Test framework fit with the jira-func-test-plugin and PageObject?

You can use PageObjects for E2E Testing without Func Tests.
First of all, add com.atlassian.jira:atlassian-jira-pageobjects dependency matching your Jira version:

<dependency>
    <groupId>com.atlassian.jira</groupId>
    <artifactId>atlassian-jira-pageobjects</artifactId>
    <version>${jira.version}</version>
    <scope>test</scope>
</dependency>

Then ditch broken com.atlassian.jira.tests:jira-func-test-basics dependency (if you used it as described in the official tutorial Writing integration tests using PageObjects).

Add CsvSetupPage.java without broken methods:

package it.com.example;

import com.atlassian.jira.pageobjects.pages.AbstractJiraPage;
import com.atlassian.pageobjects.elements.ElementBy;
import com.atlassian.pageobjects.elements.PageElement;
import com.atlassian.pageobjects.elements.query.TimedCondition;

public class CsvSetupPage extends AbstractJiraPage {
  @ElementBy(id = "nextButton")
  protected PageElement nextButton;

  @ElementBy(cssSelector = "#advanced h3.toggle-title")
  private PageElement advanced;

  @Override
  public TimedCondition isAt() {
    return nextButton.timed().isVisible();
  }

  @Override
  public String getUrl() {
    return '/secure/admin/views/CsvSetupPage!default.jspa?externalSystem=com.atlassian.jira.plugins.jira-importers-plugin:csvImporter';
  }
}

Run it in a simple test CsvSetupPageE2ETest.java:

package it.com.example;

import com.atlassian.jira.pageobjects.JiraTestedProduct;
import com.atlassian.jira.pageobjects.config.EnvironmentBasedProductInstance;
import org.junit.Test

public class CsvSetupPageE2ETest {
  @Test
  public void testSetupPage() {
    JiraTestedProduct jira = new JiraTestedProduct(new EnvironmentBasedProductInstance());

    CsvSetupPage page = jira.gotoLoginPage().loginAsSysAdmin(CsvSetupPage);
    // do whatewer you need with the page
  }
}

Now your simple E2E (functional/acceptance) test can be performed without explicitly extending BaseJiraFuncTest or whatever else FuncTest-related as:

atlas-mvn jira:integration-test

Regarding Jira TestKit

You don’t need Func Tests to use TestKit. It is independent.
Here is the official example: Bitbucket

Also, I would recommend reading this tutorial Smarter integration testing with TestKit.

P.S.
Don’t rely only on Atlassian documentation it is mostly outdated. I usually explore new Jira sources and dependencies, and look through plugins repositories on BitBucket as well to understand how it works at the current moment for the current Jira version.