代码之家  ›  专栏  ›  技术社区  ›  Andrew Grimm atk

如何手动指定要在自动测试中运行的测试文件?

  •  2
  • Andrew Grimm atk  · 技术社区  · 15 年前

    如何手动指定非测试文件更新时应运行哪些测试/单元测试文件?

    2 回复  |  直到 15 年前
        1
  •  3
  •   Priit    15 年前

    可以在中创建自定义映射 ~/.autotest <project_path>/.autotest 文件如下:

    Autotest.add_hook :initialize do |at|
      at.add_mapping(/lib\/foo\/(.*).rb/, true) do |filename, matchdata|
        ["spec/lib/foo/#{matchdata[1]}_spec.rb"]
      end
    end
    

    这与中的规格相匹配 spec/lib/foo 目录到 lib/foo 文件,所以这些规范将在 磅/英尺 正在更改。我想你也可以这么做 test 目录。

        2
  •  0
  •   Andrew Grimm atk    15 年前

    重新定义 Autotest#test_files_for(filename) 返回测试文件名的字符串数组。

    一些教程参考 tests_for_file 但这是方法的旧名称:它是 changed in ZenTest 3.9.0 test_files_for .

    同样,重新定义 tests_files_for 没用。