Please ensure below things:
1. Importing testngimport org.testng.annotations.Test;
2.If maven, add below dependency to POM.xml
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.9.10</version>
</dependency>
<dependency>
3.Import Testng.jar in case of non-maven project.
If still issue persists, kindly post error message.
solved TestNG framework, @Test Annotation code is not working