Test Dependencies
This documentation is for an unreleased version of Apache Flink. We recommend you use the latest stable version.

Dependencies for Testing #

Flink provides utilities for testing your job that you can add as dependencies.

DataStream API Testing #

You need to add the following dependencies if you want to develop tests for a job built with the DataStream API:

Open the pom.xml file in your project directory and add the following in the dependencies block.
<dependency>
    <groupId>org.apache.flink</groupId>
    <artifactId>flink-test-utils</artifactId>
    <version>2.0-SNAPSHOT</version>
    <scope>test</scope>
</dependency>
Check out Project configuration for more details.
Open the build.gradle file in your project directory and add the following in the dependencies block.
testCompile "org.apache.flink:flink-test-utils:2.0-SNAPSHOT"
Note: This assumes that you have created your project using our Gradle build script or quickstart script.
Check out Project configuration for more details.

Among the various test utilities, this module provides MiniCluster, a lightweight configurable Flink cluster runnable in a JUnit test that can directly execute jobs.

For more information on how to use these utilities, check out the section on DataStream API testing

Table API Testing #

If you want to test the Table API & SQL programs locally within your IDE, you can add the following dependency, in addition to the aforementioned flink-test-utils:

Open the pom.xml file in your project directory and add the following in the dependencies block.
<dependency>
    <groupId>org.apache.flink</groupId>
    <artifactId>flink-table-test-utils</artifactId>
    <version>2.0-SNAPSHOT</version>
    <scope>test</scope>
</dependency>
Check out Project configuration for more details.
Open the build.gradle file in your project directory and add the following in the dependencies block.
testCompile "org.apache.flink:flink-table-test-utils:2.0-SNAPSHOT"
Note: This assumes that you have created your project using our Gradle build script or quickstart script.
Check out Project configuration for more details.

This will automatically bring in the query planner and the runtime, required respectively to plan and execute the queries.

The module flink-table-test-utils has been introduced in Flink 1.15 and is considered experimental.