在角单元测试

在角单元测试

问题描述:

据我了解方案的领先者是德precated。所以,现在您将运行在噶单元测试和量角器端到端测试。

As I understand Scenario-runner is deprecated. So now you will run your unit tests in Karma and e2e test in Protractor.

有关我的感觉错了,为你运行单元测试启动浏览器(因缘)。是我的假设是否正确?你怎么测试你的应用程序的角度?

For me it feels wrong to start a browser(karma) for running you unit tests. Are my assumptions correct? How do you test your Angular applications?

一个相当好的实践标准的时候才来测试角度是使用phantomjs无头浏览器做单元测试。你看它的任何方式,你需要一个JavaScript引擎启动并运行之前,你可以测试一下。然而,使用无头浏览器是快了很多,因为没有用户界面。

A fairly well practised standard when it come to testing angular is to use phantomjs a headless browser to do the unit testing. Whatever way you look at it you need a javascript engine up and running before you can test. However, using a headless browser is a lot quicker as there is no UI.

我用噶,薛宝钗和兴农(用于嘲讽) - 我的开发工作流使用phantomjs,然后我的CI和发布版本使用的浏览器实际IE,铬等我也用BrowserStack当CI构建运行

I use Karma, chai and sinon (for mocking) - my dev workflow uses phantomjs and then my CI and release builds use actual browsers IE, Chrome etc I also use BrowserStack when CI builds run.

您可以看到测试的例子,业力配置的这里

You can see an example of the tests and the karma config here

您可能会想看看咕噜/一饮而尽,以实际管理测试的过程。

You will probably want to look at grunt / gulp to actually manage the process of testing.

任何你特别是围绕后测试?

Anything you were after in particular around testing?