Reputation: 1893
I am trying to use TestNG to test my Java-code. The TestNG-plugin is installed in IntelliJ, and the dependency:
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.9.10</version>
</dependency>
has been added to Maven. However, when I write "@Test" in a class, IntelliJ gives the error-message: "can not resolve symbol 'Test'.
Importing org.testng.annotations.Test is not recognized either. It just seems like Intellij is ignoring the Maven-dependency.
Here is the project structure and the error:
Should I have done something more with TestNG, rather then just adding the Maven dependency?
Upvotes: 3
Views: 12235
Reputation: 17486
Run mvn clean
Set the scope
of testng
to test
, i.e.:
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.12</version>
<scope>test</scope>
</dependency>
Run mvn install
Upvotes: 3