Saturday, 16 January 2021

Top 70 interview questions on Automation Testing-Selenium-TestNG Set-06? TestNG Tricky Interview questions 2021 for SDET-QAE?

 

 

Check Selenium Interviewquestions from 1 to 10 below:


Check Selenium-SDET-UIAutomation Questions set 11 to 20:
Qus Set - 11 to 20

Check Selenium-SDET-UIAutomation Questions set 21 to 30:
 
Check Selenium-SDET-UIAutomation Questions set 31 to 40:

 Question Set 31-40  

Check Selenium-SDET-UIAutomation Questions set 41-50:

Q&A Set 41-50

 Below is the list of most important attributes for TestNG annotations, in terms of day to day work and interview preparation

  • Description:    The description for this method.

If we are writing test script to validate 200 status code for /users get method then below is the description:

@Test(description="Validate 200 status code for /users GET API")

  • Enabled:    Whether methods on this class/method are enabled.

@Test(description="B_Users:Validate 200 status code for /users GET API", enabled=false)

As mentioned above, if we mark a test case enabled=false, then this test case will be skipped while execution.

  • alwaysRun:    If set to true, this test method will always be run even if it depends on a method that failed.

Ans: @Test(description="Validate 200 status code for /users GET API",alwaysRun=true)

  • HOW to Rerun failed test cases of your automation suite using Listeners?


       Ans: Click Here For Answer with code

  • priority:    The priority for this test method. Lower priorities will be scheduled first.

Ans: @Test(description="B_Users:Validate 200 status code for /users GET API", priority=1)

  • What is the default priority in testng?

       Ans: Based on ASCII value

  • Can priority be negative or zero value?

           Yes

  • groups:    The list of groups this class/method belongs to?

    @Test(description="Verify email for User with id=2",groups= {"SomkeSuite","RegressionSuite"})
    @Test(description="Verify status code for GET method-users/2 as 200",groups="SmokeSuite")

  • Explain some of the Advanced TestNG annotations?

CLICK HERE FOR ANSWER

  • Execute test cases from class payment?//payment is class name

<suite name="API Automation Smoke Suite">
    <test name="Automation Test Cases">
        <classes>
              <class name="<nameofthepackage>.payment"/>
        </classes>
   </test>
</suite>

  • Execute multiple classes from a package using testng xml suite?


<suite name="API Automation Smoke Suite">
    <test name="Automation Test Cases">
        <classes>
              <class name="apiautomationeleven.test"/>
              <class name="apiautomationeleven.registration"/>
              <class name="apiautomationeleven.payment"/>
        </classes>
   </test>
</suite>

  • Explain testNG annotation in sequence with real time scenario?example of @After@Before in TestNG?selenium interview qus/testng

      Click Here For Answer

  • Execute all classes from a pckage using testng.xml suite?


<suite name="API Automation Smoke Suite">
    <test name="Automation Test Cases">
        <packages>
           <package name="apiAutomationeleven" />
        </packages>
   </test>
</suite>

  • How to run automation suites with groups?


<suite name="API Automation Smoke Suite">
    <test name="Automation Test Cases">
        <groups>
           <run>
             <exclude name="brokenTests"  />
             <include name="SmokeSuite"  />
           </run>
        </groups>
   </test>
</suite>

  • How to use dependsOnGroups?


@Test(description="B_Users:Validate 200 status code for /users GET API",dependsOnGroups="Auth_OAUTH")

  • How to run test automation TestNG suite with gradle from jenkins job? Jenkins Integration with Gradle and TestNG.xml suite?Run TestNG suite with Gradle?

    Ans:
    Click Here For Answer With Screenshot

  • How you can specify your group dependencies in the testng.xml file. You use the <dependencies> tag to achieve this


<suite name="API Automation Smoke Suite">
    <test name="Automation Test Cases">
        <dependencies>
          <group name="B_User" depends-on="Auth_Oauth" />
        </dependencies>
   </test>
</suite>

  • How to use @Parameters in TestNG?


@Parameters({ "first-name" })
@Test
public void testSingleString(String firstName) {
  System.out.println("Invoked testString " + firstName);
  assert "Cedric".equals(firstName);
}



Learn (API-Microservice)Testing+(CoreJava+UI)-SDET with Self Paced Videos and one LIVE Doubt Session

TRANING VIDEOS AVAILABLE with Live Doubt Session @4500/-(course-1 below,API TRaining Videos With ClassNotes and Coding Set) and 6500/- (API+UI, both course-1 & 2 below) Check Training Page for Course Content or reach out @whatsapp +91-9619094122

Entire course content can be found below:  COURSE CONTENTCheck below link for question and answers with code:

 API Testing Interview Question Set:
https://automationreinvented.blogspot.com/search/label/Rest-API

SeleniumWebdriver Automation Testing Interview Questions:

 
Kubernetes Interview Question Set
https://automationreinvented.blogspot.com/search/label/Kubernetes

 
Docker Interview Question Set
https://automationreinvented.blogspot.com/2020/02/top-18-docker-commands-for-aytomation.html

 
Linux Interview question Set
https://automationreinvented.blogspot.com/search/label/Linux

 
Automation Testing/SDET Framework Design
https://automationreinvented.blogspot.com/search/label/FrameworkDesign


Java Related Interview Question Set

https://automationreinvented.blogspot.com/search/label/Java


GIT Interview Question Set:
https://automationreinvented.blogspot.com/search/label/GIT


Coding Interview Question Set:
https://automationreinvented.blogspot.com/search/label/Coding%20Questions

3 comments:

All Time Popular Posts

Most Featured Post

Introduction to Web Testing with Playwright

  Introduction to Web Testing with Playwright 📌  Telegram Group:  https://t.me/+FTf_NPb--GQ2ODhl 📌  YouTube channel:  https://lnkd.in/gGUG...