ignite-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From oignatenko <oignate...@gridgain.com>
Subject Re: Is it time to move forward to JUnit4 (5)?
Date Mon, 10 Dec 2018 18:41:51 GMT
Hello,

I would like add few minor clarifications to what Ed wrote.

1. After transition to JUnit4 is fully over (ETA this week) there won't be a
need to use @RunWith(JUnit4.class) anymore, so you will be writing test
classes as a normal JUnit 4 user, without any special scaffolding.
1.1. Please keep in mind that tests that don't inherit from GridAbstractTest
can (and I think should) be written full Junit 4 and don't need anything
special at all - these are essentially out of scope of this discussion.

2. Note that "full JUnit 4 experience" doesn't apply to part of testsuites
that currently use suite() method because in these you would still have to
use JUnit4TestAdapter. Unless of course you will choose to rewrite
particular suite Junit 4 style (which I would encourage everyone to do,
after we complete migration).

3. As a bit of further perspective, we also considering next migration -
after all tests will be uniform Junit 4 (instead of current mix of Junit 3
and 4) we will look into whether it is worth migrating to most recent
version - JUnit5. Those interested can keep an eye on respective JIRA
ticket:
  https://issues.apache.org/jira/browse/IGNITE-10180
  
regards, Oleg


Eduard Shangareev wrote
> Ivan,
> 
> So, suggested actions with the new approach:
> 1. Add @Test annotation on test methods.
> 2. Add @RunWith(JUnit4.class) annotation on test class.
> 3. Add @Before, @After on methods which should run before, after a
> test (setUp, tearDown in current approach).
> 4. Add your test-class to a suite using suite.addTest(new
> JUnit4TestAdapter(YourTestClass.class));
> 5. Use @Ignore instead fail(); for muting test.
> 6. You could start using @Parametrized instead of inheritance.
> 
> 
> On Mon, Dec 3, 2018 at 1:15 PM Павлухин Иван &lt;

> vololo100@

> &gt; wrote:
> 
>> Hi Oleg,
>>
>> I noticed that GridAbstractTest is now capable to run junit4 tests.
>> What are the current recommendations for writing new tests? Can we use
>> junit4 annotation for new tests?
>> пн, 12 нояб. 2018 г. в 19:58, oignatenko &lt;

> oignatenko@

> &gt;:
>> >
>> > Hi Ivan,
>> >
>> > I am currently testing approach you used in pull/5354 in the "pilot"
>> > sub-task with examples tests (IGNITE-10174).
>> >
>> > So far it looks more and more like the way to go. The most promising
>> thing I
>> > observed is that after I changed classes in our test framework the way
>> you
>> > did, execution of (unchanged) examples tests went exactly the same as
>> it
>> was
>> > before changes.
>> >
>> > This indicates that existing tests won't be affected making it indeed
>> low
>> > risk.
>> >
>> > After that I converted examples tests to Junit 4 by adding @RunWith and
>> > @Test annotations and tried a few, and these looked okay.
>> >
>> > Currently I am running full examples test suite and after it is over I
>> will
>> > compare results to the reference list I made by running it prior to
>> > migration.
>> >
>> > regards, Oleg
>> >
>> >
>> >
>> > --
>> > Sent from: http://apache-ignite-developers.2346864.n4.nabble.com/
>>
>>
>>
>> --
>> Best regards,
>> Ivan Pavlukhin
>>





--
Sent from: http://apache-ignite-developers.2346864.n4.nabble.com/

Mime
View raw message