Part 16
73 : How to set priority of @Test method? What Is Its usage?
Answer : In your software web application’s test case, you can set priority for TestNG @Test annotated methods as bellow.
@Test(priority=0)
Using priority, We can control @Test method execution manner as per our requirement. That means @Test method with priority = 0 will be executed 1st and @Test method with priority = 1 will be executed 2nd and so on. VIEW PRACTICAL EXAMPLE to know how to use It.
74 : Tell me any 5 assertions of TestNG which we can use In selenium webdriver software testing tool.
Answer : There are many different assertions available In TestNG but generally I am using bellow given assertions In my test cases.
- assertEquals VIEW EXAMPLE
- assertNotEquals VIEW EXAMPLE
- assertTrue VIEW EXAMPLE
- assertFalse VIEW EXAMPLE
- assertNull VIEW EXAMPLE
- assertNotNull VIEW EXAMPLE
75 : Can you tell me usage of TestNG Soft Assertion In selenium webdriver software testing tool?
Answer : Using TestNG soft assertion, We can continue our test execution even if assertion fails. That means on failure of soft assertion, remaining part of @Test method will be executed and assertion failure will be reported at the end of @Test method. VIEW PRACTICAL EXAMPLE.
76 : How to write regular expression In testng.xml file to search @Test methods containing “product” keyword.
Answer : Regular expression to find @Test methods containing keyword “product” Is as bellow In selenium webdriver software testing tool.
<methods>
<include name=".*product.*"/>
</methods>
VIEW EXAMPLE OF USING REGULAR EXPRESSION
77 : Which time unit we provide In time test? minutes? seconds? milliseconds? or hours? Give Example.
Answer : Time unit we provide on @Test method level or test suite level Is In milliseconds.You can VIEW FULL EXAMPLE to know how to set time out.
3 thoughts on “TestNG Interview Questions And Answers For Selenium WebDriver”
really helpful thanks
Very Useful and helpful… bang on target…
really good blog, very helpful