Reputation: 1065
I'm new to unit testing.
I have a existing maven based project, now my management has asked me to create unit test for all the classes.
So is there any way to automatically generate test classes based on my src package structure.
What I mean is rather than manually replicating the package structure is it possible to automatically generate Test classes.
For instance, if I have com.company.HelloWorld in src folder can it automatically generate com.company.HelloWorldTest in test folder.
Note: actually I do not want the code to be generated automatically just wanted the package structure and test classes to be created within which I can write my own code.
Upvotes: 3
Views: 1851
Reputation: 115328
I do not know a way to create unit tests automatically. Actually it is almost impossible. Unit test is a class, i.e. code that is typically written by human.
You want to create templates for unit tests. But if you do this automatically they will be empty and there is no way then to prevent you from running empty test cases and be happy that all tests succeed.
So, taking in consideration that you have a tiny project (45 classes) I'd recommend you to create your tests manually. You can however use Eclipse plugin that helps you to create empty test case in correct package.
Upvotes: 1