Should I be using Protractor or Karma for my end-to-end testing? [closed]

北城余情 提交于 2019-12-29 02:21:14

问题


Should I be using Protractor or Karma for my end-to-end testing?

Angular-seed is using Protractor/Selenium WebDriver for E2E but the angular-phonecat tutorial uses karma.

I read that I should use Karma for unit tests and Protractor for E2E, which seems fine but I thought I would ask on here to get other dev's opinions.


回答1:


The AngularJS team recommends using Protractor as it's going to replace angular scenario runner:

Angular Scenario Runner is in maintenance mode - If you're starting a new Angular project, consider using Protractor.

quoted from AngularJs documentation.

The tutorial angular-phonecat was developed a long time ago (in 2011 mainly) and has not yet been updated to use some Angular new features like Protractor.

EDIT

In the Protractor Docs - FAQ:

Why both Karma and Protractor? When do I use which?

Karma is a great tool for unit testing, and Protractor is intended for end to end or integration testing. This means that small tests for the logic of your individual controllers, directives, and services should be run using Karma. Big tests in which you have a running instance of your entire application should be run using Protractor. Protractor is intended to run tests from a user's point of view - if your test could be written down as instructions for a human interacting with your application, it should be an end to end test written with Protractor.

Here's a great blog post with more info.



来源:https://stackoverflow.com/questions/21732379/should-i-be-using-protractor-or-karma-for-my-end-to-end-testing

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!