How to create java batch file from Intellij IDEA project (Selenium and TestNG)

I want to create an executable batch file to run my project without IDE. The file hierarchy is shown below. * I am using Intellij IDEA enter image description here

+3


source to share


1 answer


You need to first find the correct command line to enter in order to run the testng tests.

If you can customize it pom.xml

to work mvn clean test

, you can adapt it in Jenkins' assignment.


See TestNG Maven plug-ins for yours to pom.xml

include the correct plugins.
For selenium you can follow the tutorial " Maven and Jenkins with Selenium " Your dependencies should include:



    <dependency>                
         <groupId>junit</groupId>                               
         <artifactId>junit</artifactId>                             
         <version>3.8.1</version>                               
         <scope>test</scope>                                
    </dependency>               
    <dependency>                
        <groupId>org.seleniumhq.selenium</groupId>                              
        <artifactId>selenium-java</artifactId>                              
        <version>2.45.0</version>                               
    </dependency>               
    <dependency>                
        <groupId>org.testng</groupId>                               
        <artifactId>testng</artifactId>                             
        <version>6.8</version>                              
        <scope>test</scope>                                     
   </dependency>    

      


Then a simple maven job with Jenkins with a target clean test

should be enough:

https://cdn.guru99.com/images/5-2015/050115_1023_MavenJenkin27.jpg

+1


source







All Articles