Avoid Inheriting Super Class Tests in ScalaTest

狂风中的少年 提交于 2019-12-24 05:27:28

问题


I'd like to use test code from another project which has tightly coupled some utility methods along with their tests. I would like to inherit from this class so I'm able to use the utility methods but don't want the accompanying tests. Is there a way to inherit from this other Suite without also registering the tests?

I've tried extending from a replica of the class labeled with the @DoNotDiscover annotation but this doesn't seem to have the desired effect.

I'd also be interested if there was some way of just ignoring all the tests inherited form the parent suite as well.


回答1:


My workaround was to make an instance of the other suite and hold within my test class. Then call the methods from within the other project's instantiated class using my test code.

This required a bit of overriding since I needed to change a few default parameters made in the other class to fit our testing schema but was relatively painless.



来源:https://stackoverflow.com/questions/32385003/avoid-inheriting-super-class-tests-in-scalatest

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!