Running same tests against a large number of websites

前端 未结 1 793
借酒劲吻你
借酒劲吻你 2021-01-16 05:46

I have a need to run the same tests against over 70 websites which are all functionally the same but have different skins. They are all accessed through different URLs howev

相关标签:
1条回答
  • 2021-01-16 06:34

    You can use the @Factory annotation on the constructor for test class EndToEndTest and give it a dataprovider.

    private String url;
    
    @Factory(dataProvider = "urls", dataProviderClass = URLProvider.class)
    public EndToEndTest(String url) {
      this.url = url;
    }
    

    You need to provide the implementation of the URL data provider class to access the excel or whatever file you want and return an Object[][].

    Need to modify the constructors of HomePage and SeleniumBase to pass in the url which you are calling from your @BeforeClass method.

    This should create a separate instance for this test class for every url string and call the @Test methods.

    If you need to pass in more data than a string URL you can use an object instead. As I can see your passing 4 parameters in your testng.xml for a method.

    Parallelism should be pretty simple, guessing you would want to run all the @Test methods for a given url in a single thread. The parallel option would be "classes".

    0 讨论(0)
提交回复
热议问题