Angular test methods Jasmine vs karma vs protractor in Angular 2?

I am new to angular testing. Can someone tell me about the difference between the three methods?

+18
source share
3 answers

Jasmine is a behavior-based development environment for testing JavaScript code. It does not depend on other JavaScript frameworks. This does not require a DOM. And it has clean, obvious syntax, so you can write tests easily.

In essence, Karma is a testing tool that spawns a web server that runs source code compared to test code for each of the connected browsers. The results of each test for each browser are checked and displayed on the command line for the developer so that they can see which browsers and tests passed or failed.

Jasmine and Karma are commonly used together to perform unit testing or integration testing.

Protractor is a comprehensive test environment for Angular and AngularJS applications. Protractor runs tests for your application running in a real browser, interacting with it as a user, regardless of other tools that do the same. Check out how it works here .

Recommendations:

Jasmine Documentation

Karma - How does it work?

Protractor

+25
source

Karma is a test runner, like grunts and jasmine gulp - the basis of BDD for testing

You can write expectations, that is, tests in jasmine, and run it with karma.

A protractor does this for you too.

+6
source

The protractor is a wrapper of Selena, it is not the test frame itself. Protractor includes Jasmine, see Conf.js on the official page

exports.config = { framework: 'jasmine', seleniumAddress: 'http://localhost:4444/wd/hub', specs: ['spec.js'] } 
+4
source

Source: https://habr.com/ru/post/1271761/


All Articles