TestNG.xml suite to include all packages all files

前端 未结 5 1456
有刺的猬
有刺的猬 2021-01-07 21:47

Just about to implement a test framework with Maven+TestNG+Selenium.

How do you declare a suite.xml that tells TestNG to run ALL tests? I\'ve tried all thes

5条回答
  •  北恋
    北恋 (楼主)
    2021-01-07 22:25

    AFAIK testng doesn't have an option of regex like you are looking for.

    But, I think you can get what you want in two ways :

    1. If you are working on Eclipse with the Testng plugin. You can just select your test folder which has all the packages defined. With maven it would mostly be your src/test/java folder, right click and say run as testng. What this would do is it would create a temporary customsuite.xml which would have all your classes listed. You can save the xml as your default xml.

    2. The surefire plugin with maven has an option of specifying includes and then a pattern. You can try setting it to */.java which I think would pickup all testcases (not tried though). You can invoke your tests as mvn test then.

提交回复
热议问题