Discussion:
[testng-dev] Order of execution when @Factory at constructor level
Sandeep Aralihalli
2015-11-19 12:20:30 UTC
Permalink
Hi,


I am facing some issues as the order of execution is not correct when there
is @Factory at constructor level and there are some tests are present..

I have provided the DataProvider(lazy fashion) as my data gets generated at
RUNTIME at my original setup

I have simplified for illustrations and attached .....



Thanks and Regards,
Sandeep
--
You received this message because you are subscribed to the Google Groups "testng-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to testng-dev+***@googlegroups.com.
To post to this group, send email to testng-***@googlegroups.com.
Visit this group at http://groups.google.com/group/testng-dev.
For more options, visit https://groups.google.com/d/optout.
Julien Herr
2015-11-20 13:45:51 UTC
Permalink
Hi,

For me, your example looks weird and testng is working as expected:
*account_list* from *data*, may or may not be initialized before the call
of the data provider. The only thing we can say is the data provider will
be called before the method which need it.

Someone already asked more or less the same question one day
ago: https://github.com/cbeust/testng/issues/883

Regards,
Julien
Post by Sandeep Aralihalli
Hi,
I am facing some issues as the order of execution is not correct when
present..
I have provided the DataProvider(lazy fashion) as my data gets generated
at RUNTIME at my original setup
I have simplified for illustrations and attached .....
Thanks and Regards,
Sandeep
--
You received this message because you are subscribed to the Google Groups "testng-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to testng-dev+***@googlegroups.com.
To post to this group, send email to testng-***@googlegroups.com.
Visit this group at http://groups.google.com/group/testng-dev.
For more options, visit https://groups.google.com/d/optout.
Sandeep Aralihalli
2015-11-23 12:06:19 UTC
Permalink
Thanks Julien for the effort into looking into the issue reported...

The issue i am getting is order of execution.


ExpectedResult
----------------------------------------------

b4Class for sun_company3
=================================================================


TEST 1 :Executing forsun_company3 IP : sun_company3 ENTRY 1




TEST 1 :Executing forsun_company3 IP : sun_company3 ENTRY 2


Test 2: sun_company3 IP : sun_company3 ENTRY 1




Test 2: sun_company3 IP : sun_company3 ENTRY 2


Closing sun_company3
=============================================================================

b4Class for sun_company4
=================================================================


TEST 1 :Executing forsun_company4 IP : sun_company4 ENTRY 1




TEST 1 :Executing forsun_company4 IP : sun_company4 ENTRY 2



Test 2: sun_company4 IP : sun_company4 ENTRY 1




Test 2: sun_company4 IP : sun_company4 ENTRY 2




Closing sun_company4
=============================================================================


But the Actual Result i am facing is :-


b4Class for sun_company3
=================================================================


TEST 1 :Executing forsun_company3 IP : sun_company3 ENTRY 1




TEST 1 :Executing forsun_company3 IP : sun_company3 ENTRY 2




b4Class for sun_company4
=================================================================


TEST 1 :Executing forsun_company4 IP : sun_company4 ENTRY 1




TEST 1 :Executing forsun_company4 IP : sun_company4 ENTRY 2




Test 2: sun_company3 IP : sun_company4 ENTRY 1




Test 2: sun_company3 IP : sun_company4 ENTRY 2




Closing sun_company3
=============================================================================


Test 2: sun_company4 IP : sun_company4 ENTRY 1




Test 2: sun_company4 IP : sun_company4 ENTRY 2




Closing sun_company4
=============================================================================
--
You received this message because you are subscribed to the Google Groups "testng-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to testng-dev+***@googlegroups.com.
To post to this group, send email to testng-***@googlegroups.com.
Visit this group at http://groups.google.com/group/testng-dev.
For more options, visit https://groups.google.com/d/optout.
Julien Herr
2015-11-23 12:56:29 UTC
Permalink
Yes, it is working as expected: the order of tests on different instances
should not have side effects.

BTW, you can try the group-by-instances parameter:
http://testng.org/doc/documentation-main.html#dependent-methods
Post by Sandeep Aralihalli
Thanks Julien for the effort into looking into the issue reported...
The issue i am getting is order of execution.
ExpectedResult
----------------------------------------------
b4Class for sun_company3
=================================================================
TEST 1 :Executing forsun_company3 IP : sun_company3 ENTRY 1
TEST 1 :Executing forsun_company3 IP : sun_company3 ENTRY 2
Test 2: sun_company3 IP : sun_company3 ENTRY 1
Test 2: sun_company3 IP : sun_company3 ENTRY 2
Closing sun_company3
=============================================================================
b4Class for sun_company4
=================================================================
TEST 1 :Executing forsun_company4 IP : sun_company4 ENTRY 1
TEST 1 :Executing forsun_company4 IP : sun_company4 ENTRY 2
Test 2: sun_company4 IP : sun_company4 ENTRY 1
Test 2: sun_company4 IP : sun_company4 ENTRY 2
Closing sun_company4
=============================================================================
But the Actual Result i am facing is :-
b4Class for sun_company3
=================================================================
TEST 1 :Executing forsun_company3 IP : sun_company3 ENTRY 1
TEST 1 :Executing forsun_company3 IP : sun_company3 ENTRY 2
b4Class for sun_company4
=================================================================
TEST 1 :Executing forsun_company4 IP : sun_company4 ENTRY 1
TEST 1 :Executing forsun_company4 IP : sun_company4 ENTRY 2
Test 2: sun_company3 IP : sun_company4 ENTRY 1
Test 2: sun_company3 IP : sun_company4 ENTRY 2
Closing sun_company3
=============================================================================
Test 2: sun_company4 IP : sun_company4 ENTRY 1
Test 2: sun_company4 IP : sun_company4 ENTRY 2
Closing sun_company4
=============================================================================
--
You received this message because you are subscribed to the Google Groups "testng-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to testng-dev+***@googlegroups.com.
To post to this group, send email to testng-***@googlegroups.com.
Visit this group at http://groups.google.com/group/testng-dev.
For more options, visit https://groups.google.com/d/optout.
Sandeep Aralihalli
2015-11-24 11:55:07 UTC
Permalink
But as per the definition, it is not working as expected...

The factory at constructor is getting fed with two values : sun_company3
and sun_company4...(from dataProvider)...

So all tests should be completed for value -: sun_company3 and then same
tests should be run with sun_company4...

So the beforeClass of sun_company 4 should only execute after the execution
of afterClass of sun_company3 which is not happening
--
You received this message because you are subscribed to the Google Groups "testng-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to testng-dev+***@googlegroups.com.
To post to this group, send email to testng-***@googlegroups.com.
Visit this group at http://groups.google.com/group/testng-dev.
For more options, visit https://groups.google.com/d/optout.
Loading...