Karate 当通过命令行运行时,有没有方法输出漂亮的报告?

Karate 当通过命令行运行时,有没有方法输出漂亮的报告?,karate,Karate,当通过命令行运行空手道时,有没有方法输出漂亮的报告 运行此: java -jar karate-0.9.1.jar tests/*.feature 产生以下结果: 15:32:56.363 [main] INFO com.intuit.karate.netty.Main - Karate version: 0.9.1 15:32:56.466 [main] INFO com.intuit.karate.Runner - Karate version: 0.9.1 15:32:56.86

当通过命令行运行空手道时,有没有方法输出漂亮的报告

运行此:

java -jar karate-0.9.1.jar tests/*.feature
产生以下结果:

15:32:56.363 [main] INFO  com.intuit.karate.netty.Main - Karate 
version: 0.9.1
15:32:56.466 [main] INFO  com.intuit.karate.Runner - Karate version: 
0.9.1
15:32:56.868 [ForkJoinPool-1-worker-1] WARN  com.intuit.karate - 
skipping bootstrap configuration: could not find or read file: 
classpath:karate-config.js
15:32:57.065 [ForkJoinPool-1-worker-1] DEBUG com.intuit.karate - 
request:
1 > GET http://localhost:8080/ping
1 > Accept-Encoding: gzip,deflate
1 > Connection: Keep-Alive
1 > Host: localhost:8080
1 > User-Agent: Apache-HttpClient/4.5.5 (Java/1.8.0_191)

15:32:57.114 [ForkJoinPool-1-worker-1] DEBUG com.intuit.karate - 
response time in milliseconds: 47.35
1 < 200
1 < Content-Length: 18
1 < Content-Type: application/json; charset=utf-8
1 < Date: Wed, 16 Jan 2019 15:32:57 GMT
1 < X-Request-Id: ffa3630d-19a3-11e9-bbab-0242ac180007
{"message":"pong"}

15:32:57.138 [ForkJoinPool-1-worker-1] ERROR com.intuit.karate - 
assertion failed: path: $.message, actual: 'pong', expected: 
'pong2', reason: not equal
15:32:57.163 [ForkJoinPool-1-worker-1] INFO  
com.intuit.karate.Runner - <<fail>> feature 1 of 1: 
tests/ping.feature
---------------------------------------------------------
feature: tests/ping.feature
report: target/tests.ping.json
scenarios:  1 | passed:  0 | failed:  1 | time: 0.2609
---------------------------------------------------------
Karate version: 0.9.1
======================================================
elapsed:   0.70 | threads:    1 | thread time: 0.26
features:     1 | ignored:    0 | efficiency: 0.37
scenarios:    1 | passed:     0 | failed: 1
======================================================
failed features:
tests.ping: ping.feature:8 - path: $.message, actual: 'pong', 
expected: 'pong2', reason: not equal

Exception in thread "main" picocli.CommandLine$ExecutionException: 
there are test failures
    at 
com.intuit.karate.netty.Main$1.handleExecutionException 
(Main.java:118)
    at picocli.CommandLine.parseWithHandlers(CommandLine.java:1157)
    at com.intuit.karate.netty.Main.main(Main.java:124)

测试运行:2,失败:0,错误:2,跳过:0,运行时间:6.165秒以下是我的建议,如果您真的觉得需要更干净的报告,请编写一个小实用程序,它将处理
目标/html报告
文件夹中的所有
*.json
文件All您要求的信息-偶数行号包含在这些JSON文件中

您可以使用此功能请求作为参考-我们添加了一个JSON文件,以“自动化友好”的方式输出统计数据:


由于到目前为止,只有您提出了这一要求,我们不太可能接受这一要求——除非我们得到某种形式的社区捐款。希望这是有意义的。

作为空手道的作者,我完全同意;)你提供的例子看起来与我看到的完全不同,我同意这是非常干净的。我如何实现与你类似的目标?感觉好像日志记录级别设置为调试或其他。我也不知道为什么失败的测试会打印一个Java异常,而不是告诉我测试失败,有什么想法吗?@MarkNewman但如果你仔细看一下,文件名和行号就在那里,甚至reason@MarkNewman也许我们可以隐藏额外的堆栈跟踪。所以,如果你提供了一种复制的方法,你可以看看,这真的很有用,谢谢。哦,谢谢你创造了这么好的工具!
Feature: 

  Scenario: 
      Before hook
    Given this step passes
      AfterStep hook
      After hook
      error (RuntimeError)
      ./features/step_definitions/output_steps.rb:11:in `After'

Failing Scenarios:
cucumber features/test.feature:2

1 scenario (1 failed)
1 step (1 passed)
     Tests run: 2, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 6.165 sec <<< FAILURE!
[1:6] get all characters([getAllPeople])  Time elapsed: 0.007 sec  <<< ERROR!
com.intuit.karate.exception.KarateException: getAllPeople.feature:12 - path: $[0].birth_year, actual: '19BBY', expected: '#number', reason: not a number
    at ✽.And match each $.results[*] == char (getAllPeople.feature:12)

[1:6] get the first character([getFirstCharacter])  Time elapsed: 0.001 sec  <<< ERROR!
com.intuit.karate.exception.KarateException: getFirstCharacter.feature:12 - path: $.birth_year, actual: '19BBY', expected: '19BB', reason: not equal
    at ✽.And match $ == firstChar (getFirstCharacter.feature:12)


Results :

Tests in error: 
  [1:6] get all characters([getAllPeople]): getAllPeople.feature:12 - path: $[0].birth_year, actual: '19BBY', expected: '#number', reason: not a number
  [1:6] get the first character([getFirstCharacter]): getFirstCharacter.feature:12 - path: $.birth_year, actual: '19BBY', expected: '19BB', reason: not equal

Tests run: 2, Failures: 0, Errors: 2, Skipped: 0

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 7.588 s
[INFO] Finished at: 2019-01-16T17:05:13+01:00
[INFO] Final Memory: 19M/237M