0 Replies Latest reply on Feb 22, 2012 1:56 PM by Martin Kouba

    Test method timeout

    Martin Kouba Master



      recently I was looking for a solution to apply test method timeout in arquillian in-container test. In the end I realized that test method timeout was not the right approach for my use case... though I figured out that it is not possible at the moment (see details below). I think it would be quite useful to have some similar feature in Arquillian core or Performance extension - filed an issue [1].


      Now issues I ran into...


      First I tried TestNG native test method timeout (using @Test(timeOut=xx)) but this corrupted arquillian test execution. Most probably because of unsupported thread execution needs. BTW JUnit test method timeout (@Test(timeout=xx)) fails the same way.


      So I tried to use Performance extension. However it did not meet my requirements since it only checks whether the test finished within the specified time and DOES NOT terminate method execution in case of the timeout is exceeded. In other words my test would fail in the end but may also theoretically stuck forever. Moreover I found out that Performance extension does not work with TestNG at the moment - filed an issue [2].


      Finally I realized I need something completely different :-) and created simple solution to generalize waiting logic for async operations - timer object that delays thread execution [3]. Might be useful for someone :-)




      [1] https://issues.jboss.org/browse/ARQ-769

      [2] https://issues.jboss.org/browse/ARQ-768

      [3] https://github.com/jboss/cdi-tck/blob/master/impl/src/main/java/org/jboss/cdi/tck/Timer.java