Hi All,
I am following the url https://developer.atlassian.com/display/JIRADEV/Plugin+Tutorial+-+Writing+integration+tests+using+PageObjects for integration testing of my plugin.
I have assumed a few things .Please correct it if i am wrong.
1. Write a plugin with a simple submit button. This pluging will show a text "Button clicked" when someone clicks on the button.
2. I have written an integration test for this plugin following the above tutorial. ie., in the it.com.sample.tester package with the class name MyComponentWiredTest which extends TestBase. The @test method calls another class which makes use the PageElement to click on a button
package it.test.project.info.gadget;
import org.junit.Test;
import org.junit.runner.RunWith;
import com.atlassian.jira.tests.TestBase;
import com.atlassian.plugins.osgi.test.AtlassianPluginsTestRunner;
@RunWith(AtlassianPluginsTestRunner.class)
public class MyComponentWiredTest extends TestBase
{
@Test
public void testGadget(){
ProjectInfoDashboardGadgetIntTester tester = new ProjectInfoDashboardGadgetIntTester();
tester.submitDashboard();
}
The ProjectInfoDashboardGadgetIntTester class is as follows
package it.test.project.info.gadget;
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 ProjectInfoDashboardGadgetIntTester extends AbstractJiraPage{
@ElementBy(id="submitButton")
protected PageElement submitButton;
@Override
public String getUrl() {
return "/secure/Dashboard.jspa?externalSystem=com.mycompany.groupid:project-info-dashboard-gadget-plugin";
}
@Override
public TimedCondition isAt() {
return submitButton.timed().isVisible();
}
public void submitDashboard(){
submitButton.click();
}
}
My pom.xml file has the following dependencies
<dependency>
<groupId>com.atlassian.plugins</groupId>
<artifactId>atlassian-plugins-osgi-testrunner</artifactId>
<version>${plugin.testrunner.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>jsr311-api</artifactId>
<version>1.1.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.2.2-atlassian-1</version>
</dependency>
<dependency>
<groupId>com.atlassian.jira</groupId>
<artifactId>atlassian-jira-pageobjects</artifactId>
<version>5.2.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.atlassian.selenium</groupId>
<artifactId>atlassian-selenium</artifactId>
<version>2.1-m18</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.atlassian.selenium</groupId>
<artifactId>atlassian-pageobjects-elements</artifactId>
<version>2.1.0-m9</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.atlassian.jira.tests</groupId>
<artifactId>jira-func-test-basics</artifactId>
<version>1.9.7</version>
<scope>test</scope>
</dependency>
Now I am not sure how the integration test will be carried out.Upon building two jar files are generated
1. actual plugin jar file
2. actualpluginjar-"tests.jar" file
How will the integration tests be carried out with these files. Should both the files be uploaded one by one?
And if i upload the "-tests.jar" file , i could see a huge difference in size between the original plugin jar file and the "-tests.jar" file. I believe some dependency jar files are attached tot he "-tests.jar" file.
And with that i get the following exception
: Unresolved constraint in bundle com.mycompany.groupid:.test-project-info-gadget-tests [186]: Unable to resolve 186.0: missing requirement [186.0] package; (package=test.project.info.gadget)
at org.apache.felix.framework.Felix.resolveBundle(Felix.java:3409)
at org.apache.felix.framework.Felix.startBundle(Felix.java:1709)
at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:905)
at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:892)
at com.atlassian.plugin.osgi.factory.OsgiPlugin.enableInternal(OsgiPlugin.java:417)
To some extent I understand that some jar files are bundled with the plugin which are already present in the JIRA, but I am not sure about the jar files and how it can be avoided
What i assume is as soon as i upload the "-test.jar" in the admin->manage adon section, the original plugin will be tested automatically.
Is this correct?
Also i am directly working in a development environment and my system does not have and sdk server installed. In these kind of environment how do i do the integrated testing?
Suggest some ideas