0

when I execute the my Testng code always the tests are Skipped. I got the below error
FAILED CONFIGURATION: @BeforeTest beforeTest

Below my code Snippet

@Test(dataProvider = "bhaskar") 
public void f(String xpath,String values,String action,String browser) { 
    if(browser.contentEquals("common")) { 
        switch(action) { 
            case "openurl" : openurl(values); break; 
            case "verifytitle": verifytitle(values); break; 
            case "click": click(xpath); break; 
            default: System.out.println("keyword not found");
        } 
    }
} 

//-------------------------------------

public void openurl(String values) { 
    driver.get(values); 
}

public void verifytitle(String values) { 
    String title=driver.getTitle(); 
    Assert.assertEquals(title, values); 
} 

public void click(String xpath){ 
    driver.findElement(By.xpath(xpath)).click(); 
    System.out.println("clicked"); 
} 

@DataProvider(name="bhaskar") 
public String[] dp() { 
    String[] a=new String[] {"","w3schools.com/","openurl","common" }; 
    return a; 
}
Rao
  • 20,781
  • 11
  • 57
  • 77
Pala Bhaskar
  • 311
  • 1
  • 2
  • 9

1 Answers1

1

TestNG, for some reason, does not always print stack traces for unhandled exceptions from configuration methods (e.g. @BeforeTest). Try wrapping your code from your configuration methods in a try-catch and print the stack trace yourself or try debugging and/or add logging to your configuration methods.

mfulton26
  • 29,956
  • 6
  • 64
  • 88
  • now the test is running, but all the tests are failed. i got the below exception **java.lang.NoClassDefFoundError:** – Pala Bhaskar May 26 '16 at 13:23
  • @PalaBhaskar That's good, you are now one step closer to finding the root cause. I recommend POSTing a new question including details on your configuration method if you do not know why you are getting the exception. – mfulton26 May 26 '16 at 13:26