Hi,
I'm trying to run testng from command line. This is a simple test to open a web page. This will run in eclipse successfully. Please help me, I'm mew to this. I've been working on this for more than a week now, I've read every single post that shows under search for "Testng command". Those people have different problem than what I'm facing. I'm not having main class not found error, I don't see any error but failure is 1.
Starting ChromeDriver 85.0.4183.87 (cd6713ebf92fa1cacc0f1a598df280093af0c5d7-refs/branch-heads/4183@{#1689}) on port 26927 Only local connections are allowed. Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe. ChromeDriver was started successfully.
===============================================
Suite
Total tests run: 1, Passes: 0, Failures: 1, Skips: 0
===============================================
C:\Eclipse\WorkSpace\TestingJenkins>set classpath=C:\Eclipse\lib*;C:\Eclipse\Drivers*;C:\Program Files\Java\jdk-14*;C:\Eclipse\WorkSpace\TestingJenkins\bin
C:\Eclipse\WorkSpace\TestingJenkins>java org.testng.TestNG testng.xml
package Package1;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.testng.annotations.Test;
public class Test1
{
@Test
public void f()
{
Sttring baseUrl = "http://demo.example.com/test/delete_customer.php";
String driverPath = "C:\\Eclipse\\Drivers\\Chromedriver.exe";
WebDriver driver;
System.setProperty("webdriver.chrome.driver", driverPath);
driver = new ChromeDriver();
driver.get(baseUrl);
driver.manage().window().maximize();
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
driver.quit();
System.out.println("///////////////////////////////////////////////////////////////////////");
}
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "https://testng.org/testng-1.0.dtd">
<suite name="Suite">
<test thread-count="5" name="Test">
<classes>
<class name="Package1.Test1"/>
</classes>
</test> <!-- Test -->
</suite> <!-- Suite -->