Skip to content

Generate Unit Test Code from Swagger API for Java REST

I was trying using Swagger test templates and found this an interesting tool to generate the test files for my controllers, but It seems to just work for NodeJs projects, because there is not a similar tool for the Java platform.

Do somebody knows about how to generate these Test files from my controllers by using a swagger file for spring boot projects?

PD:

I have tried with commercial tools like RepreZen and SwaggerHub but they don’t generate the test files for me.

I have also tried by using swagger-generator jar tool to generate those kind of files, but this tool just generate code for Client but no for the Server.

Thx you a lot!.

Answer

Erikson,

While RepreZen API Studio doesn’t currently include a generator template for unit tests, you can write a custom code generator for this purpose, using the built-in tooling and code gen framework.

More info here: http://docs.reprezen.com/#code-gen

If you’d like to collaborate on this, please feel free to get in touch with us.

Ted Epstein, CEO | RepreZen