TestNG requires JDK 7 or higher to use.
According to http://testng.org/doc/download.html in order to install testng you need to add testng dependency to your maven pom.xml or gradle build.gradle file
Maven:
<repositories>
<repository>
<id>jcenter</id>
<name>bintray</name>
<url>http://jcenter.bintray.com</url>
</repository>
</repositories>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.9.12</version>
<scope>test</scope>
</dependency>
Gradle:
repositories {
jcenter()
}
dependencies {
testCompile 'org.testng:testng:6.9.12'
}
More options can be found in the official page.