2013-03-24 63 views
0

编辑 - 我正在改写问题RoR - 在测试用例管理系统中添加TestRun

不再需要嵌套路由的答案。

我已创建一个测试用例管理系统具有以下资源 项目 - >有许多套房 - >有很多测试用例

我想补充试运行的新特性/功能。对于每一个版本,我想做一个新的testrun,其中我将只包括选定的套件/测试用例。

流量将是这样的: 点击创建 - 新testrun 选择(从下拉菜单或复选框) - 这需要对当前版本 要运行,然后从这些套房选择测试用例

如何去套房关于它?我应该创建一个新的资源testrun?然后我如何每次向它添加套件?

感谢以前和未来的答案

回答

0

所以我自己找到了答案。我使用一个连接表,虽然 - 的has_many:通过 我创建一个新的能叫测试结果,这里是协会如何去

class Testcase < ActiveRecord::Base 
    has_many :testresults 
    has_many :testruns, :through => :testresults 


class Testrun < ActiveRecord::Base 
    has_many :testresults 
    has_many :testcases, :through => :testresults 


class Testresult < ActiveRecord::Base 
    belongs_to :testrun 
    belongs_to :testcase 

我需要弄清楚的事情是如何插入的结果在TestResult中现在的桌子