Expand my Community achievements bar.

SOLVED

junit error in system/console.

Avatar

Level 3

Hello 

Am getting error in system/console like 

junit.framework -- Cannot be resolved
junit.textui -- Cannot be resolved

I have added supporting dependencies also stil am getting this error .

That would be great for your reply.

 

Thanks,

Rahul

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

If these are test dependencies, then make sure you flag these as test dependencies during the maven build. It looks like JUNIT should have never been deployed to your AEM environment. Also, please make sure your AEM has installed the latest service pack, so new dependencies can be resolved.

In other notes, this is how you would scope a dependency to be for tests only.

<dependencies>
  <!-- JUnit -->
  <dependency>
    <groupId>junit</groupId>
    <artifactId>junit</artifactId>
    <version>4.13.2</version>
    <scope>test</scope>
  </dependency>

  <!-- Mockito -->
  <dependency>
    <groupId>org.mockito</groupId>
    <artifactId>mockito-core</artifactId>
    <version>3.12.4</version>
    <scope>test</scope>
  </dependency>

  <!-- AssertJ -->
  <dependency>
    <groupId>org.assertj</groupId>
    <artifactId>assertj-core</artifactId>
    <version>3.21.0</version>
    <scope>test</scope>
  </dependency>

  <!-- Selenium WebDriver -->
  <dependency>
    <groupId>org.seleniumhq.selenium</groupId>
    <artifactId>selenium-java</artifactId>
    <version>4.4.0</version>
    <scope>test</scope>
  </dependency>
</dependencies>

View solution in original post

1 Reply

Avatar

Correct answer by
Community Advisor

If these are test dependencies, then make sure you flag these as test dependencies during the maven build. It looks like JUNIT should have never been deployed to your AEM environment. Also, please make sure your AEM has installed the latest service pack, so new dependencies can be resolved.

In other notes, this is how you would scope a dependency to be for tests only.

<dependencies>
  <!-- JUnit -->
  <dependency>
    <groupId>junit</groupId>
    <artifactId>junit</artifactId>
    <version>4.13.2</version>
    <scope>test</scope>
  </dependency>

  <!-- Mockito -->
  <dependency>
    <groupId>org.mockito</groupId>
    <artifactId>mockito-core</artifactId>
    <version>3.12.4</version>
    <scope>test</scope>
  </dependency>

  <!-- AssertJ -->
  <dependency>
    <groupId>org.assertj</groupId>
    <artifactId>assertj-core</artifactId>
    <version>3.21.0</version>
    <scope>test</scope>
  </dependency>

  <!-- Selenium WebDriver -->
  <dependency>
    <groupId>org.seleniumhq.selenium</groupId>
    <artifactId>selenium-java</artifactId>
    <version>4.4.0</version>
    <scope>test</scope>
  </dependency>
</dependencies>