简体   繁体   中英

@Test Annotation in TestNG is not working in Eclipse

I have installed TestNG(ver:6.8.6.20130517_2218) in Eclipse (Ver: 1.4.2.20120213-0813) on Windows7(64bit). I verified that TestNG is successfully installed

When I write @Test in one of the sample jave file that I created, Annotation(@Test) is not resolved. It is giving Syntax error.What could be the issue? Please see the attached screenshot for more details

确保您正在导入注释。

 import org.testng.annotations.*;

Thanks for all your answers and help. I got the mistake what I am doing:

I am just leaving by writing @Test annotation. Instead if I write the annotation along with function this error is not coming. For eg

@Test 
public void sampletest() { }

then the error which I am facing won't come.

对于以后的任何访客,我也可以通过公开测试方法来解决此问题。

testng annotations not working.

Inclusion of the following (post by Korey Hinton) helped. import org.testng.annotations.*; -

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM