Protractor 和 Karma 可以一起使用吗?

如果 Protractor 正在取代 Angular Scenario Runner 进行 E2E 测试,这是否意味着我仍然可以将它与 Karma 作为我的端到端测试框架?

If Protractor is replacing Angular Scenario Runner for E2E testing, does that mean I will still be able to use it with Karma as my E2E testing framework ?

推荐答案

Protractor 的当前维护者不推荐:

Not recommended by the current maintainer of Protractor:

https://github.com/angular/protractor/issues/9#issuecomment-19927049

Protractor 和 Karma 不应该一起使用;相反,它们为运行测试提供了单独的系统.Protractor 和 Karma 涵盖了测试的不同方面 - Karma 主要用于单元测试,而 Protractor 应该用于端到端测试.

Protractor and Karma should not be used together; instead they provide separate systems for running tests. Protractor and Karma cover different aspects of testing - Karma is intended mostly for unit tests, while Protractor should be used for end to end testing.

Protractor 构建在 WebDriverJS 之上,它使用 Selenium/WebDriver 服务器来配置浏览器和驱动测试执行.可以在这里找到纯 WebDriverJS 的示例:http://code.google.com/p/selenium/wiki/WebDriverJs

Protractor is built on top of WebDriverJS, which uses a Selenium/WebDriver server to provision browsers and drive test execution. Examples of pure WebDriverJS can be found here: http://code.google.com/p/selenium/wiki/WebDriverJs

https://github.com/angular/protractor/issues/9#issuecomment-19931154

Georgios - 我认为将 Protractor 和 Karma 分开是有意义的 - 对于端到端测试,您需要 webdriver 的原生事件驱动和灵活性,而对于单元测试,您需要快速执行和自动查看文件.

Georgios - I think it makes sense to keep Protractor and Karma separate - for end to end tests, you want the native event driving and flexibility of webdriver, while for unit tests you want fast execution and autowatching of files.

相关文章