Issue
Any idea why TestNG is not running my test? this is the class code(java):
public class main {
@Test
public static void main(String[] args) throws AWTException, InterruptedException
this is the path on eclipse: enter image description here
and this is the XML file:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Suite">
<test name="Test">
<classes>
<class name="test.main"/>
</classes>
</test> <!-- Test -->
</suite> <!-- Suite -->
Solution
I am Posted here a demo template for Your testng.You just need to take a class and declear webdriver. @BeforeMethod
will execute before start any @Test
then @AfterMethod
Hope it will help you.
package stackoverflow;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.testng.annotations.*;
public class DemoTestNGClass {
public static WebDriver driver;
@BeforeMethod
public void setUp1() throws Exception {
driver= new ChromeDriver();
}
@Test
public void Homepage() throws InterruptedException {
//Your operation
}
@Test
public void ListingPage() throws InterruptedException {
//Your operation
}
@AfterMethod
public void afterresult(){
driver.close();
}
}
Answered By - Zakaria Shahed
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.