question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
akarnokdcommented, Aug 4, 2019

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

0reactions
RomanWuattiercommented, Aug 4, 2019
Read more comments on GitHub >

github_iconTop Results From Across the Web

JUnit extend base class and have tests in that class being run
Yes, I tried it from Eclipse with JUnit 3. I ran the MyTests class as a JUnit test and all tests passed successfully....
Read more >
Three Reasons Why We Should Not Use Inheritance In Our ...
After all tests of a test class are executed, JUnit traverses the class hierarchy again and looks for methods annotated with the @AfterClass ......
Read more >
Is it a bad practice for all test classes to extend a particular class
This base class usually runs some setup & cleanup code before each test class is run. In some cases, the base class is...
Read more >
Extending the class to test it: is this testing approach fine?
It comes in two flavors: the extending class is a class that is only used in test. the test class (fixture) is itself...
Read more >
Base Test Class Testing Pattern: Why and How to use
It is a simple approach to set up common initialization and cleanup in your tests. We commonly categorize it as a Testing pattern....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found