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
Post a Comment