欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Karma VS protractor

程序员文章站 2022-05-02 19:02:00
...

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

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.