testNG @Test attributes

TestNG framework provides some more features with the @Test to customize execution of test methods

To know basics about the @Test, see the testng annotation.

Attributes are:

description: The description for this method.
groups: The list of groups this class/method belongs to.

Refer description and grouping testcases

priority: The priority for this test method. Lower priorities will be scheduled first.

Refer Prioritize test cases

enabled: Whether methods on this class/method are enabled.

Refer @Test method enabled property

dependsOnMethods: The list of methods this method depends on.
Same, dependsOnGroups: The list of groups this method depends on.

Refer dependsOnMethods

alwaysRun: If set to true, this test method will always be run even if it depends on a method that failed.

Refer alwaysRun

invocationCount:The number of times a method should be invoked.
threadPoolSize:The size of the thread pool for a method.
timeOut: this works with threadPoolSize , timeOut says how much time a particular thread holds, after the time over, thread will be release and test will not be executed

Refer demo

Content posted is based on learning or working experience,
Share the post with others if find useful,
Any queries?, leave comments or discuss on our facebook:qavalidation.com, Thanks!

Leave a Reply

Your email address will not be published. Required fields are marked *