A generate unit test for JHipster generated applications.
Table of Contents
-
Get a compacted JAR's this link.
-
Unzip the JAR's files in root directory of JHipster project.
-
Download and install the JDK 11 this link (if you not configured it in jhipster project yet)
-
Add annotations to methods that you wish generate unit tests.
For example:
public class Example {
@JCodingTime
@Input(firstParam=5, secondParam=5)
@Output(result=25)
public static int multiplyTwoNumbers(int firstParameter, int secondParameter) {
return firstParameter * secondParameter;
}
@JCodingTime
@Input(firstParam=2, secondParam=2)
@Output(result=4)
public static int sumTwoNumbers(int firstParameter, int secondParameter) {
return firstParameter + secondParameter;
}
@JCodingTime
@LimitValue(innerBoundary=0, upperBoundary=130)
public static int setAge(int age) {
return age;
}
}
- At the terminal, run the command below with the relative path of java file you want to test.
java -classpath "JCodingTime.jar:commons-io-2.8.0.jar" jcodingtime.java.Main RELATIVE_PATH_HERE
-
See the file test generate on test folder of your project.
-
Adapts the tests according to the project and its due libraries.
-
Run the tests.
Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Distributed under the MIT License. See LICENSE
for more information.