Skip to main content

TestNG MCQ

Question :What is TestNG?

A programming language

A test automation framework

A browser

An operating system

Correct Answer :  A test automation framework

 

Question :Which file is used to configure TestNG settings?

testng.properties

testng.xml

testng.cfg

testng.settings

Correct Answer :  testng.xml

 

Question :How do you define a test method in TestNG?

public void testMethod()`

public void testMethod()` with `@Test` annotation

public void testMethod()` with `@startTest` annotation

`@TestMethod`

Correct Answer :  public void testMethod()` with `@Test` annotation

 

Question :What is the purpose of the `@Test` annotation in TestNG?

It marks a method as a test method

It defines the test data

It specifies the test priority

It handles test dependencies

Correct Answer :  It marks a method as a test method

 

Question :How do you group test methods in TestNG?

Using the `@Group` annotation

Using the `@Test` annotation

Using the `@Group` annotation with the group name

Using the `@Test` annotation with the group name

Correct Answer :  Using the `@Test` annotation with the group name

 

Question :How do you specify test dependencies in TestNG?

Using the `@Dependency` annotation

Using the `@Test` annotation with `dependsOnMethods` attribute

Using the `@DependsOn` annotation

Using the `@Test` annotation with `dependsOn` attribute

Correct Answer :  Using the `@Test` annotation with `dependsOnMethods` attribute

 

Question :What is the purpose of the `@DataProvider` annotation in TestNG?

It provides data for test methods

It defines test execution order

It configures test groups

It handles test parallelism

Correct Answer :  It provides data for test methods

 

Question :How do you configure TestNG to run tests in parallel?

Using the `parallel` attribute in the `testng.xml` file

Using the `@Parallel` annotation

Using the `parallel` attribute in the `@Test` annotation

Using the `@Parallel` annotation with `true` value

Correct Answer :  Using the `parallel` attribute in the `testng.xml` file

 

Question :What is the purpose of the `@BeforeSuite` annotation in TestNG?

It runs before every test method

It runs before the test suite

It runs before the test class

It runs before every test method in a class

It runs before the test suite

 

Question :How do you disable a test method in TestNG?

Using the `@Test(enabled = false)` annotation

By commenting out the method

Using the `@Ignore` annotation

Using the `@Disabled` annotation

Using the `@Test(enabled = false)` annotation

 

Question :What is the purpose of the `@DataProvider` name attribute in TestNG?

It specifies the data provider name

It provides a unique identifier for the data provider

It links the data provider to a test method

It sets a custom name for the data provider

It specifies the data provider name

 

Question :How do you set the test execution order in TestNG?

Using the `@Order` annotation

Using the `@Sequence` annotation

Using the `@Test` annotation with the `priority` attribute

Using the `@Order` annotation with the order number

Correct Answer :  Using the `@Test` annotation with the `priority` attribute

 

Question :What is the purpose of the `@Listeners` annotation in TestNG?

It defines the test listeners

It specifies the test groups

It sets up the test data

It handles test configurations

Correct Answer :  It defines the test listeners

 

Question :How do you pass parameters to a test method in TestNG?

Using the `@Parameter` annotation

Using the `@Test` annotation with the `params` attribute

Using the `@Parameters` annotation

Using the `@Test` annotation with the `parameters` attribute

Correct Answer :  Using the `@Parameters` annotation

 

Question :What is the purpose of the `@BeforeTest` annotation in TestNG?

It runs before every test method

It runs before the test suite

It runs before the test class

It runs before every test method in a class

Correct Answer :  It runs before the test suite

 

Question :How do you handle test timeouts in TestNG?

Using the `@Timeout` annotation

Using the `@Test` annotation with the `timeout` attribute

Using the `@Time` annotation

Using the `@Test` annotation with the `time` attribute

Correct Answer :  Using the `@Test` annotation with the `timeout` attribute

 

Question :What is the purpose of the `@AfterTest` annotation in TestNG?

It runs after every test method

It runs after the test suite

It runs after the test class

It runs after every test method in a class

Correct Answer :  It runs after the test suite

 

Question :How do you handle test retries in TestNG?

Using the `@Retry` annotation

Using the `@Test` annotation with the `retryOnFailure` attribute

Using the `@Test` annotation with the `retryAnalyzer` attribute

Using the `@Test` annotation with the `retry` attribute

Using the `@Test` annotation with the `retryAnalyzer` attribute

 

Question :What is the purpose of the `@AfterSuite` annotation in TestNG?

It runs after every test method

It runs after the test suite

It runs after the test class

It runs after every test method in a class

It runs after the test suite

 

Question :How do you configure TestNG to run tests in a specific order?

By using the `preserve-order` attribute in the `testng.xml` file

By using the `@Order` annotation

By using the `order` attribute in the `@Test` annotation

By using the `@Order` annotation with the order number

By using the `preserve-order` attribute in the `testng.xml` file

 

Question :What is the purpose of the `@BeforeClass` annotation in TestNG?

It runs before every test method

It runs before the test suite

It runs before the test class

It runs before every test method in a class

It runs before the test class

 

Question :How do you handle test data providers in TestNG?

By implementing the `DataProvider` interface

By using the `@DataProvider` annotation with the `dataProviderClass` attribute

By using the `DataProviderFactory` class

By using the `@DataProvider` annotation with the `dataProvider` attribute

By using the `@DataProvider` annotation with the `dataProviderClass` attribute

 

Question :What is the purpose of the `@AfterClass` annotation in TestNG?

It runs after every test method

It runs after the test suite

It runs after the test class

It runs after every test method in a class

It runs after the test class

 

Question :How do you configure TestNG to run tests multiple times?

Using the `@Repeat` annotation

Using the `@Test` annotation with the `repeatCount` attribute

Using the `@Repeatable` annotation

Using the `@Test` annotation with the `invocationCount` attribute

Using the `@Test` annotation with the `invocationCount` attribute

 

Question :What is the purpose of the `@BeforeMethod` annotation in TestNG?

It runs before every test method

It runs before the test suite

It runs before the test class

It runs before every test method in a class

It runs before every test method

 

Question :How do you handle test parameterization in TestNG?

Using the `@Test` annotation with the `param` attribute

Using the `@Param` annotation

Using the `@Test` annotation with the `parameters` attribute

Using the `@Parameters` annotation

Using the `@Parameters` annotation

 

Question :What is the purpose of the `@AfterMethod` annotation in TestNG?

It runs after every test method

It runs after the test suite

It runs after the test class

It runs after every test method in a class

It runs after every test method

 

Question :How do you configure TestNG to run only specific test methods?

Using the `@Test` annotation with the `includeMethods` attribute

Using the `@IncludeMethods` annotation

Using the `@Test` annotation with the test method name

Using the `@Test` annotation with the `include` attribute

Using the `@Test` annotation with the `include` attribute

 

Question :What is the purpose of the `@Factory` annotation in TestNG?

It defines the test factories

It creates test instances

It runs the test suite

It specifies the test groups

It defines the test factories

 

Question :How do you configure TestNG to run tests in a specific thread pool size?

Using the `@ThreadPoolSize` annotation

Using the `@Test` annotation with the `threadPoolSize` attribute

Using the `@Thread` annotation

Using the `@Test` annotation with the `threadPool` attribute

Using the `@Test` annotation with the `threadPoolSize` attribute

Comments

popular

Privacy policy for Sri Bhagavat Gita

 Privacy Policy for Sri Bhagavad Gita This respects the privacy of its users and is committed to protecting their personal information. This privacy policy outlines the information collected by This and how it is used. Information We Collect : We are not collecting any personal information such as name and email address. This may collect non-personal information such as device type, operating system version, and app usage data to improve the app's functionality and user experience. Sharing of Information This does not sell or share personal information with third parties for marketing purposes. This may share personal information with service providers for the purpose of providing registration or support services to the user. Security of Information This takes reasonable measures to protect user data against unauthorized access, alteration, or destruction. However, This cannot guarantee the security of user data transmitted over the internet. Children's Privacy This does not kn

Privacy policy for BMI calculator

Privacy Policy for BMI Calculator  Effective Date: 5th July 2023 1.1 Personal Information: We do not collect any personally identifiable information (PII) such as your name, address, email, or phone number when you use the App. 1.2 Non-Personal Information: The App may collect certain non-personal information automatically, such as your device's unique identifier (UDID), device type, operating system, language preferences, and anonymous usage statistics. This information is collected to improve the functionality and user experience of the App and is not linked to any personally identifiable information. 2. Use of Information: 2.1 Personal Information: As stated earlier, we do not collect any personal information through the App. Therefore, we do not use or share any personal information. 2.2 Non-Personal Information: The non-personal information collected by the App may be used for the following purposes: - To improve the performance, functionality, and user experience of the App.

privacy policy for Selenium App

 Effective Date: 16 Sep 2023 URL -  https://play.google.com/store/apps/details?id=com.csj.selenium 1. Introduction :   This Privacy Policy outlines how we collect, use, disclose, and safeguard your personal information when you use our Android application ("App"). By accessing or using the App, you agree to the terms and practices described in this Privacy Policy. If you do not agree with our policies and practices, please do not use the App. 2. Information We Collect : - 2.1. Personal Information: We do not collect any personal information from you directly. However, we may collect non-personal information such as device information (e.g., device type, operating system, unique device identifier), and usage data (e.g., pages visited, interactions within the App). 2.2. User-Generated Content: The App allows you to submit questions and answers. Any content you submit will be stored on your local device.  3. How We Use Your Information -We may use non-personal information for an