• Slider Banner

    Prepare for

    Technical Interview

    Over .1 Million+ Interview Questions for different profiles

    Read More
  • Slider Banner

    Join the

    Programming World

    Learn about top programming languages, tools and frameworks.

    Read More
  • Slider Banner

    Prepare with

    Certification MCQ

    Practice for certification from 1000+ multiple choice questions.

    Read More

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

@Test(invocationCount=?) is a parameter that indicates the number of times this method should be invoked. @Test(threadPoolSize=?) is used for executing suites in parallel. Each suite can be run in a separate thread.

To specify how many times @Test method should be invoked from different threads, you can use the attribute threadPoolSize along with invocationCount.


@Test(threadPoolSize = 3, invocationCount = 10)
public void testServer() 

How does TestNG allow you to state dependencies? Explain it with an example.

Dependency is a feature in TestNG that allows a test method to depend on a single or a group of test methods. Method dependency only works if the "depend-on-method" is part of the same class or any of the inherited base classes (i.e. while extending a class). 

public void drive()
@Test(dependsOnMethods={“drive”}, groups={"Car"})
public void changeGear() 
@Test(dependsOnMethods={“changeGear”}, groups={“Car”})
public void accelerate()

Explain what is Group Test in TestNG?

In TestNG, methods can be categorized into groups. When a particular group is being executed, all the methods in that group will be executed.  We can execute a group by parameterizing it’s name in group attribute of @Test annotation.


public void one()
public void Two()
public void Three()

What is soft assertion in Selenium? How can you mark a test case as failed by using soft assertion?

Soft Assertions are customized error handlers provided by TestNG. Soft Assertions do not throw exceptions when assertion fails, and they simply continue to the next test step. They are commonly used when we want to perform multiple assertions.

To mark a test as failed with soft assertions, call assertAll() method at the end of the test.

public void myTest() 
    SoftAssert softAssert = new SoftAssert();

How to skip a method or a code block in TestNG?

If you want to skip a particular test method, then you can set the "enabled" parameter in test annotation to false.

By default, the value of "enabled" parameter will be true. Hence it is not necessary to define the annotation as true while defining it.


@Test(enabled = false)
public myMethod()

Explain DataProviders in TestNG using an example. Can I call a single data provider method for multiple functions and classes?

DataProvider is a TestNG feature, which enables us to write DataDriven tests. When we say, it supports DataDriven testing, then it becomes obvious that the same test method can run multiple times with different data-sets. DataProvider is in fact another way of passing parameters to the test method.

@DataProvider marks a method as supplying data for a test method. The annotated method must return an Object[] where each Object[] can be assigned to parameter list of the test method.

To use the DataProvider feature in your tests, you have to declare a method annotated by @DataProvider and then use the said method in the test method using the "dataProvider" attribute in the Test annotation.

As far as the second part of the question is concerned, Yes, the same DataProvider can be used in multiple functions and classes by declaring DataProvider in separate class and then reusing it in multiple classes.


public Object[][] getDataFromDataprovider()
    return new Object[][]
        { "Ram", "India" },
        { "John", "UK" },
        { "Ben", "USA" }

public void testMethod(String name, String country)

What is parameterization in TestNG? How to pass parameters using testng.xml?

Parameterization is the technique of defining values in testng.xml file and sending them as parameters to the test class. This technique is especially useful when we need to pass multiple login credentials of various test environments. Take a look at the code below, in which “userName” is annotated as a parameter.

public class ParameterizedTest1
    public void parameterTest(String userName)
        System.out.println("Parameterized value is : " + userName);

To pass parameters using testng.xml file, we need to use "parameters" tag. Look at the below code for example:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "<a href="http://testng.org/testng-1.0.dtd">http://testng.org/testng-1.0.dtd</a>" >
<suite name=”CustomSuite">
    <test name=”CustomTest”>
        <parameter name="userName" value=”Rohan"/>
            <class name="ParameterizedTest1" />

Simple Rules for Copywriting

Rules for Copy writing 

Here are some of the rules that should be followed while creating the copy for organic or social media platforms:

1. Know Your Audience
There should be background research of audience and copy should be written in such a way that you are the audience who would be reading it.

2. Finding Your Unique Selling proposition
This is why your product or service is great. Way you do sell the things. It should have some unique proposition compared to the competitor that why your product is better in market.

3.Establish your Objective
Whenever you start writing make sure you understand your objective It is just to describe your product/ service or is it to go someone on email list etc. So copy should be direct, concise and straight forward.

4. Use a compelling subject line
Having a creek subject line is very important. Avoid weasel words like maybe, perhaps, however etc.

5.  Use the present tense
Because using in the past tense it goes passive . People take actions what is happening in present . Future tense might be a good practice but for sales page it should always on present tense.

6. Include customer quotes and testimonials
It is an easy and best way to attract new customers.Using reviews in copy is an advantage to get attention.

7. Keep it clean and concise
No big paragraphs should be used. Use your padding, italic words etc to appear it different.

8. Make it Pretty
Use images, videos/ visuals should match with your product. High quality visuals should be used.


What is the significance of testng.xml?

Since Selenium does not support report generation and test case management, we use TestNG framework with Selenium. TestNG is much more advanced than JUnit, and it makes implementing annotations easy. That is the reason TestNG framewrok is used with Selenium WebDriver.

But have you wondered where to define the test suites and grouping of test classes in TestNG?

It is by taking instructions from the testng.xml file. We cannot define a test suite in testing source code, instead it is represented in an XML file, because suite is the feature of execution. The test suite is basically a collection of test cases.

So for executing the test cases in a suite, i.e a group of test cases, you have to create a testng.xml file which contains the name of all the classes and methods that you want to execute as a part of that execution flow.

Other advantages of using testng.xml file are:

  • It allows execution of multiple test cases from multiple classes
  • It allows parallel execution
  • It allows execution of test cases in groups, where a single test can belong to multiple groups

Which technique should you consider using throughout the Selenium script if there is neither frame id nor frame name?

If neither frame name nor frame id is available, then we can use frame by index.

Let’s say, that there are 3 frames in a web page and if none of them have frame name and frame id, then we can still select those frames by using frame (zero-based) index attribute. Each frame will have an index number. The first frame would be at index 0, the second at index 1 and the third at index 2. Once the frame has been selected, all subsequent calls on the WebDriver interface will be made to that frame.


Subscribe to