How to run Apache Fineract® integration tests with IntelliJ IDEA
Prerequisites
- Java: Ensure you have Java Development Kit (JDK) installed. Apache Fineract® typically requires Java 17 (Java 21 is not yet supported).
- Git: You’ll need Git to clone the Apache Fineract® source code from the repository.
- IntelliJ IDEA: Install IntelliJ IDEA (Community or Ultimate edition).
- **Configure IntelliJ Runner to be used for executing the integration tests
Steps
- Clone the Apache Fineract® Repository:
- Open a terminal or command prompt and navigate to the directory where you want to store the Apache Fineract® source code.
- Run the following command to clone the repository:
git clone https://github.com/apache/fineract.git
- Import the Project into IntelliJ IDEA:
- Open IntelliJ IDEA.
- Click on
File
>Open...
and select thefineract
directory you cloned in step 1. IntelliJ will recognize it as a Gradle project. - IntelliJ IDEA will analyze the project and download its dependencies.
- Configure JDK:
- Verify that IntelliJ IDEA is using the correct Java SDK. Go to
File
>Project Structure
. - In the Project Structure dialog, under
Project
, make sure theProject SDK
is set to the appropriate Java version (Java 17 is the latest supported).
- Verify that IntelliJ IDEA is using the correct Java SDK. Go to
- Gradle Configuration:
- Open the
build.gradle
file in the project root directory. - IntelliJ IDEA will automatically start downloading the dependencies, if not you can do it manually as well by opening the “Gradle” window and click on
Reload All Gradle Projects
. - Further configurations can be found in the
settings.gradle
file
- Open the
- Configure to use IntelliJ Runner
- On the top bar click on
IntelliJ IDEA/Settings...
- On the left menu, select
Build, Execution, Deployment/Build Tools/Gradle
- Select
IntelliJ IDEA
from the dropdown menu ofRun tests using
- Click
Apply
andOK
- On the top bar click on
- Where are the integration tests?
- You can find the integration tests in the
integration-tests
module
- You can find the integration tests in the
- Before executing integration tests
- You need to have a running instance of Fineract
- By default the integration tests has the following configuration:
backend.protocol=https
backend.host=localhost
backend.port=8443
backend.username=mifos
backend.password=password
backend.tenant=default
- To override any of the default value, just add new value with the same key as environment variable
- Example:
backend.protocol=http
backend.host=localhost
backend.port=8080
- Example:
- Execute integration tests
- To execute integration test
- Open the integration test class and click on the green triangle icon next to the class name to execute all of the tests or click on the green triangle icon next to one of the test methods to execute only that test case
- Alternatively:
- Go to
Run
>Edit Configurations
. - Click the
+
button and selectJUnit
. - In the configuration settings:
- Set the JDK:
Java 17
(example) - Choose the
fineract.integration-tests.test
module - VM options:
-ea
- Select
Class
as type of search - Fully qualified name of the class that contains tests:
org.apache.fineract.integrationtests.AccountingScenarioIntegrationTest
(example) - Working directory:
$MODULE_WORKING_DIR$
- Set the JDK:
- Go to
- To execute every integration tests
- Right click on
src/test/java
directory inintegration-tests
module and selectRun Tests in java
option - Alternatively:
- Go to
Run
>Edit Configurations
. - Click the
+
button and selectJUnit
. - In the configuration settings:
- Set the JDK:
Java 17
(example) - Choose the
fineract.integration-tests.test
module - VM options:
-ea
- Select
All in package
as type of search - Working directory:
$MODULE_WORKING_DIR$
- Set the JDK:
- Go to
- Right click on
- To execute integration test
Important
Keep in mind that Apache Fineract® is a complex project, and you may encounter issues or need to configure additional settings based on your specific environment and requirements. It’s a good practice to refer to the official Apache Fineract® documentation and the project’s developer community for more details and troubleshooting!