Maven Compilation error [package org.testng.annotations does not exist]

后端 未结 9 1385
陌清茗
陌清茗 2020-12-10 11:09

I\'m pretty new to maven and I want to run my test classes using maven. I have generated the testng.xml and I have created the POM.xml file also. But when you run the

9条回答
  •  忘掉有多难
    2020-12-10 12:00

    Even I had faced this issue and got a solution for the same.

    In your pom.xml file remove the scope and this should work fine.

    As per below code in pom.xml, remove the scope tag.

    Even though we have imported the maven dependency for Testng, when you add scope tag in XML file, it treats as JUnit annotation and not as Testng. So when I removed scope tag, My @Test Annotation was treated as Testng Annotation.

    
                org.testng
                testng
                6.8.7
                **test** //Remove this line and compile maven
    
    

提交回复
热议问题