Re: [Dev] @BeforeTest and @AfterTest runs for each test instantiated with @Factory in TAF 4.3.1

2015-03-17 Thread Malithi Edirisinghe
Hi All,

Thanks for the replies.

@Saneth,
I will try with your suggestion.

Thanks,
Malithi.


On Tue, Mar 17, 2015 at 8:42 AM, Saneth Dharmakeerthi sane...@wso2.com
wrote:

 Hi Malithi  Krishantha,


 I created a similar scenario and  analyse the method call order and
 noticed that @Factory is get called first. @BeforeTest and @AfterTest
 that are in separate class execute only once. But @BeforeTest and
 @AfterTest in the same  class with  @Factory ,@BeforeClass..,@Test are
  get execute  multiple times (equal to the how much instance that that has
 been created in the @Factory).

 Malithi,

 Until we find the exact reason for this behaviour you can  move
 your @BeforeTest and @AfterTest to a different class. Also share your Test
 Class with us.



 Thanks and Best Regards,

 Saneth Dharmakeerthi
 Senior Software Engineer
 WSO2, Inc.
 Mobile: +94772325511

 On Mon, Mar 16, 2015 at 11:08 PM, Krishantha Samaraweera 
 krishan...@wso2.com wrote:

 Hi Malithi,

 On Mon, Mar 16, 2015 at 6:44 PM, Malithi Edirisinghe malit...@wso2.com
 wrote:

 Hi All,

 I'm using Factories in TestNG to instantiate tests dynamically for
 different parameter sets. And I have configured the test class inside a
 test block in the testng.xml as below.

 test name=Test - IS - OpenID preserve-order=true parallel=false
 classes
 class 
 name=org.wso2.identity.integration.test.openid.OpenIDSSOTestCase /
 /classes
 /test

 When running this test on the TAF 4.3.1 I found that the methods
 annotated with 'BeforeTest' and 'AfterTest' runs for each test instance
 instantiated with the factory.
 But when running the same test on an earlier version of TAF, methods
 annotated with 'BeforeTest' and 'AfterTest' are executed only once, which
 is the expected behavior [1].

 I found that TAF 4.3.1 is using TestNG 6.1.1 where as earlier versions
 of TAF use TestNG 6.8. Seems this issue is with TestNG 6.1.1 version. This
 is also reported in [2].

 Is there a specific reason to downgrade the TestNG version in TAF 4.3.1 ?


 Nope we haven't downgraded testNG in TAF 4.3.1. in your old tests
 modules,  6.8 version might be explicitly specified. We only recommend to
 go with testNG 6.1.1 as 6.8 is not much stable.

 Some other products like AS also use @Factory with @BeforeTest and
 @AfterTest annotations with 6.1.1. Need to figure out what is really
 happening here.

 Thanks,
 Krishantha.


 In that case, what would be the way to achieve the expected behavior ?

 [1] http://testng.org/doc/documentation-main.html#annotations
 [2] http://osdir.com/ml/java-testng-user/2011-07/msg00166.html

 Thanks,
 Malithi.
 --

 *Malithi Edirisinghe*
 Senior Software Engineer
 WSO2 Inc.

 Mobile : +94 (0) 718176807
 malit...@wso2.com




 --
 Krishantha Samaraweera
 Senior Technical Lead - Test Automation
 Mobile: +94 77 7759918
 WSO2, Inc.; http://wso2.com/
 lean . enterprise . middlewear.

 ___
 Dev mailing list
 Dev@wso2.org
 http://wso2.org/cgi-bin/mailman/listinfo/dev





-- 

*Malithi Edirisinghe*
Senior Software Engineer
WSO2 Inc.

Mobile : +94 (0) 718176807
malit...@wso2.com
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] @BeforeTest and @AfterTest runs for each test instantiated with @Factory in TAF 4.3.1

2015-03-16 Thread Saneth Dharmakeerthi
Hi Malithi  Krishantha,


I created a similar scenario and  analyse the method call order and noticed
that @Factory is get called first. @BeforeTest and @AfterTest that are in
separate class execute only once. But @BeforeTest and @AfterTest in the
same  class with  @Factory ,@BeforeClass..,@Test are  get execute  multiple
times (equal to the how much instance that that has been created in the
@Factory).

Malithi,

Until we find the exact reason for this behaviour you can  move
your @BeforeTest and @AfterTest to a different class. Also share your Test
Class with us.



Thanks and Best Regards,

Saneth Dharmakeerthi
Senior Software Engineer
WSO2, Inc.
Mobile: +94772325511

On Mon, Mar 16, 2015 at 11:08 PM, Krishantha Samaraweera 
krishan...@wso2.com wrote:

 Hi Malithi,

 On Mon, Mar 16, 2015 at 6:44 PM, Malithi Edirisinghe malit...@wso2.com
 wrote:

 Hi All,

 I'm using Factories in TestNG to instantiate tests dynamically for
 different parameter sets. And I have configured the test class inside a
 test block in the testng.xml as below.

 test name=Test - IS - OpenID preserve-order=true parallel=false
 classes
 class 
 name=org.wso2.identity.integration.test.openid.OpenIDSSOTestCase /
 /classes
 /test

 When running this test on the TAF 4.3.1 I found that the methods
 annotated with 'BeforeTest' and 'AfterTest' runs for each test instance
 instantiated with the factory.
 But when running the same test on an earlier version of TAF, methods
 annotated with 'BeforeTest' and 'AfterTest' are executed only once, which
 is the expected behavior [1].

 I found that TAF 4.3.1 is using TestNG 6.1.1 where as earlier versions of
 TAF use TestNG 6.8. Seems this issue is with TestNG 6.1.1 version. This is
 also reported in [2].

 Is there a specific reason to downgrade the TestNG version in TAF 4.3.1 ?


 Nope we haven't downgraded testNG in TAF 4.3.1. in your old tests modules,
  6.8 version might be explicitly specified. We only recommend to go with
 testNG 6.1.1 as 6.8 is not much stable.

 Some other products like AS also use @Factory with @BeforeTest and
 @AfterTest annotations with 6.1.1. Need to figure out what is really
 happening here.

 Thanks,
 Krishantha.


 In that case, what would be the way to achieve the expected behavior ?

 [1] http://testng.org/doc/documentation-main.html#annotations
 [2] http://osdir.com/ml/java-testng-user/2011-07/msg00166.html

 Thanks,
 Malithi.
 --

 *Malithi Edirisinghe*
 Senior Software Engineer
 WSO2 Inc.

 Mobile : +94 (0) 718176807
 malit...@wso2.com




 --
 Krishantha Samaraweera
 Senior Technical Lead - Test Automation
 Mobile: +94 77 7759918
 WSO2, Inc.; http://wso2.com/
 lean . enterprise . middlewear.

 ___
 Dev mailing list
 Dev@wso2.org
 http://wso2.org/cgi-bin/mailman/listinfo/dev


___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


[Dev] @BeforeTest and @AfterTest runs for each test instantiated with @Factory in TAF 4.3.1

2015-03-16 Thread Malithi Edirisinghe
Hi All,

I'm using Factories in TestNG to instantiate tests dynamically for
different parameter sets. And I have configured the test class inside a
test block in the testng.xml as below.

test name=Test - IS - OpenID preserve-order=true parallel=false
classes
class 
name=org.wso2.identity.integration.test.openid.OpenIDSSOTestCase
/
/classes
/test

When running this test on the TAF 4.3.1 I found that the methods annotated
with 'BeforeTest' and 'AfterTest' runs for each test instance instantiated
with the factory.
But when running the same test on an earlier version of TAF, methods
annotated with 'BeforeTest' and 'AfterTest' are executed only once, which
is the expected behavior [1].

I found that TAF 4.3.1 is using TestNG 6.1.1 where as earlier versions of
TAF use TestNG 6.8. Seems this issue is with TestNG 6.1.1 version. This is
also reported in [2].

Is there a specific reason to downgrade the TestNG version in TAF 4.3.1 ?
In that case, what would be the way to achieve the expected behavior ?

[1] http://testng.org/doc/documentation-main.html#annotations
[2] http://osdir.com/ml/java-testng-user/2011-07/msg00166.html

Thanks,
Malithi.
-- 

*Malithi Edirisinghe*
Senior Software Engineer
WSO2 Inc.

Mobile : +94 (0) 718176807
malit...@wso2.com
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] @BeforeTest and @AfterTest runs for each test instantiated with @Factory in TAF 4.3.1

2015-03-16 Thread Saneth Dharmakeerthi
[Adding: Krishantha]

Hi Malithi,

Have you written  the 'BeforeTest' and 'AfterTest'  inside the same test
class with  'BeforeClasst' ,'AfterClasst and other @Test test methods?
If so put 'BeforeTest' and 'AfterTest' in a different class and  add that
class to testng.xml  with OpenIDSSOTestCase.






Thanks and Best Regards,

Saneth Dharmakeerthi
Senior Software Engineer
WSO2, Inc.
Mobile: +94772325511

On Mon, Mar 16, 2015 at 6:44 PM, Malithi Edirisinghe malit...@wso2.com
wrote:

 Hi All,

 I'm using Factories in TestNG to instantiate tests dynamically for
 different parameter sets. And I have configured the test class inside a
 test block in the testng.xml as below.

 test name=Test - IS - OpenID preserve-order=true parallel=false
 classes
 class 
 name=org.wso2.identity.integration.test.openid.OpenIDSSOTestCase /
 /classes
 /test

 When running this test on the TAF 4.3.1 I found that the methods annotated
 with 'BeforeTest' and 'AfterTest' runs for each test instance instantiated
 with the factory.
 But when running the same test on an earlier version of TAF, methods
 annotated with 'BeforeTest' and 'AfterTest' are executed only once, which
 is the expected behavior [1].

 I found that TAF 4.3.1 is using TestNG 6.1.1 where as earlier versions of
 TAF use TestNG 6.8. Seems this issue is with TestNG 6.1.1 version. This is
 also reported in [2].

 Is there a specific reason to downgrade the TestNG version in TAF 4.3.1 ?
 In that case, what would be the way to achieve the expected behavior ?

 [1] http://testng.org/doc/documentation-main.html#annotations
 [2] http://osdir.com/ml/java-testng-user/2011-07/msg00166.html

 Thanks,
 Malithi.
 --

 *Malithi Edirisinghe*
 Senior Software Engineer
 WSO2 Inc.

 Mobile : +94 (0) 718176807
 malit...@wso2.com

 ___
 Dev mailing list
 Dev@wso2.org
 http://wso2.org/cgi-bin/mailman/listinfo/dev


___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] @BeforeTest and @AfterTest runs for each test instantiated with @Factory in TAF 4.3.1

2015-03-16 Thread Malithi Edirisinghe
Yes, 'BeforeTest' and 'AfterTest' resides in the same class. As I have
mentioned above I think the problem is with TestNG 6.1.1 version.

On Mon, Mar 16, 2015 at 7:57 PM, Saneth Dharmakeerthi sane...@wso2.com
wrote:

 [Adding: Krishantha]

 Hi Malithi,

 Have you written  the 'BeforeTest' and 'AfterTest'  inside the same test
 class with  'BeforeClasst' ,'AfterClasst and other @Test test methods?
 If so put 'BeforeTest' and 'AfterTest' in a different class and  add that
 class to testng.xml  with OpenIDSSOTestCase.






 Thanks and Best Regards,

 Saneth Dharmakeerthi
 Senior Software Engineer
 WSO2, Inc.
 Mobile: +94772325511

 On Mon, Mar 16, 2015 at 6:44 PM, Malithi Edirisinghe malit...@wso2.com
 wrote:

 Hi All,

 I'm using Factories in TestNG to instantiate tests dynamically for
 different parameter sets. And I have configured the test class inside a
 test block in the testng.xml as below.

 test name=Test - IS - OpenID preserve-order=true parallel=false
 classes
 class 
 name=org.wso2.identity.integration.test.openid.OpenIDSSOTestCase /
 /classes
 /test

 When running this test on the TAF 4.3.1 I found that the methods
 annotated with 'BeforeTest' and 'AfterTest' runs for each test instance
 instantiated with the factory.
 But when running the same test on an earlier version of TAF, methods
 annotated with 'BeforeTest' and 'AfterTest' are executed only once, which
 is the expected behavior [1].

 I found that TAF 4.3.1 is using TestNG 6.1.1 where as earlier versions of
 TAF use TestNG 6.8. Seems this issue is with TestNG 6.1.1 version. This is
 also reported in [2].

 Is there a specific reason to downgrade the TestNG version in TAF 4.3.1 ?
 In that case, what would be the way to achieve the expected behavior ?

 [1] http://testng.org/doc/documentation-main.html#annotations
 [2] http://osdir.com/ml/java-testng-user/2011-07/msg00166.html

 Thanks,
 Malithi.
 --

 *Malithi Edirisinghe*
 Senior Software Engineer
 WSO2 Inc.

 Mobile : +94 (0) 718176807
 malit...@wso2.com

 ___
 Dev mailing list
 Dev@wso2.org
 http://wso2.org/cgi-bin/mailman/listinfo/dev





-- 

*Malithi Edirisinghe*
Senior Software Engineer
WSO2 Inc.

Mobile : +94 (0) 718176807
malit...@wso2.com
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] @BeforeTest and @AfterTest runs for each test instantiated with @Factory in TAF 4.3.1

2015-03-16 Thread Malithi Edirisinghe
Hi Irham,


On Mon, Mar 16, 2015 at 10:18 PM, Irham Iqbal iq...@wso2.com wrote:

 Hi Malithi,

 Since you have only one class with all the test cases you can use
 *@BeforeClass,@AfterClass* this will run before and after all the test
 methods inside the class.


It's just not a one class. It's a factory as I have mentioned above. This
test worked perfectly as expected with TAF 4.2.8



 TestNG version 6.8.x we have noticed some issues(i.e dependsOnMethods
 doesn't work)


Is this the reason to downgrade TestNG version in TAF 4.3.1


 Thanks,
 Iqbal

 On Mon, Mar 16, 2015 at 9:46 PM, Malithi Edirisinghe malit...@wso2.com
 wrote:

 Yes, 'BeforeTest' and 'AfterTest' resides in the same class. As I have
 mentioned above I think the problem is with TestNG 6.1.1 version.

 On Mon, Mar 16, 2015 at 7:57 PM, Saneth Dharmakeerthi sane...@wso2.com
 wrote:

 [Adding: Krishantha]

 Hi Malithi,

 Have you written  the 'BeforeTest' and 'AfterTest'  inside the same
 test class with  'BeforeClasst' ,'AfterClasst and other @Test test
 methods?
 If so put 'BeforeTest' and 'AfterTest' in a different class and  add
 that class to testng.xml  with OpenIDSSOTestCase.






 Thanks and Best Regards,

 Saneth Dharmakeerthi
 Senior Software Engineer
 WSO2, Inc.
 Mobile: +94772325511

 On Mon, Mar 16, 2015 at 6:44 PM, Malithi Edirisinghe malit...@wso2.com
 wrote:

 Hi All,

 I'm using Factories in TestNG to instantiate tests dynamically for
 different parameter sets. And I have configured the test class inside a
 test block in the testng.xml as below.

 test name=Test - IS - OpenID preserve-order=true parallel=false
 classes
 class 
 name=org.wso2.identity.integration.test.openid.OpenIDSSOTestCase /
 /classes
 /test

 When running this test on the TAF 4.3.1 I found that the methods
 annotated with 'BeforeTest' and 'AfterTest' runs for each test instance
 instantiated with the factory.
 But when running the same test on an earlier version of TAF, methods
 annotated with 'BeforeTest' and 'AfterTest' are executed only once, which
 is the expected behavior [1].

 I found that TAF 4.3.1 is using TestNG 6.1.1 where as earlier versions
 of TAF use TestNG 6.8. Seems this issue is with TestNG 6.1.1 version. This
 is also reported in [2].

 Is there a specific reason to downgrade the TestNG version in TAF 4.3.1
 ?
 In that case, what would be the way to achieve the expected behavior ?

 [1] http://testng.org/doc/documentation-main.html#annotations
 [2] http://osdir.com/ml/java-testng-user/2011-07/msg00166.html

 Thanks,
 Malithi.
 --

 *Malithi Edirisinghe*
 Senior Software Engineer
 WSO2 Inc.

 Mobile : +94 (0) 718176807
 malit...@wso2.com

 ___
 Dev mailing list
 Dev@wso2.org
 http://wso2.org/cgi-bin/mailman/listinfo/dev





 --

 *Malithi Edirisinghe*
 Senior Software Engineer
 WSO2 Inc.

 Mobile : +94 (0) 718176807
 malit...@wso2.com

 ___
 Dev mailing list
 Dev@wso2.org
 http://wso2.org/cgi-bin/mailman/listinfo/dev




 --
 Irham Iqbal
 Software Engineer - Test Automation
  WSO2, Inc.: http://wso2.com
 lean. enterprise. middleware
 phone: +94 777888452




-- 

*Malithi Edirisinghe*
Senior Software Engineer
WSO2 Inc.

Mobile : +94 (0) 718176807
malit...@wso2.com
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] @BeforeTest and @AfterTest runs for each test instantiated with @Factory in TAF 4.3.1

2015-03-16 Thread Irham Iqbal
Hi Malithi,

Since you have only one class with all the test cases you can use
*@BeforeClass,@AfterClass* this will run before and after all the test
methods inside the class. TestNG version 6.8.x we have noticed some
issues(i.e dependsOnMethods doesn't work)

Thanks,
Iqbal

On Mon, Mar 16, 2015 at 9:46 PM, Malithi Edirisinghe malit...@wso2.com
wrote:

 Yes, 'BeforeTest' and 'AfterTest' resides in the same class. As I have
 mentioned above I think the problem is with TestNG 6.1.1 version.

 On Mon, Mar 16, 2015 at 7:57 PM, Saneth Dharmakeerthi sane...@wso2.com
 wrote:

 [Adding: Krishantha]

 Hi Malithi,

 Have you written  the 'BeforeTest' and 'AfterTest'  inside the same test
 class with  'BeforeClasst' ,'AfterClasst and other @Test test methods?
 If so put 'BeforeTest' and 'AfterTest' in a different class and  add
 that class to testng.xml  with OpenIDSSOTestCase.






 Thanks and Best Regards,

 Saneth Dharmakeerthi
 Senior Software Engineer
 WSO2, Inc.
 Mobile: +94772325511

 On Mon, Mar 16, 2015 at 6:44 PM, Malithi Edirisinghe malit...@wso2.com
 wrote:

 Hi All,

 I'm using Factories in TestNG to instantiate tests dynamically for
 different parameter sets. And I have configured the test class inside a
 test block in the testng.xml as below.

 test name=Test - IS - OpenID preserve-order=true parallel=false
 classes
 class 
 name=org.wso2.identity.integration.test.openid.OpenIDSSOTestCase /
 /classes
 /test

 When running this test on the TAF 4.3.1 I found that the methods
 annotated with 'BeforeTest' and 'AfterTest' runs for each test instance
 instantiated with the factory.
 But when running the same test on an earlier version of TAF, methods
 annotated with 'BeforeTest' and 'AfterTest' are executed only once, which
 is the expected behavior [1].

 I found that TAF 4.3.1 is using TestNG 6.1.1 where as earlier versions
 of TAF use TestNG 6.8. Seems this issue is with TestNG 6.1.1 version. This
 is also reported in [2].

 Is there a specific reason to downgrade the TestNG version in TAF 4.3.1 ?
 In that case, what would be the way to achieve the expected behavior ?

 [1] http://testng.org/doc/documentation-main.html#annotations
 [2] http://osdir.com/ml/java-testng-user/2011-07/msg00166.html

 Thanks,
 Malithi.
 --

 *Malithi Edirisinghe*
 Senior Software Engineer
 WSO2 Inc.

 Mobile : +94 (0) 718176807
 malit...@wso2.com

 ___
 Dev mailing list
 Dev@wso2.org
 http://wso2.org/cgi-bin/mailman/listinfo/dev





 --

 *Malithi Edirisinghe*
 Senior Software Engineer
 WSO2 Inc.

 Mobile : +94 (0) 718176807
 malit...@wso2.com

 ___
 Dev mailing list
 Dev@wso2.org
 http://wso2.org/cgi-bin/mailman/listinfo/dev




-- 
Irham Iqbal
Software Engineer - Test Automation
 WSO2, Inc.: http://wso2.com
lean. enterprise. middleware
phone: +94 777888452
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] @BeforeTest and @AfterTest runs for each test instantiated with @Factory in TAF 4.3.1

2015-03-16 Thread Krishantha Samaraweera
Hi Malithi,

On Mon, Mar 16, 2015 at 6:44 PM, Malithi Edirisinghe malit...@wso2.com
wrote:

 Hi All,

 I'm using Factories in TestNG to instantiate tests dynamically for
 different parameter sets. And I have configured the test class inside a
 test block in the testng.xml as below.

 test name=Test - IS - OpenID preserve-order=true parallel=false
 classes
 class 
 name=org.wso2.identity.integration.test.openid.OpenIDSSOTestCase /
 /classes
 /test

 When running this test on the TAF 4.3.1 I found that the methods annotated
 with 'BeforeTest' and 'AfterTest' runs for each test instance instantiated
 with the factory.
 But when running the same test on an earlier version of TAF, methods
 annotated with 'BeforeTest' and 'AfterTest' are executed only once, which
 is the expected behavior [1].

 I found that TAF 4.3.1 is using TestNG 6.1.1 where as earlier versions of
 TAF use TestNG 6.8. Seems this issue is with TestNG 6.1.1 version. This is
 also reported in [2].

 Is there a specific reason to downgrade the TestNG version in TAF 4.3.1 ?


Nope we haven't downgraded testNG in TAF 4.3.1. in your old tests modules,
 6.8 version might be explicitly specified. We only recommend to go with
testNG 6.1.1 as 6.8 is not much stable.

Some other products like AS also use @Factory with @BeforeTest and
@AfterTest annotations with 6.1.1. Need to figure out what is really
happening here.

Thanks,
Krishantha.


 In that case, what would be the way to achieve the expected behavior ?

 [1] http://testng.org/doc/documentation-main.html#annotations
 [2] http://osdir.com/ml/java-testng-user/2011-07/msg00166.html

 Thanks,
 Malithi.
 --

 *Malithi Edirisinghe*
 Senior Software Engineer
 WSO2 Inc.

 Mobile : +94 (0) 718176807
 malit...@wso2.com




-- 
Krishantha Samaraweera
Senior Technical Lead - Test Automation
Mobile: +94 77 7759918
WSO2, Inc.; http://wso2.com/
lean . enterprise . middlewear.
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev