Styrow.dev
Question 11 of 14
TestNG Topic: General medium

What is syntax to set test method dependency for multiple test methods?

Question

What is syntax to set test method dependency for multiple test methods?

Answer

We can set test method’s dependency on multiple test methods as bellow.

@Test(dependsOnMethods={""Login"",""checkMail""}) public void Logout(){ System.out.println(""Logout Test.""); } We set dependency on @Test methods to skip its execution if the depending on method fails.