tm1-testcontainers 0.1.1 API

Run your tests against a real IBM Planning Analytics (TM1) server in Docker, with Testcontainers. No IBM software is included: you supply your own licensed TM1 Server for Linux, and tests that need TM1 are skipped without it.

Getting started

  1. Add it to your tests. Gradle:

    testImplementation("io.skipcheck:tm1-testcontainers:0.1.1")

    Maven:

    <dependency>
      <groupId>io.skipcheck</groupId>
      <artifactId>tm1-testcontainers</artifactId>
      <version>0.1.1</version>
      <scope>test</scope>
    </dependency>
  2. Tell it where your TM1 is. The quickest way is the folder holding IBM's tm1server-*-linuxi38664h_bundle.tar.gz download, with Docker running:

    TM1_BUNDLE_DIR=~/Downloads ./gradlew test

    Tm1Source lists the other ways, such as an installed TM1 or a private image, which start in seconds.

  3. Write a test. @RequiresTm1 starts a TM1 server for the test run, shares it between test classes, and skips the tests when Docker or TM1 isn't available:

    @RequiresTm1
    static class HelloTm1Test {
    
    	@Test
    	void connects(Tm1ServerContainer server) {
    		Tm1Client tm1 = Tm1Client.builder()
    			.baseUrl(server.getRestUrl())
    			.basicAuth(server.getUsername(), server.getPassword())
    			.build();
    		try {
    			assertNotNull(tm1.session().version().block(Duration.ofSeconds(30)));
    		}
    		finally {
    			tm1.close().block(Duration.ofSeconds(30));
    		}
    	}
    
    }
    

Where next

Packages
Package
Description
A Testcontainers module for TM1, and the JUnit extension that runs tests against it.