TestNG Tutorial: What is, Annotations & Framework in Selenium (medium)

AwedExuberance avatar
AwedExuberance
·
·
Download

Start Quiz

Study Flashcards

30 Questions

TestNG is an automation testing framework inspired by which framework?

JUnit

What does NG stand for in TestNG?

Next Generation

What is one advantage of using TestNG over JUnit?

TestNG provides better test reporting

What can you do with TestNG in Selenium if you only want to run failed test cases?

Use the testng-failed.xml file

How many test cases can you execute separately using TestNG?

Only failed test cases

What does TestNG allow you to easily generate?

Test reports

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

@AfterTest

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

priority

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

@BeforeMethod

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

launchBrowser()

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

verifyHomepageTitle()

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

@AfterMethod

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

@Test

What is the purpose of the Assert class in TestNG?

To conduct verification operations

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

By using multiple @Test annotations

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

To store the HTML reports

How can you run a TestNG test in Eclipse?

By running the file as you normally do

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

To provide a report of the test case results

Which framework is more preferred for testers using Selenium Grid?

TestNG

What is the purpose of annotations in TestNG?

To control the execution of methods

What is the advantage of using TestNG over JUnit?

All of the above

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

To execute a method before each test method

What is the purpose of the TestNG Maven tool?

To execute TestNG tests using Maven

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

To group test cases

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

@BeforeMethod

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

@AfterMethod

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?

@BeforeTest

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?

@AfterTest

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

@BeforeClass

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

@AfterClass

TestNG Tutorial Quiz: Test your knowledge on TestNG, a popular testing framework for Java. This quiz covers topics such as including TestNG in the libraries list, adding JAR files containing the Selenium API, and navigating to the appropriate file location. Test your skills now!

Make Your Own Quizzes and Flashcards

Convert your notes into interactive study material.

Get started for free
Use Quizgecko on...
Browser
Browser