Trying to run Project in Eclipse by Right Click Project>>Run As>>Maven Install
I have only 2 Test Cases in my src\\tests
folder and both the Test Cases are running Fine. After the Tests got completed, Getting Build Failure in Console.
Error:-Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.19.1:test (default-test) on project selenium-project: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.19.1:test failed: There was an error in the forked process org.openqa.selenium.remote.SessionNotFoundException
I have the following way to execute your test from testing.xml file using Maven
Add one Testing.xml
file in project root. Content will be like
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="TestSuit">
<test name="MyTest">
<classes>
<class name="package.subpackage.TestClassName"/>
</classes>
</test>
</suite>
Add Below code in your pom.xml
just above <dependencies>
tag
<!-- Following plugin executes the testing tests -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.12.4</version>
<configuration>
<!-- Suite testng xml file to consider for test execution -->
<suiteXmlFiles>
<suiteXmlFile>testng.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
Do below steps
Right Click on Project > Run As > Maven Clean
Then
Right Click on Project > Run As > Maven Build
Then
Right Click on Project > Run As > Maven Test