How to generate tests with different names in testng, java?

Posted by Ula Karzelek on Stack Overflow See other posts from Stack Overflow or by Ula Karzelek
Published on 2010-04-30T09:58:37Z Indexed on 2010/05/07 10:48 UTC
Read the original article Hit count: 250

Filed under:
|
|

I'm using testng to run selenium based tests in java. I have a bunch of repeated tests. Generally they do all the same except of test name and one parameter.

I want to automate generation of it. I was thinking about using factory. Is there a way to generate tests with different name? What would be the best approach to this?

As for now I have something like below and I want to create 10 tests like LinkOfInterestIsActiveAfterClick

@Test(dependsOnGroups="loggedin")
public class SmokeTest extends BrowserStartingStoping{

public void LinkOfInterestIsActiveAfterClick(){
        String link = "link_of_interest";
        browser.click("*",link);
        Assert.assertTrue(browser.isLinkActive(link));
    }

}
  • My xml suite is auto-generated from java code.
  • test names are crucial for logging which link is active, and which one is not.

© Stack Overflow or respective owner

Related posts about testng

Related posts about java