[英]Organizing minitest integration tests
So I'm using Minitest to do integration tests. 因此,我正在使用Minitest进行集成测试。 I would like to have some rspec-like context function, so I divided my tests into different files.
我想要一些类似于rspec的上下文函数,因此我将测试分为不同的文件。 Since I want to test EventsController, all my files started as this:
由于我要测试EventsController,因此我的所有文件都是这样启动的:
class EventsControllerTest < ActionController::TestCase
when I try to run a directory of file, the setup
methods of these classes were overwritten since they are all redefining the same class and I couldn't have the methods in different files with the same name. 当我尝试运行文件目录时,这些类的
setup
方法被覆盖,因为它们都重新定义了相同的类,并且我无法在名称相同的不同文件中使用这些方法。 What's the proper way to split all these tests? 拆分所有这些测试的正确方法是什么? Thanks.
谢谢。
Found it in the docs. 在文档中找到它。 Name the test class differently, and use
tests EventsController
to manually set the target controller. 以不同的方式命名测试类,然后使用
tests EventsController
手动设置目标控制器。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.