Hi Oleg,

Migrating to Junit 4 sounds as great idea. I believe everybody
is quite surprised when finds Junit 3 in Ignite.
But for me personally it is good to understand what problem we
are trying to solve? What benefits will Junit 4 give us? What are
the most painful moments with current testing framework?
(I my mind I draw a proposal which contains sections "Motivation",
"Alternatives", etc.)

Also I must say that I made some experiments related to Junit4
migration. And from the first glance it seems that the most
important Ignite test framework classes contain a huge amount of
utility methods and a little amount of code related to a test lifecycle.
These classes are GridAbstractTest and GridCommonAbstractTest.
Both are quite thick, but as already said it is mostly utility code
which could be extracted. I would be great to come to very thin base
test classes (or even to baseclass-less tests at all) and include all
kind of utilities without inheritance.

But massive refactoring perhaps is more for future. The main point
here is that Ignite test framework is not complex at all and could be
easily adopted to Junit 4.

Regarding twin classes. How to keep them in sync? If the migration
process will be paused halfway it could make things complicated in
future.

Additionally, I have a wild idea how to marry junit 3 and 4 without
introducing twins. The idea looks ugly from OOP perspective, but
here it is. We can simply annotate overridden Junit 3 setUp and
tearDown methods with @Before and @After annotations. And
use runTest overridden method for Junit 3 and TestRule for Junit 4
in order to run test methods in newly started thread.

For all details you can see an experiment on github [1]. Among them
are ticks with @RunWith annotation making possible to run a test
inherited from TestCase as Junit 4 test. Still, I might have missed
something.

Does it sound sane anyhow?

[1] https://github.com/apache/ignite/pull/5354/files


ср, 7 нояб. 2018 г. в 19:57, oignatenko <oignate...@gridgain.com>:

> Hello,
>
> I created JIRA task for this move, with detailed explanation and
> step-by-step subtasks, your comments are welcome:
>
> - https://issues.apache.org/jira/browse/IGNITE-10173
>
> In brief, the plan is to gradually migrate the part of tests that still
> uses
> Junit 3 (hundreds if not thousands of those that depend on GridAbstractTest
> and its subclasses) to newer version. The trick proposed to avoid doing all
> this in one (big and risky) step is to introduce a Junit4-based "twin" of
> GridAbstractTest (and respective twins of its subclasses) and use it to
> gradually change tests to use that newer API instead.
>
> After above is over, Junit 3 and all its related stuff (including
> GridAbstractTest) could be safely removed from project.
>
> regards, Oleg
>
>
>
>
> --
> Sent from: http://apache-ignite-developers.2346864.n4.nabble.com/
>


-- 
Best regards,
Ivan Pavlukhin

Reply via email to