The function context.getAllTestMethods().length is returning 2, is expected to return 1, but is returning 2. | Selenium Forum
P
Pravin V. Kumbhare Posted on 18/08/2020

I want to get all the groups from my @Test annotation.

I'm using the function context.getAllTestMethods(), where "context" is the object reference of ITestContext interface, in BeforeMethod annotation.

On executing the command context.getAllTestMethods().length, in @BeforeMethod, I observe the value I get is 2. I expected this as 1.

Attached herewith is my code.

Please help.

 

Thank you!


A
Ashish Thakur Replied on 19/08/2020

Print the names of the methods and you will get the answer :)