java - Batch files launches and disappear without executing Selenium tests -
i have created selenium project named 'learnautomation' in java , convert testng tests created testng.xml me. want run via batch file. created 1 below -
cd e:\workspace - eclipse\learnautomation set projectpath=e:\workspace - eclipse\learnautomation echo %projectpath% set classpath=%projectpath%\bin;%projectpath%\lib\* echo %classpath% java org.testng.testng %projectpath%\testng.xml
and save testng.bat file. on double clicking batch file, gets launched , disappeared. (failed run test)
my testng.xml looks -
<?xml version="1.0" encoding="utf-8"?> <!doctype suite system "http://testng.org/testng-1.0.dtd"> <suite name="suite" parallel="none"> <test name="test"> <classes> <class name="tests.demo"/> </classes> </test> <!-- test --> </suite> <!-- suite -->
my demo class looks -
package tests; import org.openqa.selenium.webdriver; import org.openqa.selenium.firefox.firefoxdriver; import org.testng.annotations.test; public class demo { @test public void batchfile() { system.setproperty("webdriver.gecko.driver", "c:\\users\\srvashishtha\\downloads\\geckodriver-v0.11.1-win64\\geckodriver.exe"); webdriver driver = new firefoxdriver(); driver.get("http://www.google.com"); } }
Comments
Post a Comment