cbeust/testng — Issue #162: Running multiple instances using @Factory is broken
Author: mduarte
Created: 2012-01-20 19:12:37+00:00
State: open

@Factory is seriously broken from what I could see in a quick test I put together.
The test class (TestExample) has 2 @Test methods and the factory creates 2 instances of the TestExample. This is the output of running the class with the factory:

```
(2) - Before Test
(1) -- Before Class
(1) --- Before Method
(1) #### TestMethod1
(1) --- After Method
(2) -- Before Class
(2) --- Before Method
(2) #### TestMethod1
(2) --- After Method
(1) --- Before Method
(1) #### TestMethod2
(1) --- After Method
(1) -- After Class
(2) --- Before Method
(2) #### TestMethod2
(2) --- After Method
(2) -- After Class
(2) - After Test
```
The number before the text indicates the TestExample instance. Instance (1) and (2).
It is very clear why the order of execution is completely wrong and weird. I ran it several times and the order is always the same.

Using TestNG 6.3.1.