jeudi 23 juin 2016

How to make BeforeSuite method run before a separately run test

If I have a suite xml file and run it, the methods declared as BeforeSuite really run before all tests.

But if I run only ONE test class separately, BeforeSuite methods written in other classes do not run. The fact, that all these tests classes belong to the same suite and that suite has its BeforeSuite methods, is ignored.

I found it not only confounding, but also inconvenient. For while coding, I am running test classes mostly separately. But I still need some base operations to be done and while I can't use BeforeSuite, I have to add them as BeforeClass. To every class! And BeforeSuite becomes useless.

Is there some option allowing BeforeSuite method to run before separately run test classes?

I have read Does TestNG guarantee @BeforeSuite methods are executed before @BeforeTest methods? already, but my question is talking about TestNG problem only, not about Selenium. And that other question talks about running the whole suite.

Aucun commentaire:

Enregistrer un commentaire