The module reef-tests contains our integration tests. These tests run actual REEF jobs and validate their behavior. Also, they are portable across all runtimes REEF supports. this page documents how to write such integration tests. We use JUnit as the testing framework. However, these tests are not unit tests, but integration tests. Within the test method, we use the REEF client submit a Driver and observe its behavior. Consider the following simple test:
DriverTest.java
public class DriverTest { private final TestEnvironment testEnvironment = TestEnvironmentFactory.getNewTestEnvironment(); @Before public void setUp() throws Exception { testEnvironment.setUp(); } @Test public void testSimpleDriver() throws BindException, InjectionException { final Configuration runtimeConfiguration = this.testEnvironment.getRuntimeConfiguration(); final Configuration driverConfiguration = DriverConfiguration.CONF .set(DriverConfiguration.GLOBAL_LIBRARIES, EnvironmentUtils.getClassLocation(DriverTestStartHandler.class)) .set(DriverConfiguration.DRIVER_IDENTIFIER, "TEST_DriverTest") .set(DriverConfiguration.ON_DRIVER_STARTED, DriverTestStartHandler.class) .build(); final LauncherStatus status = this.testEnvironment.run(driverConfiguration); Assert.assertTrue("Job state after execution: " + status, status.isSuccess()); } @After public void tearDown() throws Exception { this.testEnvironment.tearDown(); } }