TestNG - @Test on constructor

user7294900 :

I don't have the newest version of TestNG, and I have option to add @Test on constructor, java docs

@Target({METHOD, TYPE, CONSTRUCTOR}) 
public @interface Test {

I didn't find any clue on usage in docs or searching online

@Test Marks a class or a method as part of the test.

When/Why @Test can be define on constructor? is it for internal purposes only?

I saw that CONSTRUCTOR was removed in latest TestNG version, but I didn't find why.

Marcel :

See issue "Remove irrelevant "targets" for TestNG annotations": The target CONSTRUCTOR had no functionality in older versions, because constructors were not seen as test methods. That's why the target was removed later.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=134891&siteId=1