How do I test and evaluate test cases against my application code?

One way to check is different test Cases is to go to the particular test file and run/debug a test,

As shown in the below image.

You can Run Test/Debug Test and according to that, a Java Test Runner Report is generated.

Another way to check all the test cases is to write this command in the terminal.

./gradlew test

The test task automatically detects and executes all unit tests in the test source set. It also generates a report once test execution is complete.

The Test Task detects which classes are test classes by inspecting the compiled test classes.

If you want to check the particular test in the command line you can type.

For example in module 1:

You can give the following test function as :

./gradlew test --tests PortfolioManagerApplicationTest.mainReadFile

Where PortfolioManagerApplicationTest is your test file and mainReadFile your respective test function

The General Format for a test using gradlew is:

./gradlew test --tests TestFileName.TestFunctionName

For the above test case, if it fails, you can refer to the HTML file that is generated in the stack Trace to analyze the result.

You can open the browser preview (search for the Beaker Icon that is attached in the left panel) to display the results of the respective test.

Paste the HTML file path in the URL.

The above HTML file displays the results of the test.

Click on the Respective function to check the stack trace.

From this, you can have an Idea as to what your error is and where it occurs.

Also, refer to the TODO’s that are given in your respective Java File.