問題描述
如果 Protractor 正在取代 Angular Scenario Runner 進(jìn)行 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 的當(dāng)前維護(hù)者不推薦:
Not recommended by the current maintainer of Protractor:
https://github.com/angular/protractor/issues/9#issuecomment-19927049
Protractor 和 Karma 不應(yīng)該一起使用;相反,它們?yōu)檫\(yùn)行測試提供了單獨(dú)的系統(tǒng).Protractor 和 Karma 涵蓋了測試的不同方面 - Karma 主要用于單元測試,而 Protractor 應(yīng)該用于端到端測試.
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 構(gòu)建在 WebDriverJS 之上,它使用 Selenium/WebDriver 服務(wù)器來配置瀏覽器和驅(qū)動測試執(zhí)行.可以在這里找到純 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 - 我認(rèn)為將 Protractor 和 Karma 分開是有意義的 - 對于端到端測試,您需要 webdriver 的原生事件驅(qū)動和靈活性,而對于單元測試,您需要快速執(zhí)行和自動查看文件.
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.
這篇關(guān)于Protractor 和 Karma 可以一起使用嗎?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!