Pala Bhaskar
Pala Bhaskar

Reputation: 351

TestNg all Tests are skipping

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; 
}

Upvotes: 0

Views: 223

Answers (1)

mfulton26
mfulton26

Reputation: 31234

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.

Upvotes: 1

Related Questions