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