RxJava icon indicating copy to clipboard operation
RxJava copied to clipboard

3.x: Have all unit tests extend a base test class

Open akarnokd opened this issue 7 years ago • 5 comments

By adding a common base class, we can enable a "global" timeout and a per-class log output that prevents Travis CI to stop the build and also not flood the log with all methods:

package io.reactivex.testsupport;

public abstract class RxJavaTest {
  @Rule
  protected Timeout globalTimeout = new Timeout(5, TimeUnit.MINUTES);

  @Test
  @Ignore
  public final void announce() {
  }
}

This way, we no longer have to rely on the random ignores scattered along the codebase. This baseclass-ignore may seem unnecessarily complicated, but unfortunately, I was unable to create a working setting via Gradle's test runner.

akarnokd avatar Jul 22 '19 16:07 akarnokd

Hey, I see the interest having a global timeout in a base class. Please note that in Junit4, the timeout parameter on @Test annotation does not override the Timeout Rule. This can be an issue when a test requires a custom timeout. Also, I don't understand the announce test. Do you expect every ignored test to be transferred in the class RxJavaTest?

RomanWuattier avatar Jul 23 '19 16:07 RomanWuattier

No problem, default 2-5 minutes should work. Travis kills the build if no standard output is happening for 10 minutes. Announce should create a log print often. Ignore should be reevaluated in place and deleted if no longer needed.

akarnokd avatar Jul 23 '19 16:07 akarnokd

Thanks, I'll submit a PR.

RomanWuattier avatar Jul 23 '19 21:07 RomanWuattier

Hey, There are a few remaining things to close the issue. First, I did not delete ignored tests for the fusion operator. Second, I don't know what should be done to fix those non-deterministic and thread starvation tests:

  • https://github.com/ReactiveX/RxJava/blob/3.x/src/test/java/io/reactivex/observers/SerializedObserverTest.java#L263
  • https://github.com/ReactiveX/RxJava/blob/3.x/src/test/java/io/reactivex/observers/SerializedObserverTest.java#L353
  • https://github.com/ReactiveX/RxJava/blob/3.x/src/test/java/io/reactivex/subscribers/SerializedSubscriberTest.java#L265
  • https://github.com/ReactiveX/RxJava/blob/3.x/src/test/java/io/reactivex/subscribers/SerializedSubscriberTest.java#L355

Also, I did not update Technology Compatibility Kit (TCK) tests.

RomanWuattier avatar Aug 04 '19 15:08 RomanWuattier

Don't worry about them. Thanks for your diligent work!

akarnokd avatar Aug 04 '19 15:08 akarnokd