ignite-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ivan Fedotov <ivanan...@gmail.com>
Subject beforeTest, afterTest JUnit scenario implementation
Date Wed, 20 Mar 2019 14:37:38 GMT
Hi Igniters!

I have a questions according to beforeTest(s)/afterTest(s) methods. I tried
to make them correspond to JUnit 4+ semantics in the context of iep30 [1].
And I see there two solutions:

1. Place test scenario under the Rule annotation as it has already done in
GridAbstractTest [2]. It is a built-in opportunity to extend JUnit
framework. Such case already implemented and demands minimal changes. To
add before and after test logic in the other classes, it is necessary to
override corresponding methods.

2. Write before and after test logic with annotations in GridAbstractTest
and all other classes. Such solution is less flexible in comparison with
rules. Moreover, under annotation, a code will be less readable than under
rule. But such approach decreases coupling between classes.

The main argumentation in favor of the first approach is that there are
minimal changes in code. According to this during migration on other JUnit
versions, there is no need to fix all test files to change imports and
annotations (for instance, in JUnit5 Before/BeforeClass, After/AfterClass
annotations were changed). Changes will affect only GridAbstractTest
class.  At the same time, the possibility to use annotations remains.

Now I started to implement the first approach [3] - specify test scenario
under the Rule annotation and override methods if it is necessary.
Such functionality is similar to the third version, but with 4+ semantics
and with minimal changes during migration.

What do you think, which approach will be better for the community?


Ivan Fedotov.


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