gpt4 book ai didi

angularjs - 我应该使用 Protractor 还是 Karma 进行端到端测试?

转载 作者:行者123 更新时间:2023-12-03 04:32:58 26 4
gpt4 key购买 nike

我应该使用 Protractor 还是 Karma 进行端到端测试?

Angular-seed 使用 Protractor/Selenium WebDriver 进行 E2E,但 Angular-phonecat 教程使用 karma。

我读到我应该使用 Karma 进行单元测试,使用 Protractor 进行 E2E,这看起来不错,但我想我应该在这里询问其他开发人员的意见。

最佳答案

AngularJS 团队建议使用 Protractor,因为它将取代 Angular 场景运行器:

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

引自AngularJs documentation .

教程 Angular-phonecat 是很久以前开发的(主要是在 2011 年),尚未更新以使用一些 Angular 新功能,例如 Protractor。

编辑

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 forend to end or integration testing. This means that small tests for thelogic of your individual controllers, directives, and services shouldbe run using Karma. Big tests in which you have a running instance ofyour entire application should be run using Protractor. Protractor isintended to run tests from a user's point of view - if your test couldbe written down as instructions for a human interacting with yourapplication, it should be an end to end test written with Protractor.

Here's a great blog post with more info.

关于angularjs - 我应该使用 Protractor 还是 Karma 进行端到端测试?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21732379/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com