How to make batch file in selenium using Maven

 Generate .xml file-

1. Right click on project which you want to execute through batch file

2. Go to TestNG & click on Convert to TestNG

3. One testng.xml file will created in your project

4. Move that file to main-> resources folder

5. Right click on project & Run as Maven Clean & then Maven install

        There would be below errors

        - Java version is not compatible with compiler 

        - To change java compiler, Right click on project & go to java build path, then go to java compiler & change java execution environment variable according to error

        - Need to add some xmls in Pom.xml after the <version>

        <properties>

<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

<maven.compiler.source>16</maven.compiler.source>

<maven.compiler.target>16</maven.compiler.target>

</properties>

        - After all the dependencies, add below code

                <build>

<plugins>

<plugin>

<groupId>org.apache.maven.plugins</groupId>

<artifactId>maven-surefire-plugin</artifactId>

<version>3.0.0-M5</version>

<configuration>

<suiteXmlFiles>

<suiteXmlFile>testng.xml</suiteXmlFile>

</suiteXmlFiles>

</configuration>

</plugin>

</plugins>

        </build>

6. Open notepad & add below commands

cd c:\Users\Krina Modi\Desktop\eclipse-workspace\projectFolder

pause

call mvn clean

call mvn install



Comments

Popular posts from this blog

For Get Dynamic data & USe it into Postman Body parameters

API Automation Testing Script to check Response

Login through Data Driven Testing in selenium

Which dependencies needed in pom.xml while doing automation through selenium?

Download Java(JDK) & Eclipse IDE for selenium

What is data driven testing?

How to extract all the links in selenium?