When we add TestNG dependency in POM.xml

If you want to run the test from both the section in Maven Project (Main and Test) then remove <scope> test </scope> 

by default Maven doesnot allow to execute the code from Main section, so in order to execute code from main section we must remove <scope> test </scope>  line from testNG dependency.



This is displayed as below

----------------------------------------
                 <dependency>
    <groupId>org.testng</groupId>
    <artifactId>testng</artifactId>
    <version>6.14.3</version>
    <scope>test</scope>
</dependency>
----------------------------------------


Which means TestNG will execute the code under Test folder (Maven has 2 folder- 1-main, 2-Test)
We will allow the TestNG to execute the code from "main" folder after removing <scope> tag

Let's remove this scope 

----------------------------------------
                 <dependency>
    <groupId>org.testng</groupId>
    <artifactId>testng</artifactId>
    <version>6.14.3</version>
</dependency>
----------------------------------------

Post a Comment

Facebook

QA Artifacts for Advanced Learning