ignite-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Oleg Ignatenko (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (IGNITE-10179) Change new tests root to use @BeforeClass and @AfterClass instead of isFirstTest() and isLastTest()
Date Wed, 23 Jan 2019 19:00:00 GMT

    [ https://issues.apache.org/jira/browse/IGNITE-10179?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16750329#comment-16750329

Oleg Ignatenko commented on IGNITE-10179:

(i) per my preliminary testing, the right way to fix things would be to use custom runner
with GridAbstractTest instead of RunRule:
    /** */
    public static class HelperRunner extends BlockJUnit4ClassRunner {
        /** */
        public HelperRunner(Class<?> klass) throws InitializationError {

        /** {@inheritDoc} */
        @Override protected Statement methodInvoker(final FrameworkMethod mtd, Object test)
            return super.methodInvoker(new FrameworkMethod(mtd.getMethod()){
                /** */
                @Override public Object invokeExplosively(Object target, Object... params)
throws Throwable {
                    System.out.println(">>> from HelperRunner methodInvoker invokeExplosively:
                        + (target instanceof GridAbstractTest));
                    //todo find a way to wrap below invokation into GridAbstractTest magic

                    return super.invokeExplosively(target, params); // this is invoked after
@Before and prior to @After
            }, test);
This solution, however, appears to depend on merge of IGNITE-10758 which removes scaffolding
annotations {{RunWith(JUnit4.class)}} from subclasses because otherwise these annotations
would break above custom runner.

> Change new tests root to use @BeforeClass and @AfterClass instead of isFirstTest() and
> ---------------------------------------------------------------------------------------------------
>                 Key: IGNITE-10179
>                 URL: https://issues.apache.org/jira/browse/IGNITE-10179
>             Project: Ignite
>          Issue Type: Sub-task
>            Reporter: Oleg Ignatenko
>            Assignee: Oleg Ignatenko
>            Priority: Major
>          Time Spent: 10m
>  Remaining Estimate: 0h
> If needed, refer parent task for more details.
> isFirstTest() and isLastTest() homebrew methods seem to be in GridAbstractTest only because
Junit 3 lacked necessary functionality; after migration to Junit 4 these would better changed
to use standard API of this framework.

This message was sent by Atlassian JIRA

View raw message