TestNG Interview Questions
In this post we will look at TestNG Interview questions. Examples are provided with explanation.
- What is TestNG?
- What are the features of TestNG?
- What are Basic Annotations in TestNG?
- What are the different Assertions in TestNG?
- What is Data Provider in TestNG?
- What is Parameterized Testing?
- What are the ways by which you can produce reports for TestNG results?
- How can we set the priorities in TestNG?
- How do we run multiple test suites in TestNG?
- What is InvocationCount in TestNG?
- How do we disable entire unit test in TestNG?
- How can we run TestNG from Command Line?
- What is TestNG Assert?
- What are the types of Asserts in TestNG?
What is TestNG?TestNG is a developed framework from scratch level and helps in providing in full cover the test cases and in executing the test.It is known as Testing Framework.It is used in Java Programming Language that is developed by Cedric Beust, and is also used for the inspiration from the JUnit Framework.TestNG helps in adding more powerful functionality and is easy to use.
What are the features of TestNG?
- TestNG supports Annotations.
- TestNG helps in using Java and OO Features.
- TestNG supports TIC(Testing Integrated Classes).
- TestNG is flexible plug in API.
- TestNG supports Multi Threaded Testing.
- TestNG is used in separating compile time test code from run time data information.
What are Basic Annotations in TestNG?
- BeforeSuite - used in running a single time before any tests.
- BeforeTest - used in executing the test methods in class.
- BeforeClass - used in executing the first tests in an invoked class.
- Test - used in identifying the method of execution.
- AfterClass - used in executing tests in invoked classes.
- AfterTest - used in running tests methods.
- AfterSuite - used in running all the other tests.
What are the different Assertions in TestNG?Different types of Assertions are as following:
assertEquals used in passing arguments that are equal otherwise fails.
assertNotEquals used in expecting values matches when it is failed.
assertTrue helps in passing the input condition which are true otherwise fails.
assertFalse helps in passing the input condition which is false otherwise fails.