Browsed by
Month: February 2017

QA interview questions

QA interview questions

e2e_interview

This post is a bit different that other post on this blog. I decided to present a set of questions which may be asked during the interview to a QA job. Of course, it is only a small subset of all possible questions, but it gives you an overview what you can expect from that kind of meeting. Each question has an answer.

If you would like to be sure that you can answer this and many other questions during QA interview, you can sign up for a weekly mail course http://mailcourse.seleniumbook.com/

Sign up for free end-to-end testing training

Learn how to create end-to-end tests for your applications from the beginning to mobile testing
Name
Email address

What is a Test Case? What does it include?

A Test Case is a step by step description of the testing process and a set of conditions under which a tester can determine if the application works as expected.

It includes:

  • test case description
  • test steps
  • requirements
  • expected result

What are different types of software testing?

It is four main categories, but there are much more test types in each category.

  • Unit Testing – test smallest parts of application, single methods or classes
  • Integration Testing – test single modules combination, treated as a group
  • System Testing – test without knowledge of inner design or logic. Evaluate the complete system
    • Functional – related to functionality
    • Smoke testing – preliminary tests, that checks application condition
    • Regression testing – verifies that software previously developed and tested still performs correctly
    • Non-functional – test the way how system operates, rather than specific behaviors of that system
    • Performance testing – determine how a system performs regarding responsiveness and stability under a particular workload
    • Security testing – reveal flaws in the security mechanisms of an information system that protect data and maintain functionality as intended
  • UAT – formal testing on user needs and requirements to enable the user or customers to determine whether or not to accept the system

Source

When should testing start in a project? Why?

For Unit and Integration testing you should start as soon as possible. When the requirement is ready and you will start to write code.

For System and End to end testing, you should start before the first presentation for the customer.

What is end-to-end testing?

It is testing a complete application. It simulates real-world use, such as interacting with a database, using network communication, or interacting with other hardware, application, or system.

What is acceptance testing?

Acceptance testing is done by the user or customer although other stakeholders may be involved as well.
The goal of acceptance testing is to establish confidence in the system.

Source

How will you find an element using Selenium?

In Selenium every object or control in a web page is referred as an elements, there are different ways to find an element in a web page:

  • Id
  • Name
  • TagName
  • CssSelector
  • LinkText
  • PartialLinkText
  • XPath
  • ClassName

Explain what is assertion in Selenium

The assertion is used to verify a point in a test case. It verifies that the state of the application conforms to expectations.

What are the types of assertion?

Assertion types in NUnit:

  • Equals
  • Pass
  • Fail
  • Ignore
  • Inconclusive
  • That
  • Throws
  • DowsNotThrow
  • IsTrue
  • IsFalse
  • IsNotNull
  • IsNull
  • AreEqual
  • AreNotEqual
  • AreSame
  • AreNotSame
  • IsNaN
  • IsEmpty
  • IsNotEmpty
  • IsAssignableFrom
  • IsInstanceOf
  • Greater
  • GreaterOrEqual
  • Less
  • LEssOrEqual
  • Contains

Mention what is the use of X-path?

It is used to find elements on web page. It is another for of CSS selectors. It is a language to address parts of XML documents.

List out the technical challenges with Selenium?

  • only for web applications
  • have to depend on third party tools for reporting related capabilities
  • hard to maintain element selectors during development

What is the difference between Implicit wait and Explicit wait?

Implicit Wait

Sets a timeout for all Web Element searches. It will try looking for element presence again and again before throwing a NoSuchElementException for the specified amount of time.

Explicit Wait

It is a timeout for a particular operation.

Explain what is the difference between FindElement() and FindElements()?

FindElement()

It finds the first element within the current page using the given selector. It returns a single WebElement.

FindElements()

It finds all elements within the current page using the given selector. It returns a list of web elements as IEnumerable<IWebElement>.

How you can fill the text box using WebDriver?

You can find proper element and send text for it:

driver.FindElement(By.id(“textBoxId”)).sendKeys(“value”);

How you can perform double click using WebDriver?

You can perform double click using:

var action = new Actions(driver);
action.DoubleClick(driver.FindElement(By.Id(“elementId”)))
.Perform();

Explain how you can debug the tests in Selenium WebDriver?

  • Place the breakpoint in Visual Studio into the test case code
  • Run test in debug mode
  • Wait for test to stop at breakpoint
  • Enjoy debugging features in Visual Studio

Explain what can cause a Selenium IDE test to fail?

  • selector to element changed and Selenium cannot locate the element
  • selenium waiting to access an element which did not appear on the web page and the operation timed out
  • when an assertion fails

What are the different types of Drivers available in WebDriver?

The drivers available in WebDriver are:

How to assert the title of the web page?

You can assert page title using Title property of driver object.

Assert.AreEqual(driver.Title, “Page Title”);

How to retrieve CSS properties of an element?

The values of the CSS property can be retrieved using a GetCssValue method:

driver.FindElement(By.Id(“elementId”)).GetCssValue(“font-size”);

Make sure that your application works on multiple browsers

Make sure that your application works on multiple browsers

e2e_every

Sometimes we need to create a system as a public web application. We may even need to create it for the broad group of customers. In some cases, we need to develop it working on many different types of browser versions. In usual development, we would be forced to open the website in each browser ant test in manually. It would be very beneficial if we can automate it.

We can perform testing on multiple browsers very simple using Selenium WebDriver. We will just use its ability to works with different drivers and configure them.

Simple test

In the beginning, we will write some basic test for our application. We will test Google Translate page for the simplicity of this example. This test checks if translation works well for some simple word.

[Test]
public void ShouldTranslateWord()
{
    var driver = new ChromeDriver();
    driver.Navigate().GoToUrl("https://translate.google.com/#en/pl");

    var sourceTextBox = driver.FindElement(By.Id("source"));
    sourceTextBox.SendKeys("cat");

    driver.FindElement(By.Id("gt-submit")).Click();

    var resultTextBox = driver.FindElement(By.Id("result_box"));

    Assert.AreEqual(resultTextBox.Text, "kot");
}

Test support of different browsers

To be sure that application works fine on many browsers we can define a list of them and use it in a loop. It gives us a flexible method to configure these environments.

[Test]
public void ShouldTranslateWord_MultipleBrowsers()
{
    IWebDriver[] drivers = new IWebDriver[]
    {
        new ChromeDriver(),
        new FirefoxDriver(),
        new InternetExplorerDriver(),
        new SafariDriver(),
        new OperaDriver()
    };

    foreach (var driver in drivers)
    {
        driver.Navigate().GoToUrl("https://translate.google.com/#en/pl");

        var sourceTextBox = driver.FindElement(By.Id("source"));
        sourceTextBox.SendKeys("cat");

        driver.FindElement(By.Id("gt-submit")).Click();

        var resultTextBox = driver.FindElement(By.Id("result_box"));

        Assert.AreEqual(resultTextBox.Text, "kot");
    }
}

It is very easy and straightforward approach to this problem. However, it causes that we have to modify each test in a repeated way.

Test for different browser settings

We may make this test strategy more adjustable using TestCaseSource attribute of NUnit library. Create a list of preconfigured web drivers as a source of our contexts. It will be the only place to put logic related drivers creation and selection.

public static IEnumerable<IWebDriver> TestingWebDrivers
{
    get {
        ChromeOptions options = new ChromeOptions();
        options.AddExtensions("/path/to/extension.crx");

        Proxy proxy = new Proxy();
        proxy.HttpProxy = "myhttpproxy:3337";

        var options2 = new ChromeOptions();
        options2.AddAdditionalCapability("proxy", proxy);

        return new IWebDriver[]
        {
            // regular Chrome
            new ChromeDriver(),
            // Chrome with extension
            new ChromeDriver(options),
            // Chrome behind proxy
            new ChromeDriver(options2),

            new FirefoxDriver(),
            new OperaDriver(),
            new SafariDriver()
        };
    }
} 

We defined driver for four different browsers and three drivers for Chrome with different capabilities. You can extend this list as you want, but you should be aware that the more drivers are present on the list, the more time consuming will be test execution.

We can modify our test a bit, using this data source:

[Test, TestCaseSource("TestingWebDrivers")]
public void ShouldTranslateWord(IWebDriver driver)
{
    driver.Navigate().GoToUrl("https://translate.google.com/#en/pl");

    var sourceTextBox = driver.FindElement(By.Id("source"));
    sourceTextBox.SendKeys("cat");

    driver.FindElement(By.Id("gt-submit")).Click();

    var resultTextBox = driver.FindElement(By.Id("result_box"));

    Thread.Sleep(500);

    Assert.AreEqual(resultTextBox.Text, "kot");
}

[Test, TestCaseSource("TestingWebDrivers")]
public void ShouldDoOther(IWebDriver driver)
{
    // ....
}

We just need to add a TestCaseSource attribute to each test method and pass a parameter with IWebDriver implementation. We will be able to use a driver from method parameter and NUnit will take care of the rest.