weirddev

Open full view…

How to stop test method generation of inherited class

subodh
Fri, 15 Sep 2017 17:04:25 GMT

When I have generated test class using plugin, I am getting lots of etc method which are not part of original class. What is logic to generate extra methods and how to stop them? Can I make change at my end?

Yaron
Sat, 16 Sep 2017 15:17:43 GMT

On some use cases it's desirable to test inherited, accessible methods. Tests are being generated for inherited methods since it's usually easier to remove unwanted test methods from the generated test class rather than hand code these tests (or at least the boilerplate part of these tests). I think that giving the user the option to opt out of generating tests for inherited methods is an important feature. I'm not sure if I can push it in the up coming release, but I'll give it a high priority for the next releases. Thanks for raising this feature request. Tests will be generated for accessible methods, so if by design, it's possible for you to change the method access modifier ( i.e. private ) then that would do the trick.

Yaron
Thu, 23 Aug 2018 17:09:35 GMT

@subodh, support of disabling test generation for inherited methods has just been added in latest plugin release - 2.0.0 - published today. This option is configurable from IJ Settings menu - http://weirddev.com/testme/settings/. Sorry it took so long to deliver this feature :)