Reputation: 125
I am new to TestNg , Selenium.
My problem is I am not able to run my TestNG suite. When I click my testNg suite (By right clicking crossBrowser.xml and click TestNG Suite), It is not running, It does not show any error in the console.
Please find the code I am using.
VerifyTitle.java
package testNGTestPack;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.ie.InternetExplorerDriver;
import org.testng.annotations.Parameters;
import org.testng.annotations.Test;
public class VerifyTitle {
WebDriver driver;
@Test
@Parameters("browserName")
public void verifyTitle(String browserName){
if(browserName.equalsIgnoreCase("firebox")) {
driver=new FirefoxDriver(); }
else if(browserName.equalsIgnoreCase("chrome")){
System.setProperty("webdriver.chrome.driver", "D:\\driver\\chromedriver.exe");
driver = new ChromeDriver();
}
else if(browserName.equalsIgnoreCase("IE")){
System.setProperty("webdriver.ie.driver", "D:\\driver\\IEDriverServer.exe");
driver=new InternetExplorerDriver();
}
driver.manage().window().maximize();
driver.get("http://www.facebook.com");
//driver.quit();
}
}
crossBrowser.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="testNGTestPack">
<test name="Test">
<parameter name="browserName" value="firebox"/>
<classes>
<class name="testNGTestPack.VerifyTitle"/>
</classes>
</test> <!-- Test -->
</suite> <!-- Suite -->
Eclipse Version : : Luna Service Release 2 (4.4.2)
When right clicking against crossBrowser.xml which is showing Run As TestNg Suite. But clicking on it, it does not trigger any action. Even in console, it show any error.
Do I need to include any jar file? Please give me a solution
Upvotes: 1
Views: 3043
Reputation: 831
Yes you need to create a new configuration for this.
Select your testng.xml file > Run as > Run Configuration > Click on TestNG on left panel > Right click and and CLick on new > Click on Suite > Browse xml and click on run.
Please try and let me know.
Thanks Mukesh
Upvotes: 2