Saturday, January 30, 2021

TestNG Interview Question and Answers Set-1


 

Can we give negative priority in TestNG?

Yes, 

1.     We can assign negative priorities to a method.

2.     With a method with no priority, the priority is set to 0 by default.

Observe that the AccountTest method ran before CloseBrowser even without having any priority because both sets to priority = 0, and hence, they run alphabetically. 

 

I have 4 test cases and not defined priority. in that case which test case execute first?

It will execute accourding alphabetical order 


Can we give the same priority in TestNG?  

 - Yes,if two or more methods have the same priorities in TestNG, then their running test sequence is alphabetic. Since “A” comes before “C,” the method AccountTest ran first.

 


No comments:

Post a Comment

How to install Java on EC2

***************************************** How to install Java on EC2 ***************************************** To be continued, In this post...

All Time Popular Post