"Karma-How It Works"Karma怎么运行

来源:互联网 发布:淘客用什么软件 编辑:程序博客网 时间:2024/05/20 08:27

翻译地址:http://karma-runner.github.io/0.12/intro/how-it-works.html

Karma is essentially a tool which spawns a web server that executes source code against test code for each of the browsers connected. The results for each test against each browser are examined and displayed via the command line to the developer such that they can see which browsers and tests passed or failed.

Karma本质上是一个在各种浏览器运行测试代码的工具,各种浏览器会运行和展示测试的结果例如通过还是不通过。

A browser can be captured either

  • manually, by visiting the URL where the Karma server is listening (typically http://localhost:9876/),
  • 通过手动访问Karma服务器监听的URL(通常是 http://localhost:9876/
  • or automatically by letting Karma know which browsers to start when Karma is run (see browsers).
  • 或者当Karma运行时自动让Karma识别那个浏览器已经运行

Karma also watches all the files, specified within the configuration file, and whenever any file changes, it triggers the test run by sending a signal to the testing server to inform all of the captured browsers to run the test code again. Each browser then loads the source files inside an IFrame, executes the tests and reports the results back to the server.

Karma也监听所有文件,配置文件中指定的,每当任何文件更改时,它都会通过信息触发测试用例到测试服务器上的浏览器运行,每个浏览器通过里面的IFrame加载资源文件,执行测试并返回报告。

The server collects the results from all of the captured browsers and presents them to the developer.

服务器收集从服务器返回的所有结果并将其反馈给开发者。

This is only a very brief overview, as the internals of how Karma works aren't entirely necessary when using Karma.

这只是简短的描述,用Karma时,内部具体是怎么操作的并不十分需要关心

However, if you are interested in learning more, Karma itself originates from a university thesis, which goes into detail about the design and implementation, and it is available to read right here.

但你如果想了解更多,可以访问下面链接。

0 0
原创粉丝点击