MBUnit - 按顺序多次调用同一方法?
MBUnit 中是否有一种方法可以使用序列中的不同参数多次调用相同的测试,例如:
Method1() 方法2(参数A) 方法3() 方法2(参数B) 方法4() Method2(ParamC)
等?我尝试过使用 Order 参数,但遗憾的是我太有希望了,因为 Ordering 将被视为类范围而不是测试范围(1,2,3,4,5,6 而不是 1,2a,2b, 2c,3,4)。
Is there a way in MBUnit to have the same test called multiple times with different parameters in a sequence, as such:
Method1()
Method2(param A)
Method3()
Method2(ParamB)
Method4()
Method2(ParamC)
etc? I've tried using the Order parameter but sadly I was too hopeful in that the Ordering would be considered class-wide rather than test-wide (1,2,3,4,5,6 as opposed to 1,2a,2b,2c,3,4).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您能解释一下需要这个的原因吗?这听起来像是测试方法之间存在依赖关系,这通常不是编写测试代码的好方法。
如果您需要以特定顺序调用某些内容,那么为什么不简单地将其公开为单个测试方法,该方法按照您选择的顺序调用某些子方法呢?
Can you explain the reasons for needing this? This sounds like you have dependencies between your test methods, which in general isn't a good way to go about writing test code.
If you need something to be called in a particular sequence then why not simply expose it as a single test method which calls certain submethods in the order of your choosing?