• 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

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.

What is a conf file in Protractor?

The configuration file tells Protractor how to set up the Selenium Server, which tests to run, how to set up the browsers, and which test framework to use. The configuration file can also include one or more global settings. The config file provides explanations for all of the Protractor configuration options. Default settings include the standalone Selenium Server, the Chrome browser, and the Jasmine test framework.

What is Typescript?

TypeScript is a super set of JavaScript compiled to JavaScript. TypeScript is a strongly typed, object oriented, compiled language developed and maintained by Microsoft. TypeScript may be used to develop JavaScript applications for both client-side and server-side (Node.js) execution.

What is Mocha?

Mocha is a JavaScript test framework for Node.js programs, featuring browser support, asynchronous testing, test coverage reports, and use of any assertion library.

What is Jasmine?

Jasmine is an open source testing framework for JavaScript. It aims to run on any JavaScript-enabled platform. It doesn’t require a DOM and it has a clean, obvious syntax so that we can easily write tests.

Why you choose Protractor with Selenium rather than just Selenium when an application is built on Angular or Angular JS?

There is no rule that you must use Protractor when the UI is built with Angular or AngularJS. It depends upon your requirement and team knowledge. Both these tools (Protractor & Selenium) helps us in flawless browser automation.

You can just use plain Selenium for testing Angular applications. Protractor just makes it easier to test Angular application. Protractor is a framework for testing Angular applications.

It has Automatic Waiting for elements and you can access specific Angular elements by.model and by.binding. Also it implements the Page Objects in the framework making tests more maintainable if used correctly.

Some of the points to consider when taking a decision on whether to go with Protractor or not. These points are some of the features of Protractor that make it worthy for testing AngularJS applications.

  • Protractor is a wrapper around WebDriverJS and supports Behavior Driven Development Frameworks such as Jasmine, Cucumber, Mocha etc.
  • Protractor works in conjunction with Selenium. It offers some other new locator strategies that automate the testing of AngularJS applications.
  • Protractor makes use of Selenium Grid to run Multiple browsers at once.
  • Protractor handles the $http or $timeout synchronisation issues arising out of Angular/Angular JS very well.
  • Angular/Angular JS code is written in JavaScript/TypeScript, and Protractor supports both these languages.

How Protractor, Selenium Server, and Selenium WebDriver work together?

Protractor is an end-to-end test framework for AngularJS applications. Protractor is a Node.js program that supports the Jasmine and Mocha test frameworks.

Selenium is a browser automation framework. Selenium includes the Selenium Server, the WebDriver APIs, and the WebDriver browser drivers.

Protractor works in conjunction with Selenium to provide an automated test infrastructure that can simulate a user’s interaction with an Angular application running in a browser or mobile device.

Subscribe to