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?
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With