TestNG Tutorial: What is, Annotations & Framework in Selenium (medium)
30 Questions
1 Views

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to lesson

Podcast

Play an AI-generated podcast conversation about this lesson

Questions and Answers

TestNG is an automation testing framework inspired by which framework?

  • Cucumber
  • TestNG
  • JUnit (correct)
  • Selenium
  • What does NG stand for in TestNG?

  • Not Given
  • No Generation
  • New Generation
  • Next Generation (correct)
  • What is one advantage of using TestNG over JUnit?

  • TestNG is easier to use
  • TestNG is faster
  • TestNG provides better test reporting (correct)
  • TestNG has more test cases
  • What can you do with TestNG in Selenium if you only want to run failed test cases?

    <p>Use the testng-failed.xml file</p> Signup and view all the answers

    How many test cases can you execute separately using TestNG?

    <p>Only failed test cases</p> Signup and view all the answers

    What does TestNG allow you to easily generate?

    <p>Test reports</p> Signup and view all the answers

    Which annotation is executed after all test cases in the TestNG file are executed?

    <p>@AfterTest</p> Signup and view all the answers

    Which parameter is used to modify the function of an annotation in TestNG?

    <p>priority</p> Signup and view all the answers

    Which method will be executed prior to each method in each test case?

    <p>@BeforeMethod</p> Signup and view all the answers

    Which method is responsible for launching the Firefox browser in the code?

    <p>launchBrowser()</p> Signup and view all the answers

    Which method is used to verify the title of the homepage in the code?

    <p>verifyHomepageTitle()</p> Signup and view all the answers

    Which method is executed after each method in each test case?

    <p>@AfterMethod</p> Signup and view all the answers

    Which annotation is used to indicate that a method is a test case in TestNG?

    <p>@Test</p> Signup and view all the answers

    What is the purpose of the Assert class in TestNG?

    <p>To conduct verification operations</p> Signup and view all the answers

    How can you create multiple test cases in a single TestNG file?

    <p>By using multiple @Test annotations</p> Signup and view all the answers

    What is the purpose of the test-output folder in TestNG?

    <p>To store the HTML reports</p> Signup and view all the answers

    How can you run a TestNG test in Eclipse?

    <p>By running the file as you normally do</p> Signup and view all the answers

    What is the purpose of the index.html file in the test-output folder?

    <p>To provide a report of the test case results</p> Signup and view all the answers

    Which framework is more preferred for testers using Selenium Grid?

    <p>TestNG</p> Signup and view all the answers

    What is the purpose of annotations in TestNG?

    <p>To control the execution of methods</p> Signup and view all the answers

    What is the advantage of using TestNG over JUnit?

    <p>All of the above</p> Signup and view all the answers

    What is the purpose of the @BeforeMethod annotation in TestNG?

    <p>To execute a method before each test method</p> Signup and view all the answers

    What is the purpose of the TestNG Maven tool?

    <p>To execute TestNG tests using Maven</p> Signup and view all the answers

    What is the purpose of the testng.xml file in TestNG?

    <p>To group test cases</p> Signup and view all the answers

    Which annotation is used to specify a method that will be run before each test method?

    <p>@BeforeMethod</p> Signup and view all the answers

    Which annotation is used to specify a method that will be run after each test method?

    <p>@AfterMethod</p> Signup and view all the answers

    Which annotation is used to specify a method that will be run before any test method belonging to the classes inside the tag is run?

    <p>@BeforeTest</p> Signup and view all the answers

    Which annotation is used to specify a method that will be run after all the test methods belonging to the classes inside the tag have run?

    <p>@AfterTest</p> Signup and view all the answers

    Which annotation is used to specify a method that will be run before the first test method in the current class is invoked?

    <p>@BeforeClass</p> Signup and view all the answers

    Which annotation is used to specify a method that will be run after all the test methods in the current class have been run?

    <p>@AfterClass</p> Signup and view all the answers

    More Like This

    Use Quizgecko on...
    Browser
    Browser