Intergration testing of plugin components

Hi,

Can somebody point to examples of integration tests for BitBucket plugin components, which are not listed in atlassian-plugin.xml, but loaded by Spring Scanner?

For example, here is my component (simplified code)

@Component("repositoryCreatedListener")
public class RepositoryCreatedListener {
    
    @ComponentImport
    private RepositoryHookService rhService;

    @Autowired
    public void setRhService(RepositoryHookService rhService) {
        this.rhService = rhService;
    }

    @EventListener
    public void repositoryCreated(RepositoryCreatedEvent evt) {
        Repository repository = evt.getRepository();
        // useful things happen here
    }

}

My attempt to instanciate it during itegration test

@RunWith(AtlassianPluginsTestRunner.class)
public class RepositoryCreatedListenerTest {

    private final RepositoryCreatedListener newRepositoryListener;

    public RepositoryCreatedListenerTest(RepositoryCreatedListener newRepositoryListener) {
        this.newRepositoryListener = newRepositoryListener;
    }

    @Test
    public void testMyName() {
        assertNotNull(newRepositoryListener);
    }

}

results in
RepositoryCreatedListenerTest: Could not find resource for test [http://XXX-86LJJ5J:7990/bitbucket/rest/atlassiantestrunner/1.0/runtest/it.org.cbs.bitbucket.repo.impl.RepositoryCreatedListenerTest]. Status: 404 - Not Found

1 Like

Hi @viktor,

Did you manage to solve this in the end?
Im getting the same problem.

Hi @allan.leong, no, unfortunately we gave up on this ;(