0

In the POM file when I add the testng dependency, I never get the option to import testng. I only get Junit. I do not have Junit as dependency.

  <dependency>
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
            <version>7.3.0</version>
            <scope>test</scope>
        </dependency>

As I was researching the issue I found someone faced similar issue in the link below. However I did not see a solution. Any one knows how to get around this situation? I want to use TestNG so that I can use testNG.xml to run the tests.

https://intellij-support.jetbrains.com/hc/en-us/community/posts/360003437720-Why-Intellij-doesn-t-import-the-TestNG-maven-dependency-automatically-

Thanks in advance

Sheikh Rahman
  • 895
  • 3
  • 14
  • 29

3 Answers3

1

It works for me. Make sure you have added dependency for the correct Maven module into dependencies section. After this make sure you have re-imported project in Maven tool window:

enter image description here

Andrey
  • 15,144
  • 25
  • 91
  • 187
1

Initially I had the same problem when I copy artifacts from https://mvnrepository.com/artifact/org.testng/testng/7.3.0 and paste the code on my IntelliJ it was showing the errors, Once I have Reload from Disk(right click on project it will show the option) it was showing refresh option on the right side of the screen, once I refreshed it the error was resolved.

vijay kumar
  • 21
  • 1
  • 2
1

I tried the reload option shown in the top right corner of Intellij, that didn't work for me. Then I right clicked on project > maven > Reload Project.

After this all the maven dependencies were resolved.