Features

Feature list

  • Auto generate Java or Groovy test class
  • Generate Mocks for tested class’s non-primitive fields
  • Support Mockito as a Mock framework
  • Support JUnit4, JUnit5, TestNG & Spock frameworks
  • Generate Test methods for each accessible non-private method, excluding setters/getters
  • Generate default input parameters for tested methods
  • Generate test result assertion expression
  • Supported target tested class language: Java , Groovy.

Test parameters generation

Default values are auto generated for the tested methods parameters. Currently, this behaviour is not configurable. Groovy tests generators are more robust in a sense that map constructors can be used (when applicable) to initialize objects with setters inline. This is not supported yet for Java test generators, since assignment to local variables for initialization of test parameters complicates the test generation template. Personally, I would always recommend preferring Groovy over Java when it comes to unit testing. If you haven’t transitioned yet to Groovy as your test code language of choice - now is a good time start :)

Tip: Generated test method call line can get very long depending on the depth level of nested objects passed to the tested method. Set the max line limit in IntelliJ Code Style configuration: Preferences (Ctrl+Shift+S) -> Editor -> Code Style -> Java or Groovy -> set Right margin (columns) and check Ensure right margin is not exceeded. Please note these settings will effect not just the test code generation. Currently its not possible to control the max line length for generated test code only.

TestMe motto and current shortcomings

TestMe IJ Plugin aims at generating as much Unit Test boilerplate as possible. The project still lacks some maturity level. You can further read about those dilemmas in this blog post

Sumbit a new Future Request on the project forum

Updated: