[英]How do I force Goland to run tests every time?
如果自上次在 Goland 2018.3 中运行测试套件后没有进行任何代码更改,并且上次测试运行成功完成,Goland 只会吐出最后一组结果,而不是实际执行代码。 作为演示的一部分,我需要能够按需运行测试,而不必每次都进行细微的代码更改以使其配合使用。 使用 Testify 进行断言,不确定这是否与我所看到的问题有关。
这与 Go 1.10+ 对测试的缓存支持有关。 您可以在此处阅读更多相关信息。
如果你想在 Go 中禁用缓存支持,你应该运行带有-count=1
标志的测试命令。 要通过 GoLand 执行相同操作,请转到Run | Edit Configurations... | Go Test | <name of your test configuration> | Go tool arguments
Run | Edit Configurations... | Go Test | <name of your test configuration> | Go tool arguments
Run | Edit Configurations... | Go Test | <name of your test configuration> | Go tool arguments
并在那里添加-count=1
作为参数,然后再次运行配置。
如果您想为所有未来生成的运行配置禁用此功能,请按照与上述相同的步骤操作,但转到Edit Configurations... | Default | Go Test
Edit Configurations... | Default | Go Test
Edit Configurations... | Default | Go Test
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.