Karma VS protractor

Karma

Before discussing what Karma is, it is best to discuss what it isn’t. It isn’t a framework to

write tests. It is a test runner. What this means is that Karma gives you the ability to run

tests in several different browsers in an automated way. In the past, developers had to

perform manual steps to do this, including:

1. Opening up a browser

2. Pointing the browser to the project URL

3. Running the tests

4. Confirming that all tests have passed

5. Making changes

6. Refreshing the page

With Karma, automation gives the developer the ability to run a single command and

扫描二维码关注公众号,回复: 633654 查看本文章

determine whether an entire test suite has passed or failed. From a TDD perspective, this

gives you the ability to find and fix failing tests quickly. Some of the pros and cons of

using Karma compared to a manual process are as follows:

pros cons
Ability to automate tests in multiple browsers and devices. Additional tool to learn, configure, and maintain
Ability to watch files.  
Online documentation and support.  
Does one thing---runs JavaScript tests---and does it well.  
Easy to integrate with a continuous integration server.  

Protractor

Protractor is an end-to-end testing tool. It allows developers to mimic user interactions. It

automates the testing of functionality and features through the interaction of a web

browser. Protractor has specific methods to assist with testing AngularJS, but they are not

exclusive to AngularJS. Some of the pros and cons of using Protractor are as follows:

Pro cons
Configurable to test multiple environments Documentation and exampes are limited.
Easy integration with AngularJS.  
Syntax and testing can be similar to the testing framework chosen for unite testing.  

猜你喜欢

转载自huangcaiyan.iteye.com/blog/2300863