TestNG

Ace your homework & exams now with Quizwiz!

Explain what does @Test(invocationCount=?) and (threadPoolSize=?) indicate?

@Test(threadPoolSize=?): The threadPoolSize attributes tell TestNG to form a thread pool to run the test method through multiple threads. With threadpool, the running time for the test method reduces greatly. @Test(invocationCount=?): The invocationcount tells how many times TestNG should run this test method.

What is the function of "suite test" in TestNG?

Suite Test is done when I have to run few unit test together. Suite Test bundle this unit test together. XML file is used to run the suite test.

List out the advantages of TestNG over Junit?

Compare to JUnit annotations, TestNG are easy to understand. Unlike JUnit, TestNG does not require to declare @BeforeClass and @AfterClass. Method name constraint is not there in TestNG TestNG allows grouping of test cases easily which is not possible in JUnit. TestNG supports additional setup: @Before/AfterSuite @Before/AfterTest @Before/AfterGroup TestNG does not need to extend any class In TestNG, it is possible to run selenium test cases in parallel Based on group TestNG allows to execute test cases TestNG allows to determine the dependent test cases; each test case is autonomous to other test case.

Explain what is testing.xml file used for?

File testing.xml captures the entire testing in XML. This file makes it easy to define all the test suites and their parameters in one file, which I can verify in my code repository or e-mail to coworkers. It also makes easy to pull out subsets of my tests or split several runtime configurations.

Explain what is Group in TestNG?

It is a new feature included in TestNG, it allows me to dispatch methods into proper portions and perform grouping of test methods. With group test, I can not only declare methods that belong to groups, but I can also specify groups that contain other groups. Groups are determined in my testing.xml file using the group test.

What are the TestNG features?

It supports testing integrated classes. Different Annotations are supported. Separate compile time test code from data info /run time configuration. Run-time configuration is flexible. Flexible plug-in API. For further flexibility embeds BeanShell. Multi-threaded testing support. Supports parallel testing, load testing, partial failure, dependent test methods. After compilation of test, a request can be made to TestNG to run all the "front-end" tests or "slow", "fast", "database" . For the same test class TestNG support for multiple instances. For logging no dependencies, default JDK functions for logging and run-time. TestNG uses more OO (object-oriented) and Java features

Explain what is parametric testing?

Parameterized testing allows developers to execute the same test over and over again using different values. In two different ways TestNG allows to pass parameters directly to test methods. with testing.xml with Data Providers

Explain in what ways does TestNG allows me to specify dependencies?

TestNG allows me to specify dependencies in two ways. Using attributes dependsOnMethods in @Test annotations. Using attributes dependsonGroup in @Test annotations.

List out various ways in which TestNG can be invoked?

TestNG can be invoked in different ways Using Eclipse With ant From the command line Using Intellij's IDEA

What is exception test?

TestNG gives option for tracing the exception handling of code. I can test whether a code throws the expected results or not. The expectedExceptions parameter is is available along with @Test annotation.

What is TestNG?

TestNG is an automated open source testing framework. It is based on JUnit framework but is not a JUnit extension.

Explain how I can execute tests in TestNG?

The tests in TestNG are executed using TestNG class. For running tests in TestNG framework, class is the main entry point. Users can make their own TestNG object and invoke it in many different ways like On an already existing testing. xml On a synthetic testing.xml created entirely from Java By directly setting the test classes.

Explain what is time out test in TestNG?

The time out test in TestNG is nothing but time alloted to perform unit testing. If the unit test fails to finish in that specific time limit, TestNG will abandon further testing and mark it as failed.

Mention different ways in which I can produce reports for TestNG results.

There are two ways to produce a report with TestNG. Listeners: for a listener class to implement, the class has to implement the org.testing./TestListener interface. Reporters: For a reporting class to implement, the class has to implement an org.testing/reporter interface. When the whole suite run ends, these classes are called. When called, the object consisting the information of the whole test run is delivered to this class.

In TestNG how can I disable a test?

To disable the test case that I do not want, I can use the annotations @Test(enabled =false).

Explain what is meant when I have to pass parameters using data-providers in TestNG?

When I have to pass complex parameter or parameters that are to be created from Java, in such instances parameters can be passed using DataProviders. The annotation for data provider is @DataProvider. This annotation has only single string attribute, if the name is not declared; the data provider's name automatically defaults to the method's name. A data provider yields back an array of objects.

Explain what are the basic steps required in writing TestNG tests?

Write down the business logic of your test and insert TestNG annotations in the code. In a build.xml or testing.xml, add the information about your test run TestNG


Related study sets

vocabulary workshop level b unit 11 choosing the right words

View Set

Orthopedics/ Skeletal System: Medical Term

View Set

Microsoft Azure Fundamentals Final Exam

View Set

NURS 7001: Unit 4 Review Questions

View Set

Identifying Independent and Dependent Variables

View Set

NURSING ROLES AND RESPONSIBILITIES ON EUTHANASIA, ADVANCE DIRECTIVES AND DNR, ETHICAL DECISION-MAKING PROCESS

View Set