【发布时间】:2018-11-18 15:19:51
【问题描述】:
我们在管道中运行行为 BDD 测试。作为 jenkins 管道的一部分,我们在 docker 容器中运行测试。目前运行所有测试大约需要 10 分钟。我们正在添加大量测试,几个月后,它可能会长达 30 分钟。它正在输出大量信息。我相信,如果我减少它输出的信息量,我可以让测试运行得更快。有没有办法控制信息行为输出的数量?我只想在出现故障时打印信息。 我看了一下行为并行。看起来它在python 2.7中。我们在python3。 我正在查看各种选项的行为提供。
behave -verbose=false folderName (I assumed that it will not output all the steps)
behave --logging-level=ERROR TQXYQ (I assumed it will print only if there is an error)
behave --logging-filter="Test Step" TQXYQ (I assumed it will print only the tests that has "Test Step" in it)
以上都不起作用。
当前的输出是这样的
Scenario Outline: IsError is populated correctly based on Test Id -- @1.7 # TestName/Test.feature:187
Given the test file folder is set to /TestName/steps/ # common/common_steps.py:22 0.000s
And Service is running # common/common_steps.py:10 0.000s
Given request used is current.json # common/common_steps.py:26 0.000s
And request is modified to set X to q of type str # common/common_steps.py:111 0.000s
And request is modified to set Y to null of type str # common/common_steps.py:111 0.000s
And request is modified to set Z to USD of type str # common/common_steps.py:111 0.000s
When make a modification request # common/common_steps.py:37 0.203s
Then it returns 200 status code # common/common_steps.py:47 0.000s
And transformed result has IsError with 0 of type int # common/common_steps.py:92 0.000s
And transformed result has ErrorMessages contain [] # common/common_steps.py:52 0.000s
我只想在出现错误时打印所有这些内容。如果一切顺利,我不想显示此信息。
【问题讨论】:
-
从输出中可以看出延迟来自请求,而所有其他步骤在一毫秒内完成。所以,不要指望如果减少输出,速度会显着提高。
-
谢谢克劳斯。我还可以在单独的容器中运行测试,看看它是否减少了时间。
标签: python bdd python-behave