Integration Tests

Last Updated: Aug 9, 2021
documentation for the dotCMS Content Management System

dotCMS provides Integration testing to test more than one component and how they function together. For instance, how one part of the system interacts with another dependent part of the system, or how the database interacts with your data abstraction layer. dotCMS also provides Functional Testing, and Unit Testing.

Required Integration Testing Property Modifications

You need to modify the following properties to point to the right local location pathing:

Required Modifications to the it-dotcms-config-cluster.properties and elasticsearch.yml Config Files:

In the it-dotcms-config-cluster.properties file:

es.path.home=<tomcat8>/webapps/ROOT/WEB-INF/elasticsearch

In the elasticsearch.yml file:

cluster.name=testDotCMSIndex
path.data=<tomcat8>/webapps/ROOT/dotsecure/esdata
path.repo=<tomcat8>/webapps/ROOT/dotsecure/esdata/essnapshot/snaphosts
path.logs=<tomcat8>/webapps/ROOT/dotsecure/logs 

Required Modifications to the it-dotmarketing-config.properties File:

ASSET_REAL_PATH=<tomcat8>/webapps/ROOT/assets
DYNAMIC_CONTENT_PATH=<tomcat8>/webapps/ROOT/dotsecure
VELOCITY_ROOT=<tomcat8>/webapps/ROOT/WEB-INF/velocity
GEOIP2_CITY_DATABASE_PATH_OVERRIDE=<tomcat8>/webapps/ROOT/WEB-INF/geoip2/GeoLite2-City.mmdb
TOOLBOX_MANAGER_PATH=<tomcat8>/webapps/ROOT/WEB-INF/toolbox.xml
context.path.felix=<tomcat8>/webapps/ROOT/WEB-INF/felix  

Database Configuration

The datasource properties can be specified in the dotCMS/src/integration-test/resources/db-config.properties file

Requirements before Running Integration Tests

The dotCMS server must be started, at least once, before running Integration tests. Integration tests need a working database (schema created), and valid dotsecure, assets and WEB-INF folders. If you have already started dotCMS (distro or source), then you already have these folders created, so you are ready to use this documentation. However, if you haven’t downloaded and started dotCMS, please refer to the following documentation links on how to install and startup dotCMS:
https://dotcms.com/docs/latest/installing-from-release -distributed release version
https://dotcms.com/docs/latest/developing-from-source-remote-debug -source code

How to Run Integration Tests in Eclipse

After configuring and starting your dotCMS server at least once, note the Integration test package - src/integration-test/java. Run the entire test suite package, or any of the targeted integration tests by right-clicking the package/test, then selecting “Run As”, and choosing “JUnit Test.“

How to Run Integration Tests in intelliJ

To run integration tests from intelliJ, locate the /src/integration-test package as shown below. Right-click on the entire integration test suite, or choose a targeted integration test, then choose the Run '{chosen test}' option.

After running an integration test, the intelliJ event log will display test result data.

Running Integration Tests using Gradle

./gradlew integrationTest – runs all tests

The db type can be specified as an environment variable or as a gradle parameter (defaults to ‘postgres’) Environment variable: export databaseType=mysql

Gradle parameter: ./gradlew integrationTest --tests *VersionableAPITest -PdatabaseType=mysql

For more filtering options, see https://docs.gradle.org/current/userguide/java_plugin.html#test_filtering

On this page

×

We Dig Feedback

Selected excerpt:

×