Home > Software engineering >  How to generate Allure Report when unique URL browsed and single TestNG Test method?
How to generate Allure Report when unique URL browsed and single TestNG Test method?

Time:01-27

I am using the TestNG framework with Java and Reporting tool is Allure

There are 500 unique links and I am iterating these links (Reading these links from external file) one by one under a single TestNG Test Method.@Test Each link has a similar feature and additional methods. When Allure Report has been generated its shows the Single Test method. this is correct. But my requirement is to generate a report based on the Links

How to achieve?

CodePudding user response:

Allure Report reflects TestNG results.

If you have a single test, it'll generate the report with a single test.

Try with @DataProvider, this will run 500 tests with different args.

public class SomeTest {

    @Test(dataProvider="provideUrls")
    public void browseUrlTest(String testUrl) {
        // navigate testUrl...
    }

    @DataProvider
    public Object[][] provideUrls() {
        // read the file or find the other way to produce Object [][]
        return new Object [][] { 
            {"https://some-url-1..."},
            {"https://some-url-2..."},
            // 497 more
            {"https://some-url-500..."}
        };
    }

}

  •  Tags:  
  • Related