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 (B)</p> Signup and view all the answers

How many test cases can you execute separately using TestNG?

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

What does TestNG allow you to easily generate?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

What is the purpose of the Assert class in TestNG?

<p>To conduct verification operations (D)</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 (A)</p> Signup and view all the answers

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

<p>To store the HTML reports (D)</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 (A)</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 (B)</p> Signup and view all the answers

Which framework is more preferred for testers using Selenium Grid?

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

What is the purpose of annotations in TestNG?

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

What is the advantage of using TestNG over JUnit?

<p>All of the above (D)</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 (C)</p> Signup and view all the answers

What is the purpose of the TestNG Maven tool?

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

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

<p>To group test cases (D)</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 (C)</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 (A)</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 (C)</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 (B)</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 (A)</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 (A)</p> Signup and view all the answers

More Like This

Use Quizgecko on...
Browser
Browser