TestNG With Selenium WebDriver Interview Questions And Answers

Part 15

68 : What Is the occupation of testng.xml file?

Answer : In selenium WebDriver software testing tool, We are using testng.xml file to configure our whole examine suite In unmarried file. Few of the tasks which nosotros tin specify In testng.xml file are equally bellow.

  • We tin define software testing examine suite using fix of examine cases to run them from unmarried place.
  • Can Include or exclude examine methods from software spider web application's examine execution.
  • Can specify a grouping to Include or exclude.
  • Can top parameter to piece of work In examine illustration of software spider web application.
  • Can specify grouping dependencies.
  • Can configure parallel examine execution for software spider web application.
  • Can define listeners.
69 : How to top parameter alongside testng.xml file to piece of work It In examine case?

Answer : We tin define parameter In testng.xml file using syntax similar bellow.
<parameter name="browser" value="FFX" />

Here, advert attribute defines parameter advert in addition to value defines value of that parameter. Then nosotros tin piece of work that parameter In selenium webdriver software automation examine illustration using bellow given syntax.
@Parameters ({"browser"})

VIEW FULL EXAMPLE on how to define in addition to piece of work parameter from testng.xml file.

70 : I accept a examine illustration alongside two @Test methods. I wants to exclude ane @Test method from execution. Can I produce It? How?

Answer : Yes you lot demand to specify @Test method exclusion In testng.xml file equally bellow.
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" > <suite name="Test Exclusion Suite">   <test name="Exclusion Test" >     <classes>       <class name="Your Test Class Name">        <methods>        <exclude name="Your Test Method Name To Exclude"/>       </methods>       </class>           </classes>   </test> </suite>

You demand to provide @Test method advert In exclude tag to exclude It from execution.

You tin VIEW DETAILED EXAMPLE on how to exclude specific @Test method from execution.


71 : Tell me syntax to skip @Test method from execution.

Answer : You tin piece of work bellow given syntax Inside @Test method to skip It from examine execution.
throw novel SkipException("Test Check_Checkbox Is Skipped");

It volition throw skip exception and @Test method volition live on sipped Immediately from execution. You tin VIEW FULL EXAMPLE on how to skip @Test method from execution.

72 : Arrange bellow laissez passer testng.xml tags from parent to child.

<test>
<suite>
<class>
</methods>
</classes>

Answer : Parent to kid organization for to a higher house testng tags Is equally bellow.

<suite>
<test>
</classes>
<class>
</methods>
More interesting articles here :Generation Enggelmundus Internet Marketing Tool here :Zeageat IM http://www.software-testing-tutorials-automation.com/
Post a Comment (0)
Previous Post Next Post