在浏览器上显示业力测试

时间:2015-02-21 04:22:55

标签: angularjs unit-testing karma-runner karma-jasmine

我是业力单位测试角度的新手。我测试了angular-socket-io应用程序。这就是我在控制台上运行业力开始时所看到的。

21:58 /tmp/angular-socket-io $ karma start
INFO [karma]: Karma v0.10.10 server started at http://localhost:9999/
INFO [launcher]: Starting browser Chrome
INFO [Chrome 40.0.2214 (Mac OS X 10.8.3)]: Connected on socket AOee3c4IW51Z30jfShdU
Chrome 40.0.2214 (Mac OS X 10.8.3): Executed 18 of 18 SUCCESS (4.393 secs / 0.083 secs)
INFO [Chrome 40.0.2214 (Mac OS X 10.8.3)]: Connected on socket IMCGlDXZwhJJ8Y6YShdV
Chrome 40.0.2214 (Mac OS X 10.8.3): Executed 18 of 18 SUCCESS (0.159 secs / 0.09 secs)
Chrome 40.0.2214 (Mac OS X 10.8.3): Executed 18 of 18 SUCCESS (0.249 secs / 0.093 secs)
TOTAL: 36 SUCCESS

我希望看到Chrome浏览器上列出的所有测试。这可能吗?

1 个答案:

答案 0 :(得分:1)

如果您愿意打开Karma为您生成的HTML报告,请查看karma-html-reporter。只需将其添加到您的Karma配置中的记者列表中:

{
  // much more before this

  reporters: ['progress', 'html'],

  // the default configuration
  htmlReporter: {
    outputDir: 'karma_html', // where to put the reports 
    templatePath: null, // set if you moved jasmine_template.html
    focusOnFailures: true, // reports show failures on start
    namedFiles: false, // name files instead of creating sub-directories
    pageTitle: null, // page title for reports; browser info by default
    urlFriendlyName: false // simply replaces spaces with _ for files/dirs

    // experimental
    preserveDescribeNesting: false, // folded suites stay folded 
    foldAll: false, // reports start folded (only with preserveDescribeNesting)
  }

  // much more after this
}