I've browsed quite a lot of posts before posting my own without finding the answer to my subject. But i'm sure some of you must have faced the same situation, so please apologize if i just missed the right one.
We're implementing a software in distributed teams (let's call them A, B, C,...) where different topics (1, 2, 3, ...) are covered by developer. We now want to cover all the implementation with testng with the ability to:
a) run all the tests from a central place
b) run only a few tests concerning one topic in one team (e.g. B2)
We've thought about a suite-tree looking like following
suite_A suite_B ...
| | | |
suite_A1 suite_A2 ... suite_B1 suite_B2 ...
where the dependencies are created by <suite-files>-tags, so e.g.
So far so good, now comes the nut to crack:
The first step of some testing activity MUST allways be some method(s) that does some one-time initialisation (setting up the persistence layer...)
The intuitive approach of calling also a class in the root-suite with a method annotated with @BeforeSuite won't do the job, as:
a) the order of execution of the methods/suites will be from bottom to top (root-suite called finaly)
b) we can't force that the root-suite is always executed as the developer must be able to call only the suite_B2 or ideally (if possible) even some individual test-classes (still with initialization!)
I've looked at the concepts of (partial) groups and hard/soft dependencies but i don't see a clean solution neither with these neither.
Thanx in advance for any hint or link to a post that allready discusses the topic or for a proposed solution!
p.s. please apologise any ugly wording or spelling mistakes, english is only my third language... ;-)
why wont @BeforeSuite work?
a. First of all, I think the order of execution is top-down. The root suite is going to be executed first and then the suites that it includes and so on.--
b. Also, you can have all these tests extend a common base class which contains a method annotated @BeforeSuite. This method can check to see if the one-time initialization is already done or not. If it's not done, it does it there, otherwise it simply returns.
Does this help?
On Thu, Apr 28, 2011 at 12:09 AM, Jostar <[hidden email]> wrote:
You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.
a. i'm more than sure (cause i tested it) that suites are executed bottom-top.
See also this post about a discussion going into that:
b. thought about a solution of that type (having the initialisation in the first TestCase actually runing) but the combination with @BeforeSuite is better because the exeucution time of the first TestCase will then be "clean". Anyway, i'll have to do it with a static class to be able to remember that the initialisation was allready done when i enter the second TestCase and to tell you the truth i don't feel confortable about using some static classes there. Not to mention the problems i may encounter when starting to run the tests in parallel... :-/
|Free forum by Nabble||Edit this page|