TESTEROPS

A pragmatic approach to QA and OPS

Protractor

As applications grow in size and complexity, it becomes unrealistic to rely on manual testing to verify the correctness of new features, catch bugs and notice regressions. Unit tests are the first line of defense for catching bugs, but sometimes issues come up with integration between components which can’t be captured in a unit test. End-to-end tests are made to find these problems.

Also with new and significant changes being made in webpage design and how they are rendered to the users, the need to have them tested , for having a perfect product delivered to the end user, you need to have your application tested. Now, new applications now a days are using more and more the power of Javascript, to deliver a seemingly pleasing experience to the customers.

To have these seamless delivery, we need to have our Javascript code tested and Protractor is one of the tools that helps us in achieving this.

What Is Protractor

Protractor is a Node.js program, and runs end-to-end tests that are also written in JavaScript and run with node. Protractor uses WebDriverto control browsers and simulate user actions.

Protractor uses Jasmine for its test syntax. As in unit testing, a test file is comprised of one or more it blocks that describe the requirements of your application. it blocks are made of commands and expectations. Commands tell Protractor to do something with the application such as navigate to a page or click on a button. Expectations tell Protractor to assert something about the application’s state, such as the value of a field or the current URL.

If any expectation within an it block fails, the runner marks the it as “failed” and continues on to the next block.

Test files may also have beforeEach and afterEach blocks, which will be run before or after each it block regardless of whether the block passes or fails.

scenario_runner

In the series of examples and tutorials provided through our blog,we’ll see how we can automate our angular and non angular  websites using Protractor. You can find the code related to this in my github repository

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: