[arquillian-issues] [JBoss JIRA] (ARQ-2170) RulesEnricher doubles each test enrichment

Matous Jobanek (JIRA) issues at jboss.org
Mon Feb 5 06:57:00 EST 2018


    [ https://issues.jboss.org/browse/ARQ-2170?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13528351#comment-13528351 ] 

Matous Jobanek commented on ARQ-2170:
-------------------------------------

There is a way to disable the functionality of the {{RulesEnricher}} - you need to create an Arquillian extension with an interceptor where you don't proceed the event {{RulesEnrichment}}. Interceptor is an observer, but instead of observing the event itself, you observe the context of the event:
{code:java}
public void observe(@Observes(precedence = 100) EventContext<RulesEnrichment> event) {
{code}
If the {{event.proceed()}} is not called within this method, then the event flow is stopped, and thus the observer {{RulesEnricher}} is not invoked.

Currently, it is necessary to create an Arquillian extension using SPI for it - from the next version of Arquillian core it should be possible to do it specifically just for one test class inside of your test suite using an annotation {{@Observer}}. 
For more information see:
https://github.com/arquillian/arquillian-core/pull/161
https://issues.jboss.org/browse/ARQ-2174

I hope that this will help.

> RulesEnricher doubles each test enrichment
> ------------------------------------------
>
>                 Key: ARQ-2170
>                 URL: https://issues.jboss.org/browse/ARQ-2170
>             Project: Arquillian
>          Issue Type: Bug
>          Components: core
>         Environment: arquillian-junit-core-1.1.11.Final (all versions affected)
>            Reporter: kostd kostd
>
> RulesEnricher created in ARQ-1954
> 1. RulesEnricher is not implementor of TestEnricher, so it cannot be overrided through LoadableExtension.
> 2. RulesEnricher#enrichRulesAndTestInstance adds into collection toEnrich test instance:
> {code}
>         toEnrich.add(event.getTestInstance());
> {code}
> https://github.com/arquillian/arquillian-core/blob/master/junit/core/src/main/java/org/jboss/arquillian/junit/RulesEnricher.java
> So, if MyTest have`nt field rules, will be only one MyTest enrichment. If MyTest contains one or more test rule, will be two MyTest enrichments.  
> Each testEnrichment of MyTest do a soap call to server to prepare data for test. It is very important  to me, one or two soap call will happen.
> How can I change this behaviour? 



--
This message was sent by Atlassian JIRA
(v7.5.0#75005)


More information about the arquillian-issues mailing list