hadoop-yarn-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steve Loughran <ste...@cloudera.com.INVALID>
Subject Re: [DISCUSS] Use of AssertJ for testing
Date Mon, 01 Apr 2019 15:36:59 GMT
On Mon, Apr 1, 2019 at 5:37 AM Akira Ajisaka <aajisaka@apache.org> wrote:

> Hi folks,
>
> Now I'm going to upgrade the JUnit version from 4 to 5 for Java 11 support.
> I wanted to start with the small module, so I uploaded a patch to upgrade
> the API in hadoop-yarn-api module at first (YARN-8943), and in this JIRA,
> Szilard Nemeth suggested using AssertJ with JUnit 5. (Thanks Szilard
> for the suggestion!)
>
> I think the JUnit upgrade and the use of AssertJ are separated, but
> related tasks.
> Therefore, I'd like to decide:
> - Use AssertJ or not
> - If we are going to use AssertJ, when to use AssertJ (before
> upgrading JUnit or after?)
>
>
My opinion is:
> - JUnit migration is required for Java 11, so upgrading JUnit as soon
> as possible.
> - After the migration, we may use AssertJ for existing tests.
> - We may use AssertJ for new tests. (not must)
>
>
I think it's important to innovate in testing, rather than say "this worked
in junit 3 so let's continue it"; AssertJ is part of it.

At the same: I'd like to see evidence that when the asserts fail, they are
meaningful in their stack traces. The Hamcrest matchers, for example, may
let you be more descriptive in your asserts, but they don't seem to be that
more useful in their errors. As my key goal for an assertion is "provides
meaningful information on a failure", that's, well, disappointing

The other thing to bear in mind is: we don't need to wait for the test
frameworks to meet our needs. LambdaTestUtils is where things have been
going for lambda-expression assertions, the key ones (intercept,
eventually) being based on the Scala Test assertions of the same name.
Which shows another way to improve testing: spend some time working in a
different project, with a different test framework, and see what is better
there.

Also: I think it'd be good to make the new tests Junit 5+ aspect, rather
than mixed, as it'll confuse backporting a lot.

There's also the issue that JUnit 5 doesn't support global timeouts (yet)
https://github.com/junit-team/junit5/issues/80#issuecomment-477088175


+ if any can point to some good articles/presentations on junit5+assertJ,
then

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message