eBay Automation Questions
- What is the use of TestNG/JUnit?
- What is parameterized testing?
- How can u achieve parameterized testing using TestNG? With the help of 2 annotations @Parameters and @Dataprovider.
- Can you map test method names in an XML file along with class names?
Ans: Yes, we can do it please see below ex:
<classes> <class name="test.IndividualMethodsTest"> <methods> <include name="testMethod" /> </methods> </class> </classes>
- The sequence of execution of below annotations:
- What is a YAML file?
Ans: TestNG supports YAML as an alternate way of specifying your suite file. You might find the YAML file format easier to read and to maintain. YAML files are also recognized by the TestNG Eclipse plug-in.
- How will you execute only selected test methods in a particular Test class?
- How do you fail test cases in TestNG?
- Can we execute test cases parallelly in TestNg?
- How can we control the order of test method invocation?
Ans: We need to create Dependency. TestNG allows you to specify dependencies either with annotations or in XML.: You can use the attributes dependsOnMethods or dependsOnGroups, found on the @Test annotation. Alternatively, you can specify your group dependencies in the testng.xml file. You use the <dependencies> tag to achieve this:
- How can you make sure test methods which are run in a certain order doesn’t really depend on the success of others?
Ans: By adding “alwaysRun=true” in your @Test annotation.