user3731315
user3731315

Reputation: 23

How to generate Allure Report when unique URL browsed and single TestNG Test method?

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?

Upvotes: 0

Views: 1078

Answers (1)

Max Daroshchanka
Max Daroshchanka

Reputation: 2968

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

}

Upvotes: 1

Related Questions