I am getting throws java.lang.InterruptedException, which is not annotated with @Test or not included

395 views
Skip to first unread message

RAVI SHANKAR PATHAK

unread,
Jan 28, 2019, 3:06:25 AM1/28/19
to testng-users
I have two classes in which one method each. Class Demo1 method depend on Class Demo2 method. When i run my test cases using textng xml, i got this error testcases.Demo1.execute1() is depending on method public void testcases.Demo2.execute2() throws java.lang.InterruptedException, which is not annotated with @Test or not included.
Please help me out.
I have maven project
public class Demo1 {


WebDriver driver;

@BeforeTest
public void setUp() {
System.setProperty("webdriver.chrome.driver", "E:\\AutomationProjects\\Takeda_Dashboard\\resources\\Driver\\chromedriver.exe");
driver = new ChromeDriver();
//driver.get("www.google.com");
}

@Test(dependsOnMethods = {"testcases.Demo2.execute2"})
public void execute1() throws InterruptedException {
driver.get("https://mail.google.com/mail/u/0/");
Thread.sleep(10000);
System.out.println("Execute Demo1 :" + "First");
}

@AfterClass
public void clean() {
driver.close();
}
}



public class Demo2 {

WebDriver driver;

@BeforeTest
public void setUp() {
System.setProperty("webdriver.chrome.driver", "E:\\AutomationProjects\\Takeda_Dashboard\\resources\\Driver\\chromedriver.exe");
driver = new ChromeDriver();
}

@Test
public void execute2() throws InterruptedException {
driver.get("https://mail.google.com/mail/u/0/");
Thread.sleep(10000);
System.out.println("Execute Demo2 :" + "Second");
}
@AfterClass
public void clean() {
driver.close();
}
}

⇜Krishnan Mahadevan⇝

unread,
Feb 11, 2019, 11:42:07 PM2/11/19
to testng...@googlegroups.com
When working with "dependsOnMethods" attribute, you should only give the "method name" and not include the class name there.

PS: Its a bad idea to establish method dependencies across classes. I dont think TestNG would even let you work in that model. When you need to span across test classes to establish dependencies, you should be using dependsOnGroups.


Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/
My Technical Scribblings @ https://rationaleemotions.com/


--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to testng-users...@googlegroups.com.
To post to this group, send email to testng...@googlegroups.com.
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages