A simple Tabris/RAP Test Runner

February 24, 2014 | 1 min Read

Writing JUnit Tests for an application is always a good thing. Writing tests for a Tabris or RAP application for the first time seems more challenging: You might encounter an “java.lang.IllegalStateException: No context available outside of the request processing.” exception while running the tests. So, after a quick google you will find a blog post from my dear fellow Johannes that explains that you need to setup and teardown the test with the RAP Test Fixture. This looks like this:

@Before
public void setUp() {
  Fixture.setUp();
}
  
@After
public void tearDown() {
  Fixture.tearDown();
}

After writing these lines a thousand times or so it gets annoying. So, for this reason we have written a small Test Runner in Tabris that you can use to ease the development of Tests. It’s called RWTRunner and it’s hosted as a github gist.

Feel free to copy the runner to your own project. If you have any other helpers that ease the testing of Tabris/RAP applications please let us know in a comment.