initializationError while running integration tests



Hi everyone,

I would like to create integration tests using Teleporter for my AEM project but run into and error while trying to execute a simple test.

I run the command mvn clean verify -PintegrationTests -Dtest.server.url=http://localhost:4502

and receive this error:

Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 4.346 s <<< FAILURE! - in

[ERROR] initializationError(  Time elapsed: 0.006 s  <<< FAILURE!

java.lang.AssertionError: initializationError( Lorg/apache/sling/junit/rules/TeleporterRule;

Here's the test im trying to run:


import org.junit.Rule;
import org.junit.Test;
import org.osgi.framework.BundleContext;

import java.util.UUID;

import static junit.framework.TestCase.assertEquals;
import static junit.framework.TestCase.assertNotNull;

public class BasicTeleporterTest {

   public final TeleporterRule teleporter = TeleporterRule.forClass(getClass(), "Launchpad");

   public void testBundleContext() {

   final BundleContext bc = teleporter.getService(BundleContext.class);
   assertNotNull("Teleporter should provide a BundleContext", bc);

   public void testConfigAdmin() throws IOException {

   final String pid = "TEST_" + getClass().getName() + UUID.randomUUID();

  final ConfigurationAdmin ca = teleporter.getService(ConfigurationAdmin.class);
   assertNotNull("Teleporter should provide a ConfigurationAdmin", ca);

  final Configuration cfg = ca.getConfiguration(pid);
   assertNotNull("Expecting to get a Configuration", cfg);
   assertEquals("Expecting the correct pid", pid, cfg.getPid());


My project is based on version 19 of the AEM archetype and the pom files are largely unchanged.

Accepted Solutions (1)

Accepted Solutions (1)



The issue I encountered can be resolved by:

Making sure you import all packages required to run you tests (by default, every packaged needed is imported Apache Felix - Apache Felix Maven Bundle Plugin (BND) ). Also update your bundle to make sure TeleporterRule is there and exported correctly.

Answers (0)