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 <[email protected]>
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 <[email protected]>
> 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 <[email protected]>
>> 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
>>> [email protected]
>>>
>>> _______________________________________________
>>> Dev mailing list
>>> [email protected]
>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>
>>>
>>
>
>
> --
>
> *Malithi Edirisinghe*
> Senior Software Engineer
> WSO2 Inc.
>
> Mobile : +94 (0) 718176807
> [email protected]
>
> _______________________________________________
> Dev mailing list
> [email protected]
> 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
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to