并行执行测试时,很难读取控制台日志和Karate.log文件,因为服务调用和响应没有一起记录

并行执行测试时,很难读取控制台日志和Karate.log文件,因为服务调用和响应没有一起记录,karate,Karate,我使用平行流道作为: 如果我运行3个线程,那么上述3个场景将一起执行。因此控制台日志和karate.log文件将以以下方式打印: 14:22:00:962 com.intuit.karate - request: 1>url: xyz/abc/efg.json 1>id= 1 1>accept-encoding: gzip,deflate 1>connection: keep-alive 1>Host: sgldter 14:22:00:962 com.intui

我使用平行流道作为:

如果我运行3个线程,那么上述3个场景将一起执行。因此控制台日志和karate.log文件将以以下方式打印:

14:22:00:962 com.intuit.karate - request:
1>url: xyz/abc/efg.json
1>id= 1
1>accept-encoding: gzip,deflate
1>connection: keep-alive
1>Host: sgldter

14:22:00:962 com.intuit.karate - request:
2>url: xyz/abc/efg.json
2>id= 2
2>accept-encoding: gzip,deflate
2>connection: keep-alive
2>Host: sgldter

14:22:00:962 com.intuit.karate - request:
3>url: xyz/abc/efg.json
3>id= 3
3>accept-encoding: gzip,deflate
3>connection: keep-alive
3>Host: sgldter


14:23:10:962 [main] Debug com.intuit.karate - response in milliseconds :220

1>200
1>cache-control: no-cache
1>connection: keep-alive
{"id"="1"}

14:23:12:962 [main] Debug com.intuit.karate - response in milliseconds :230

3>200
3>cache-control: no-cache
3>connection: keep-alive
{"id"="3"}

14:23:13:962 [main] Debug com.intuit.karate - response in milliseconds :240

2>200
2>cache-control: no-cache
2>connection: keep-alive
{"id"="2"}
所有3个请求将首先记录在控制台中,然后记录所有3个响应。因此,现在想知道是否可以将1的请求和1的响应一起记录?因为在运行多个测试(如1000+测试)时,如果请求和响应彼此分离,那么读取日志就会变得困难

像下面这样的东西就好了

14:22:00:962 com.intuit.karate - request:
1>url: xyz/abc/efg.json
1>id= 1
1>accept-encoding: gzip,deflate
1>connection: keep-alive
1>Host: sgldter

14:23:10:962 [main] Debug com.intuit.karate - response in milliseconds :220

1>200
1>cache-control: no-cache
1>connection: keep-alive
{"id"="1"}

14:22:00:962 com.intuit.karate - request:
2>url: xyz/abc/efg.json
2>id= 2
2>accept-encoding: gzip,deflate
2>connection: keep-alive
2>Host: sgldter

14:23:13:962 [main] Debug com.intuit.karate - response in milliseconds :240

2>200
2>cache-control: no-cache
2>connection: keep-alive
{"id"="2"}


14:22:00:962 com.intuit.karate - request:
3>url: xyz/abc/efg.json
3>id= 3
3>accept-encoding: gzip,deflate
3>connection: keep-alive
3>Host: sgldter

14:23:12:962 [main] Debug com.intuit.karate - response in milliseconds :230

3>200
3>cache-control: no-cache
3>connection: keep-alive
{"id"="3"}
同样,我知道空手道报告和cucumber报告正确地给出/显示了这一点,并且非常方便,但有时开发人员更喜欢在CI/CD中引用构建日志,因此很难从日志中理解失败。 让我知道是否有一些配置我可以在logback xml或log4j文件中更改,以便将其合并在一起并打印到控制台日志中

同样,我知道空手道报告和黄瓜报告正确地给出/显示了这一点,并且非常方便


没有理由不使用HTML报告。很抱歉,日志是这样的-您将看到多个线程合并为一个线程。如果你知道如何让它按你期望的方式工作,欢迎你贡献代码,空手道是一个开源项目。

是的,HTML报告肯定会有帮助。但当每次在inteij或任何IDE中运行测试以打开和查看HTML报告时,我会说这并不理想。但是,是的,我同意你的观点,那就是不一定要有分类良好的日志,但拥有它绝对是件好事。此外,我不是这方面的专家,因此无法对此做出贡献。
14:22:00:962 com.intuit.karate - request:
1>url: xyz/abc/efg.json
1>id= 1
1>accept-encoding: gzip,deflate
1>connection: keep-alive
1>Host: sgldter

14:23:10:962 [main] Debug com.intuit.karate - response in milliseconds :220

1>200
1>cache-control: no-cache
1>connection: keep-alive
{"id"="1"}

14:22:00:962 com.intuit.karate - request:
2>url: xyz/abc/efg.json
2>id= 2
2>accept-encoding: gzip,deflate
2>connection: keep-alive
2>Host: sgldter

14:23:13:962 [main] Debug com.intuit.karate - response in milliseconds :240

2>200
2>cache-control: no-cache
2>connection: keep-alive
{"id"="2"}


14:22:00:962 com.intuit.karate - request:
3>url: xyz/abc/efg.json
3>id= 3
3>accept-encoding: gzip,deflate
3>connection: keep-alive
3>Host: sgldter

14:23:12:962 [main] Debug com.intuit.karate - response in milliseconds :230

3>200
3>cache-control: no-cache
3>connection: keep-alive
{"id"="3"}