• 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

What is an ElementArrayFinder?

ElementArrayFinder is used for operations on an array of elements. The ElementArrayFinder is used to set up a chain of conditions that identify an array of elements. In particular, you can call all (locator) and filter (filterFn) to return a new ElementArrayFinder modified by the conditions, and you can call get (index) to return a single ElementFinder at position ‘index’.

Similar to JQuery, ElementArrayFinder will search all branches of the DOM to find the elements that satisfy the conditions (i.e. all, filter, get). However, an ElementArrayFinder will not actually retrieve the elements until an action is called, which means it can be set up in helper files (i.e. page objects) before the page is available, and reused as the page changes.

What is ElementFinder in Protractor?

The ElementFinder simply represents a single element of an ElementArrayFinder (and is more like a convenience object). As a result, anything that can be done with an ElementFinder, can also be done using an ElementArrayFinder.

The ElementFinder can be treated as a WebElement for most purposes, in particular, you may perform actions (i.e. click, getText) on them as you would a WebElement. Once an action is performed on an ElementFinder, the latest result from the chain can be accessed using the then method. Unlike a WebElement, an ElementFinder will wait for angular to settle before performing finds or actions.

ElementFinder can be used to build a chain of locators that is used to find an element. An ElementFinder does not actually attempt to find the element until an action is called, which means they can be set up in helper files before the page is available.
element(by.locator(“locator value”))

How we calculate Defect Leakage in Software Testing?

Assume,

CD = No. of Defects raise by customer after release
DR = No. of Defects raised by Tester before release
ID =  No. of invalid Defects from Defects raised by tester before release(Eg. Duplicate, CannotFix, error in test environment etc.)

Formula to calculate Defect Leakage:

Defect Leakage = [CD / (DR - ID)] * 100

For Example:

If after release client found 9 defects, during the test, tester reported 201 defects and from these 20 defects were invalid, Then,

Defect Leakage = [ 9 / 201 - 20] * 100 = 4.9%

What is Defect Leakage?

After the delivery of application or product or after the release, if end user or Customer find any defect by using that application then it is called defect leakage, it is also called bug leakage.

In short, defect leakage is a metric that measures the percentage of defects leaked from the current testing stage to the subsequent stage as well as proves the effectiveness of testing executed by software testers.

How to add custom locator for Protractor?

By using addLocator method. Add a locator to this instance of ProtractorBy. This locator can then be used with element(by.locatorName(args)).

Example:

// Add the custom locator.
by.addLocator('buttonTxt', function(buttonTxt, opt_parent, opt_rootSelector) {
});

What are the locators in Protractor?

Protractor supports all the element location strategies given by Selenium and it also has unique set of locators particularly to identify elements based on AngularJS attributes.

Selenium locators:

  • className
  • css
  • id
  • linkText
  • name
  • partialLinkText
  • tagName
  • xpath

Angular Specific Locators:

  • binding
  • exactBinding
  • model
  • repeater
  • exactRepeater
  • options

Other element locator’s introduced in Protractor:

  • buttonText
  • paritalButtonText
  • cssContainingText
  • deepCss

What is the use of directConnect in Protractor?

Protractor can test directly against Chrome and Firefox without using a Selenium Server. To use this, in your config file set directConnect: true.

directConnect: true – Your test script communicates directly Chrome Driver or Firefox Driver, bypassing any Selenium Server. If this is true, settings for seleniumAddress and seleniumServerJar will be ignored. If you attempt to use a browser other than Chrome or Firefox an error will be thrown.

The advantage of directly connecting to browser drivers is that your test scripts may start up and run faster.

How to exclude a spec file in Protractor?

You can exclude the spec's by adding them in the exclude tag in your conf.js file. You can also add patterns to exclude many test scripts with similar names.

Sometimes we may face a situation of running only few tests out of all. In this case, we use exclude tag in our conf.js file to run only few tests. Say we want to exclude test name "myTest.js", then we need to add this in conf.js

exclude: [myTest.js]

What is a spec file in Protractor?

Spec file is the one where we write actual test code. It contains the logic and locators to interact with an application. It contains describe (Test Suite) and it (Test Case/Scripts).

This file is more like a Feature file in Cucumber and Class file in Java.

Subscribe to