将测试套件应用于接口的实现
我有一个存在多个实现的接口。 我正在为界面设置一个测试套件。现在我想为每个具体实现者运行套件中的所有测试类。
澄清一下,我有一个像
- TestSpam.java
- TestEgg.java
- TestBacon.java
这样的设置,它们都在测试我的接口 IBreakfast 的不同方面,我将把它们组织在一个名为 TestBreakfast 的套件中。我希望针对以某种方式指定的特定实现运行所有不同的测试,最好是一次并在套件上运行。
在测试用例级别,我认为我可以使用参数化来运行所有实现,但看起来并没有扩展到套件。而且,当使用参数化时,看起来我必须对实现进行硬编码,这感觉非常倒退。
关于如何进行这项工作有什么想法吗?
I have a interface for which there exists several implementations.
I'm setting up a test suite for the interface. Now I want to run all test classes from the suite for each of the concrete implementors.
to clarify, I have a setup like
- TestSpam.java
- TestEgg.java
- TestBacon.java
which are all testing diffrent aspects of my interface IBreakfast, and I'm going to have them organised in a suite called say TestBreakfast. And I want all the diffrent tests to be run for specific implementation specified somehow, preferably once and on/to the suite.
At the testcase level I think I could use parametrise to run for all implementations, but doesn't look like that extends to suites. And also when using parameterise it looks like I would have to hardcode the implementations which feels horribly backwards.
Any idea on how to make this work?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在这种情况下,我反复采用如下模式:
In this situation, I've repeatedly settled into a pattern like the following: