-
1. Re: JUnit Rules execution
mjobanek Mar 17, 2016 11:25 AM (in response to erhard)Hi,
which version of arquillian-core you are using exactly? Is it the latest one - 1.1.11.final?
Matous
-
2. Re: JUnit Rules execution
erhard Mar 17, 2016 11:44 AM (in response to mjobanek)Yes, i tried 1.1.11.Final. Originally I was using 1.1.0.Final. What I have seen, the change was introduced with 1.1.5.Final. Before that rules were executed on client- and server-side.
-
3. Re: JUnit Rules execution
mjobanek Apr 6, 2016 9:41 AM (in response to erhard)Well, what I see is that the rule is executed on both the client and server side (for the test method that should be run in container). Do you observe different behaviour?
-
4. Re: JUnit Rules execution
erhard Apr 7, 2016 4:29 PM (in response to mjobanek)When I try git@github.com:Gepardec/jboss-examples.git branch b_arquillian_demo_4:
mvn test -Parquillian-wildfly-managed -Dtest=RuleTest
...
T E S T S
-------------------------------------------------------
Running com.gepardec.examples.arquillian.RuleTest
Apr 07, 2016 10:04:25 PM org.xnio.Xnio <clinit>
INFO: XNIO version 3.2.2.Final
Apr 07, 2016 10:04:25 PM org.xnio.nio.NioXnio <clinit>
INFO: XNIO NIO Implementation Version 3.2.2.Final
Apr 07, 2016 10:04:25 PM org.jboss.remoting3.EndpointImpl <clinit>
INFO: JBoss Remoting version 4.0.3.Final
-- starting: should_create_greeting(com.gepardec.examples.arquillian.RuleTest)
-- succeeded: should_create_greeting(com.gepardec.examples.arquillian.RuleTest)
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 6.172 sec
The rule is executed on the client (and on the server). (-- starting:...)
When I change the Arquillian-Version to 1.1.11.Final:
T E S T S
-------------------------------------------------------
Running com.gepardec.examples.arquillian.RuleTest
Apr 07, 2016 10:06:03 PM org.xnio.Xnio <clinit>
INFO: XNIO version 3.2.2.Final
Apr 07, 2016 10:06:03 PM org.xnio.nio.NioXnio <clinit>
INFO: XNIO NIO Implementation Version 3.2.2.Final
Apr 07, 2016 10:06:04 PM org.jboss.remoting3.EndpointImpl <clinit>
INFO: JBoss Remoting version 4.0.3.Final
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 4.346 sec
The rule is executed only on the server.
This is consistent with the release-notes in Arquillian Core 1.1.5.Final Released · Arquillian Blog:
This has in the past caused them to be executed both on the Client side and In Container. With 1.1.5.Final, we’ve moved how all this is executed and included
@Rules
into the Before/After handling.This means,
@Rules
will follow the same rules as@Before
/@After
, that again follow the execution of@Test
. If the@Test
is executed In Container, so will the@Rule
. If@Test
executes on Client, so will the@Rule
. -
5. Re: JUnit Rules execution
mjobanek Apr 12, 2016 5:03 AM (in response to erhard)Hi,
thanks for the reproducer.
Now, I can see where is my misunderstanding. I understood running a Rule as an invocation of the method Rule.apply(Statement base,...). This method is invoked on both sides. You can check it if you override it in your class SimpleTestHandler and print some output - this output will be visible on both sides.
However, the method Statement.evaluate() is invoked only on the side where the test is run - as you said.