mardi 29 septembre 2015

E2E testing: Karma+JQuery vs Protractor

Question

In terms of e2e testing, what can't we do with Karma and JQuery that is possible with Protractor?

Explanation

I'm currently building a testing framework for my JavaScript application. I'm using Karma for Unit Testing and Protractor for E2E Testing as suggested by many people.

I'm aware of the conceptual differences between unit testing and e2e testing, but, in the context of JavaScript, I don't clearly understand why we need framework like Protractor.

As far as I know, the point of e2e testing is to use the application as a simple end-user. For that, tools like Protractor use a webdriver to interact with a browser and let us simulate some user events (clicking on element, filling forms...).

The thing is, why can't we simply do this by using Karma and JQuery?

Indeed, JQuery comes with lots of methods to interact with a DOM element (trigger event, get/set element's property, set value to an input...). Furthermore, it provides selectors which make the selection of DOM element very easy.

From my point of view, Karma and JQuery has (almost) everything needed for e2e testing (if we don't take care of the browser's window's operations available in Protractor which enable for example to set the window size or location).

I'm obviously missing something, any clarification will be helpful.

Aucun commentaire:

Enregistrer un commentaire