Hello!
I am trying to run an integration test from an Atlassian case study:
tutorial
But after launch atlas-integration-test an error occurs:
[INFO]
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
[INFO] Running it.com.example.plugins.tutorial.jira.testTutorial.MyComponentWiredTest
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
[INFO] [talledLocalContainer] окт 09, 2019 2:18:38 PM com.sun.jersey.server.impl.application.WebApplicationImpl _initiate
[INFO] [talledLocalContainer] INFO: Initiating Jersey application, version 'Jersey: 1.19.4 05/24/2017 03:20 PM'
[INFO] [talledLocalContainer] окт 09, 2019 2:18:38 PM com.sun.jersey.api.wadl.config.WadlGeneratorLoader loadWadlGenerator
[INFO] [talledLocalContainer] INFO: Loading wadlGenerator com.sun.jersey.server.wadl.generators.WadlGeneratorApplicationDoc
[INFO] [talledLocalContainer] окт 09, 2019 2:18:38 PM com.sun.jersey.api.wadl.config.WadlGeneratorLoader loadWadlGenerator
[INFO] [talledLocalContainer] INFO: Loading wadlGenerator com.atlassian.plugins.rest.doclet.generators.grammars.WadlGrammarsAdaptor
[INFO] [talledLocalContainer] окт 09, 2019 2:18:38 PM com.sun.jersey.api.wadl.config.WadlGeneratorLoader loadWadlGenerator
[INFO] [talledLocalContainer] INFO: Loading wadlGenerator com.atlassian.plugins.rest.doclet.generators.resourcedoc.AtlassianWadlGeneratorResourceDocSupport
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 1.834 s <<< FAILURE! - in it.com.example.plugins.tutorial.jira.testTutorial.MyComponentWiredTest
[ERROR] initialization(it.com.example.plugins.tutorial.jira.testTutorial.MyComponentWiredTest) Time elapsed: 1.833 s <<< ERROR!
java.lang.Throwable: unable to find runner for class: it.com.example.plugins.tutorial.jira.testTutorial.MyComponentWiredTest
package it.com.example.plugins.tutorial.jira.testTutorial;
import org.junit.Test;
import org.junit.runner.RunWith;
import com.atlassian.plugins.osgi.test.AtlassianPluginsTestRunner;
import com.example.plugins.tutorial.jira.testTutorial.api.MyPluginComponent;
import com.atlassian.sal.api.ApplicationProperties;
import static org.junit.Assert.assertEquals;
@RunWith(AtlassianPluginsTestRunner.class)
public class MyComponentWiredTest
{
private final ApplicationProperties applicationProperties;
private final MyPluginComponent myPluginComponent;
public MyComponentWiredTest(ApplicationProperties applicationProperties,MyPluginComponent myPluginComponent)
{
this.applicationProperties = applicationProperties;
this.myPluginComponent = myPluginComponent;
}
@Test
public void testMyName()
{
assertEquals("names do not match!", "myComponent:" + applicationProperties.getDisplayName(),myPluginComponent.getName());
}
}
Does anyone have any idea why the runner cannot be found?
1 Like
I can’t really explain why this works because I don’t claim to understand OSGI, but this worked for me.
In your project’s pom.xml, under the relevant com.atlassian.maven.plugins configuration, instructions section, modify the last line of the Import-Package section as follows:
<Import-Package>
...
*;version="0";resolution:=optional
</Import-Package>
Credit to this answer for the tip.
I’m trying to follow along with the tutorial and I get the same error as the OP.
Adding the suggested change to the Import-Package section does not fix the problem for me.
atlassian-plugin-sdk: 8.0.16
Java version: 1.8.0_242
Same here. I am writing a bitbucket plugin. The plugin already seems to work and the unit tests are running without a problem. Only the integration tests won’t work.
I tried the suggested solution but nothing changed
atlassian-plugin-sdk: 8.0.16
It turned out that I had several problems with my plugin.
- Special character in the plugin descriptor that couldn’t be read and thus the plugin couldn’t be loaded
- When I run
atlas-integration-test
it started the refapp instead of bitbucket. Because I have bitbucket specific dependencies the plugin couldn’t be loaded. I have been able to fix that with atlas-integration-test --version 6.8.0 --product bitbucket
. However I still do not know why it starts the refapp.
- Plugin wasn’t setup up properly for using atlassian spring scanner
The last point might be the most important one. I guess I decided to switch to atlassian spring scanner when I read through the Controlling when pull requests can be merged learning resource. However the Writing and running plugin tests tutorial uses only traditional integration tests and that left me with an integration test that was half wired half traditional .
Just wanted to leave this information for others in case they run into the same problem.
1 Like
Anyone has the solution for this tutorial, please? I already tried the information described on this topic and other and none solution until now. I tried to use the zip project provided by atlassian and this is not working too.
@barbosa.s.alexandre It would be good to have an error messages or something else to know where you are stuck.
What I can tell you from my experience so far is that the tutorials for running plugin integration tests are a nightmare. They are outdated and mix several techniques. Here are my insights so far:
There are several methods for writing integration tests
- Classical integration tests
- Wired integration tests
Because wired integration tests are the newer ones and easier to configure they should be used. Have a look here for help with them: Bitbucket 2
There are also several methods for running integration tests
- The classical
atlas-integration-test
command
- FastDev and the Plugin Test Konsole
- Quick Reload
- Remote Test
Now it get’s confusing:
In my case I haven’t been able to use AMPS 8.1.1 because the dependencies won’t be resolved correctly then. But I am able to run wired integration tests with the classical atlas-integration-test
command.
After updating to AMPS 8.1.1. I have been able to get quick reload running. I can also confirm that wired tests are now runnable via the plugin test console. Good job atlassian
Here is how to use the new AMPS 8.1.1 Version together with Quick Reload:
- Open the
pom.xml
file for your plugin
- Scroll to
<amps.version>
- Set it to 8.1.1:
<amps.version>8.1.1</amps.version>
- Scroll to
<plugin.testrunner.version>
- Set it to 2.0.2:
<plugin.testrunner.version>2.0.2</plugin.testrunner.version>
- Start the application with
atlas-debug
and afterwards login
- Open the plugin test console with: http://localhost:7990/bitbucket/plugins/servlet/it-test-console. The name bitbucket needs to be replaced by the name of the application you are running
- Click the run button to execute the wired tests
- The test output will be shown on the terminal that you used for running the application
- Make some changes on the plugins sourcecode
- Open a second terminal and rebuild the plugin with
atlas-package
- Thanks to quick reload the running application detects automatically that the plugin has changed and reloads it
- The changed tests can be executed by another press of the run button
I’ve just faced the same error. It turned out the error is misleading. The main cause was that I forgot to import my component in the atlassian-plugin.xml
file in the test resources. It caused ClassNotFound exception during the test plugin loading.
I would recommend looking for other errors in logs during the test plugin loading.