Pertanyaan dan Jawaban Wawancara Paling Populer & Tes Online
Platform edukasi untuk persiapan wawancara, tes online, tutorial, dan latihan langsung

Bangun keterampilan dengan jalur belajar terfokus, tes simulasi, dan konten siap wawancara.

WithoutBook menghadirkan pertanyaan wawancara per subjek, tes latihan online, tutorial, dan panduan perbandingan dalam satu ruang belajar yang responsif.

Prepare Interview

Ujian Simulasi

Jadikan Beranda

Bookmark halaman ini

Langganan Alamat Email
WithoutBook LIVE Mock Interviews TestNG Related interview subjects: 13

Interview Questions and Answers

Know the top TestNG interview questions and answers for freshers and experienced candidates to prepare for job interviews.

Total 38 questions Interview Questions and Answers

The Best LIVE Mock Interview - You should go through before interview

Know the top TestNG interview questions and answers for freshers and experienced candidates to prepare for job interviews.

Interview Questions and Answers

Search a question to view the answer.

Freshers / Beginner level questions & answers

Ques 2

What are TestNG annotations? Provide some examples.

TestNG annotations are markers in the code that define how the methods below them should be run. Examples include @Test, @BeforeMethod, @AfterMethod, @BeforeClass, @AfterClass, @BeforeSuite, @AfterSuite, and more.
Simpan untuk Revisi

Simpan untuk Revisi

Bookmark item ini, tandai sebagai sulit, atau masukkan ke dalam set revisi.

Buka Perpustakaan Belajar Saya
Apakah ini membantu?
Add Comment View Comments
Ques 3

What is the purpose of the @DataProvider annotation?

The @DataProvider annotation is used to supply test methods with data. It allows you to define a method that returns an Object[][] where each Object[] can be assigned as parameters to the test method.
Simpan untuk Revisi

Simpan untuk Revisi

Bookmark item ini, tandai sebagai sulit, atau masukkan ke dalam set revisi.

Buka Perpustakaan Belajar Saya
Apakah ini membantu?
Add Comment View Comments
Ques 4

How can you parameterize tests in TestNG?

Tests can be parameterized in TestNG using the @Parameters annotation and defining parameters in the testng.xml file. Alternatively, the @DataProvider annotation can be used to provide test data.
Simpan untuk Revisi

Simpan untuk Revisi

Bookmark item ini, tandai sebagai sulit, atau masukkan ke dalam set revisi.

Buka Perpustakaan Belajar Saya
Apakah ini membantu?
Add Comment View Comments
Ques 5

What is the difference between @BeforeTest and @BeforeSuite annotations?

@BeforeSuite is executed before any test runs in the suite, while @BeforeTest is executed before any test method belonging to the specified tag in the testng.xml file.
Simpan untuk Revisi

Simpan untuk Revisi

Bookmark item ini, tandai sebagai sulit, atau masukkan ke dalam set revisi.

Buka Perpustakaan Belajar Saya
Apakah ini membantu?
Add Comment View Comments
Ques 7

What is the purpose of the @Parameters annotation?

The @Parameters annotation in TestNG is used to pass parameters to test methods. It is typically used in conjunction with the testng.xml file, where parameter values are specified.
Simpan untuk Revisi

Simpan untuk Revisi

Bookmark item ini, tandai sebagai sulit, atau masukkan ke dalam set revisi.

Buka Perpustakaan Belajar Saya
Apakah ini membantu?
Add Comment View Comments
Ques 8

Explain the purpose of the 'alwaysRun' attribute in TestNG annotations.

The 'alwaysRun' attribute, when set to 'true' in TestNG annotations, ensures that the annotated method (such as @BeforeMethod or @AfterMethod) always runs, even if the test method fails.
Simpan untuk Revisi

Simpan untuk Revisi

Bookmark item ini, tandai sebagai sulit, atau masukkan ke dalam set revisi.

Buka Perpustakaan Belajar Saya
Apakah ini membantu?
Add Comment View Comments
Ques 9

Explain the concept of testng.xml in TestNG.

The testng.xml file in TestNG is an XML configuration file that defines the structure and parameters for test execution. It allows you to customize the test suite, set parameters, and configure test groups.
Simpan untuk Revisi

Simpan untuk Revisi

Bookmark item ini, tandai sebagai sulit, atau masukkan ke dalam set revisi.

Buka Perpustakaan Belajar Saya
Apakah ini membantu?
Add Comment View Comments
Ques 10

Explain the use of the 'priority' attribute in the @Test annotation.

The 'priority' attribute in the @Test annotation allows you to specify the order in which test methods should be executed. Test methods with lower priority values are executed first.
Simpan untuk Revisi

Simpan untuk Revisi

Bookmark item ini, tandai sebagai sulit, atau masukkan ke dalam set revisi.

Buka Perpustakaan Belajar Saya
Apakah ini membantu?
Add Comment View Comments
Ques 11

What is the purpose of the 'timeOut' attribute in the @Test annotation?

The 'timeOut' attribute in the @Test annotation allows you to specify the maximum time (in milliseconds) that a test method should take to complete its execution. If the time exceeds this limit, the method is marked as a failure.
Simpan untuk Revisi

Simpan untuk Revisi

Bookmark item ini, tandai sebagai sulit, atau masukkan ke dalam set revisi.

Buka Perpustakaan Belajar Saya
Apakah ini membantu?
Add Comment View Comments
Ques 12

Explain the concept of testng-failed.xml in TestNG.

The testng-failed.xml file in TestNG is automatically generated when a test run has failures. It contains only the failed test methods and can be used to rerun only the failed tests.
Simpan untuk Revisi

Simpan untuk Revisi

Bookmark item ini, tandai sebagai sulit, atau masukkan ke dalam set revisi.

Buka Perpustakaan Belajar Saya
Apakah ini membantu?
Add Comment View Comments
Ques 13

What is the purpose of the 'alwaysRun' attribute in the @Test annotation?

The 'alwaysRun' attribute in the @Test annotation ensures that the annotated method (such as @BeforeMethod or @AfterMethod) always runs, even if the test method fails.
Simpan untuk Revisi

Simpan untuk Revisi

Bookmark item ini, tandai sebagai sulit, atau masukkan ke dalam set revisi.

Buka Perpustakaan Belajar Saya
Apakah ini membantu?
Add Comment View Comments
Ques 14

What is the purpose of the 'dependsOnMethods' attribute in TestNG?

The 'dependsOnMethods' attribute in TestNG allows you to specify dependencies between test methods. A test method will only be executed if the methods specified in 'dependsOnMethods' pass successfully.
Simpan untuk Revisi

Simpan untuk Revisi

Bookmark item ini, tandai sebagai sulit, atau masukkan ke dalam set revisi.

Buka Perpustakaan Belajar Saya
Apakah ini membantu?
Add Comment View Comments
Ques 15

Explain the use of the 'enabled' attribute in the @Test annotation.

The 'enabled' attribute in the @Test annotation allows you to enable or disable a test method. If set to 'false', the test method will be skipped during test execution.
Simpan untuk Revisi

Simpan untuk Revisi

Bookmark item ini, tandai sebagai sulit, atau masukkan ke dalam set revisi.

Buka Perpustakaan Belajar Saya
Apakah ini membantu?
Add Comment View Comments

Intermediate / 1 to 5 years experienced level questions & answers

Ques 18

How can you achieve parallel execution of tests in TestNG?

Parallel execution in TestNG can be achieved by using the 'parallel' attribute in the suite or test tag in the testng.xml file or by using the parallel attribute in the @Test annotation.
Simpan untuk Revisi

Simpan untuk Revisi

Bookmark item ini, tandai sebagai sulit, atau masukkan ke dalam set revisi.

Buka Perpustakaan Belajar Saya
Apakah ini membantu?
Add Comment View Comments
Ques 19

What is the purpose of the soft assert in TestNG?

The soft assert in TestNG allows you to collect multiple assertions during the execution of a test, even if one or more assertions fail. It doesn't stop the test execution immediately after the first assertion failure.
Simpan untuk Revisi

Simpan untuk Revisi

Bookmark item ini, tandai sebagai sulit, atau masukkan ke dalam set revisi.

Buka Perpustakaan Belajar Saya
Apakah ini membantu?
Add Comment View Comments
Ques 21

Explain the concept of listeners in TestNG.

Listeners in TestNG allow you to customize and control the test execution process. Examples include TestListener, ITestListener, IAnnotationTransformer, and IInvokedMethodListener.
Simpan untuk Revisi

Simpan untuk Revisi

Bookmark item ini, tandai sebagai sulit, atau masukkan ke dalam set revisi.

Buka Perpustakaan Belajar Saya
Apakah ini membantu?
Add Comment View Comments
Ques 22

How can you perform data-driven testing in TestNG?

Data-driven testing in TestNG can be achieved by using the @DataProvider annotation or the dataProvider attribute in the @Test annotation, allowing you to supply different sets of data to the test method.
Simpan untuk Revisi

Simpan untuk Revisi

Bookmark item ini, tandai sebagai sulit, atau masukkan ke dalam set revisi.

Buka Perpustakaan Belajar Saya
Apakah ini membantu?
Add Comment View Comments
Ques 23

How can you perform cross-browser testing in TestNG?

Cross-browser testing in TestNG can be achieved by parameterizing the browser type and using the @Parameters annotation or the dataProvider attribute to supply different browsers to the test method.
Simpan untuk Revisi

Simpan untuk Revisi

Bookmark item ini, tandai sebagai sulit, atau masukkan ke dalam set revisi.

Buka Perpustakaan Belajar Saya
Apakah ini membantu?
Add Comment View Comments
Ques 24

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

The @Listeners annotation in TestNG is used to specify one or more listener classes that will be notified during the test execution. This allows you to implement custom behavior at various stages of the test lifecycle.
Simpan untuk Revisi

Simpan untuk Revisi

Bookmark item ini, tandai sebagai sulit, atau masukkan ke dalam set revisi.

Buka Perpustakaan Belajar Saya
Apakah ini membantu?
Add Comment View Comments
Ques 25

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

The @Listeners annotation in TestNG is used to specify one or more listener classes that will be notified during the test execution. This allows you to implement custom behavior at various stages of the test lifecycle.
Simpan untuk Revisi

Simpan untuk Revisi

Bookmark item ini, tandai sebagai sulit, atau masukkan ke dalam set revisi.

Buka Perpustakaan Belajar Saya
Apakah ini membantu?
Add Comment View Comments
Ques 26

Explain the use of the 'dependsOnGroups' attribute in TestNG.

The 'dependsOnGroups' attribute in TestNG allows you to specify groups that must be executed before the current test method. It establishes a dependency relationship between groups.
Simpan untuk Revisi

Simpan untuk Revisi

Bookmark item ini, tandai sebagai sulit, atau masukkan ke dalam set revisi.

Buka Perpustakaan Belajar Saya
Apakah ini membantu?
Add Comment View Comments
Ques 27

How can you group tests using regular expressions in TestNG?

Tests can be grouped using regular expressions in TestNG by specifying the 'groups' attribute in the testng.xml file with a regular expression pattern that matches the desired test groups.
Simpan untuk Revisi

Simpan untuk Revisi

Bookmark item ini, tandai sebagai sulit, atau masukkan ke dalam set revisi.

Buka Perpustakaan Belajar Saya
Apakah ini membantu?
Add Comment View Comments
Ques 28

What is the purpose of the 'preserveOrder' attribute in the @Test annotation?

The 'preserveOrder' attribute in the @Test annotation, when set to 'true', ensures that the order of test methods is preserved as defined in the testng.xml file, even when parallel execution is enabled.
Simpan untuk Revisi

Simpan untuk Revisi

Bookmark item ini, tandai sebagai sulit, atau masukkan ke dalam set revisi.

Buka Perpustakaan Belajar Saya
Apakah ini membantu?
Add Comment View Comments
Ques 29

Explain the concept of parameterization in TestNG.

Parameterization in TestNG allows you to run the same test method with different sets of data. This can be achieved using the @Parameters annotation or data providers.
Simpan untuk Revisi

Simpan untuk Revisi

Bookmark item ini, tandai sebagai sulit, atau masukkan ke dalam set revisi.

Buka Perpustakaan Belajar Saya
Apakah ini membantu?
Add Comment View Comments
Ques 30

Explain the use of the 'parallel' attribute in the tag in testng.xml.

The 'parallel' attribute in the tag of testng.xml allows you to run test classes or test methods in parallel. Possible values include 'methods', 'classes', and 'tests'.
Simpan untuk Revisi

Simpan untuk Revisi

Bookmark item ini, tandai sebagai sulit, atau masukkan ke dalam set revisi.

Buka Perpustakaan Belajar Saya
Apakah ini membantu?
Add Comment View Comments
Ques 31

Explain the use of the 'alwaysRun' attribute in the @DataProvider annotation.

The 'alwaysRun' attribute in the @DataProvider annotation ensures that the data provider method always runs, even if no test method depends on it. It helps in providing data dynamically.
Simpan untuk Revisi

Simpan untuk Revisi

Bookmark item ini, tandai sebagai sulit, atau masukkan ke dalam set revisi.

Buka Perpustakaan Belajar Saya
Apakah ini membantu?
Add Comment View Comments
Ques 32

How can you skip a test method conditionally in TestNG?

Conditional skipping of a test method in TestNG can be achieved by using the 'enabled' attribute in the @Test annotation along with a condition that evaluates to true or false.
Simpan untuk Revisi

Simpan untuk Revisi

Bookmark item ini, tandai sebagai sulit, atau masukkan ke dalam set revisi.

Buka Perpustakaan Belajar Saya
Apakah ini membantu?
Add Comment View Comments
Ques 33

Explain the purpose of the 'threadPoolSize' attribute in the @Test annotation.

The 'threadPoolSize' attribute in the @Test annotation specifies the number of threads in the thread pool for parallel execution. It determines how many parallel instances of the test method should run.
Simpan untuk Revisi

Simpan untuk Revisi

Bookmark item ini, tandai sebagai sulit, atau masukkan ke dalam set revisi.

Buka Perpustakaan Belajar Saya
Apakah ini membantu?
Add Comment View Comments

Experienced / Expert level questions & answers

Ques 34

What is the purpose of the @Factory annotation?

The @Factory annotation in TestNG is used to create a factory method that can produce instances of the test class. This is useful for dynamic test case generation.
Simpan untuk Revisi

Simpan untuk Revisi

Bookmark item ini, tandai sebagai sulit, atau masukkan ke dalam set revisi.

Buka Perpustakaan Belajar Saya
Apakah ini membantu?
Add Comment View Comments
Ques 35

What is the purpose of the IRetryAnalyzer interface in TestNG?

The IRetryAnalyzer interface in TestNG allows you to implement custom logic to decide whether a test method should be retried after a failure. It is used in conjunction with the @Test annotation's 'retryAnalyzer' attribute.
Simpan untuk Revisi

Simpan untuk Revisi

Bookmark item ini, tandai sebagai sulit, atau masukkan ke dalam set revisi.

Buka Perpustakaan Belajar Saya
Apakah ini membantu?
Add Comment View Comments
Ques 36

Explain the purpose of the @Parameters annotation in conjunction with @Factory.

The @Parameters annotation in conjunction with @Factory allows you to pass parameters to the factory method, creating dynamic instances of the test class with different parameter values.
Simpan untuk Revisi

Simpan untuk Revisi

Bookmark item ini, tandai sebagai sulit, atau masukkan ke dalam set revisi.

Buka Perpustakaan Belajar Saya
Apakah ini membantu?
Add Comment View Comments
Ques 37

What is the purpose of the IReporter interface in TestNG?

The IReporter interface in TestNG allows you to create custom HTML reports by implementing the generateReport() method. It provides flexibility in generating test reports.
Simpan untuk Revisi

Simpan untuk Revisi

Bookmark item ini, tandai sebagai sulit, atau masukkan ke dalam set revisi.

Buka Perpustakaan Belajar Saya
Apakah ini membantu?
Add Comment View Comments
Ques 38

What is the purpose of the IAnnotationTransformer interface in TestNG?

The IAnnotationTransformer interface in TestNG allows you to modify the annotations of test methods or classes dynamically. It is useful for altering the behavior of tests at runtime.
Simpan untuk Revisi

Simpan untuk Revisi

Bookmark item ini, tandai sebagai sulit, atau masukkan ke dalam set revisi.

Buka Perpustakaan Belajar Saya
Apakah ini membantu?
Add Comment View Comments

Most helpful rated by users:

Hak Cipta © 2026, WithoutBook.