[JBoss JIRA] (ARQ-1773) JUnittests pass when exception is thrown from @Before-annotated method
by Mattias Persson (JIRA)
[ https://issues.jboss.org/browse/ARQ-1773?page=com.atlassian.jira.plugin.s... ]
Mattias Persson updated ARQ-1773:
---------------------------------
Steps to Reproduce:
See attached file,
Maven dependency according to:
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.jboss.arquillian</groupId>
<artifactId>arquillian-bom</artifactId>
<version>1.1.4.Final</version>
<scope>import</scope>
<type>pom</type>
</dependency>
</dependencies>
</dependencyManagement>
Testclass according to:
package se.shouldfailtest;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.shrinkwrap.api.Archive;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.asset.EmptyAsset;
import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.assertTrue;
@RunWith(Arquillian.class)
public class ShouldFailTest {
@Deployment
public static Archive<?> createDeployment() {
WebArchive war = ShrinkWrap.create(WebArchive.class, "test.war")
.addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");
return war;
}
@Before
public void preparePersistenceTest() throws Exception {
throw new Exception("Test should fail when exception is thrown in @Before...");
}
@Test
public void shouldFail() throws Exception {
//This test will pass in 1.1.4.Final but not in 1.1.3.Final (as expected).
assertTrue(false);
}
}
was:
Maven dependency according to:
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.jboss.arquillian</groupId>
<artifactId>arquillian-bom</artifactId>
<version>1.1.4.Final</version>
<scope>import</scope>
<type>pom</type>
</dependency>
</dependencies>
</dependencyManagement>
Testclass according to:
package se.shouldfailtest;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.shrinkwrap.api.Archive;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.asset.EmptyAsset;
import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.assertTrue;
@RunWith(Arquillian.class)
public class ShouldFailTest {
@Deployment
public static Archive<?> createDeployment() {
WebArchive war = ShrinkWrap.create(WebArchive.class, "test.war")
.addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");
return war;
}
@Before
public void preparePersistenceTest() throws Exception {
throw new Exception("Test should fail when exception is thrown in @Before...");
}
@Test
public void shouldFail() throws Exception {
//This test will pass in 1.1.4.Final but not in 1.1.3.Final (as expected).
assertTrue(false);
}
}
> JUnittests pass when exception is thrown from @Before-annotated method
> ----------------------------------------------------------------------
>
> Key: ARQ-1773
> URL: https://issues.jboss.org/browse/ARQ-1773
> Project: Arquillian
> Issue Type: Bug
> Security Level: Public(Everyone can see)
> Components: Base Implementation
> Affects Versions: 1.1.4.Final
> Reporter: Mattias Persson
> Attachments: arquillian_test_should_fail.zip
>
>
> When an exception is thrown from a method with @Before, tests that should fail actually pass when using Arquillian 1.1.4.Final. When stepping down to 1.1.3.Final, the tests fail as expected.
--
This message was sent by Atlassian JIRA
(v6.2.3#6260)
10 years, 1 month
[JBoss JIRA] (ARQ-1773) JUnittests pass when exception is thrown from @Before-annotated method
by Mattias Persson (JIRA)
Mattias Persson created ARQ-1773:
------------------------------------
Summary: JUnittests pass when exception is thrown from @Before-annotated method
Key: ARQ-1773
URL: https://issues.jboss.org/browse/ARQ-1773
Project: Arquillian
Issue Type: Bug
Security Level: Public (Everyone can see)
Components: Base Implementation
Affects Versions: 1.1.4.Final
Reporter: Mattias Persson
When an exception is thrown from a method with @Before, tests that should fail actually pass when using Arquillian 1.1.4.Final. When stepping down to 1.1.3.Final, the tests fail as expected.
--
This message was sent by Atlassian JIRA
(v6.2.3#6260)
10 years, 1 month
[JBoss JIRA] (ARQ-1771) Putting custom annotation on Drone creates multiple instances
by Stefan Miklosovic (JIRA)
[ https://issues.jboss.org/browse/ARQ-1771?page=com.atlassian.jira.plugin.s... ]
Stefan Miklosovic resolved ARQ-1771.
------------------------------------
Fix Version/s: drone_2.0.0.Alpha2
Resolution: Rejected
> Putting custom annotation on Drone creates multiple instances
> -------------------------------------------------------------
>
> Key: ARQ-1771
> URL: https://issues.jboss.org/browse/ARQ-1771
> Project: Arquillian
> Issue Type: Bug
> Security Level: Public(Everyone can see)
> Components: Extension - Drone
> Affects Versions: drone_2.0.0.Alpha1
> Reporter: Stefan Miklosovic
> Fix For: drone_2.0.0.Alpha2
>
>
> I have a test case like this
> {code}
> @RunWith(Arquillian.class)
> @RunAsClient
> public class SomeTestCase
> {
> @Drone
> @Mobile
> @Custom
> private WebDriver mobile;
> // tests
> }
> {code}
> where @Custom is just an annotation:
> {code}
> @Retention(RetentionPolicy.RUNTIME)
> @Target({ ElementType.FIELD, ElementType.PARAMETER })
> public @interface Custom {
> }
> {code}
> it is _not_ annotated with @Qualifier.
> Realize that the same problem arise when using @OperateOnDeployment from Arquillian which is not annotated with @Qualifier neither.
> I am getting this:
> http://pastebin.com/raw.php?i=i9DVqeaC
> You see that InstrumentationPerformDecider.decidePerformingInstrumentation observes BeforeDroneInstantiated so when it is treated twice, you are going to instantiate two Drones which is another argument why Drone does it wrong.
> When I declare Drone injection like that, it results into two instances of WebDrivers so that means it instruments Android package twice with two Selendroids so that mean I am getting NoUniqueWebDriverException when I want to start some activity because from now on you have "by accident" two webdrivers instrumenting the same deployment as a result of a bug where putting custom annotation on Drone instantiates it twice.
--
This message was sent by Atlassian JIRA
(v6.2.3#6260)
10 years, 1 month
[JBoss JIRA] (ARQ-1771) Putting custom annotation on Drone creates multiple instances
by Stefan Miklosovic (JIRA)
[ https://issues.jboss.org/browse/ARQ-1771?page=com.atlassian.jira.plugin.s... ]
Stefan Miklosovic commented on ARQ-1771:
----------------------------------------
The problem was that in a test project there was a page object used which has injected webdriver in it.
Injection of Drone was like
{code}
class TestCase
{
@Drone @Mobile @Custom AndroidDriver mobile;
}
{code}
and page object was like
{code}
class PageObject
{
@Drone @Mobile AndroidDriver mobile;
}
{code}
So Graphene could not resolve that Drone injection point for page object since there is not such point - there is a point which is additionally annotated by @Custom, but there is not such point which is annotated only by these two annotations (@Drone and @Mobile).
What we are missing here is some kind of resolution and guessing what is "enough" to know in order to inject something into a page object.
Imagine you have 2 browsers so they are annotated by @Drone @Chrome and @Drone @Firefox and injected into a test. Additionally you have page object - that abstraction is independent from the choice of browsers so it would be enough to use just @Drone in page object and you are not changing your page object model at all.
> Putting custom annotation on Drone creates multiple instances
> -------------------------------------------------------------
>
> Key: ARQ-1771
> URL: https://issues.jboss.org/browse/ARQ-1771
> Project: Arquillian
> Issue Type: Bug
> Security Level: Public(Everyone can see)
> Components: Extension - Drone
> Affects Versions: drone_2.0.0.Alpha1
> Reporter: Stefan Miklosovic
>
> I have a test case like this
> {code}
> @RunWith(Arquillian.class)
> @RunAsClient
> public class SomeTestCase
> {
> @Drone
> @Mobile
> @Custom
> private WebDriver mobile;
> // tests
> }
> {code}
> where @Custom is just an annotation:
> {code}
> @Retention(RetentionPolicy.RUNTIME)
> @Target({ ElementType.FIELD, ElementType.PARAMETER })
> public @interface Custom {
> }
> {code}
> it is _not_ annotated with @Qualifier.
> Realize that the same problem arise when using @OperateOnDeployment from Arquillian which is not annotated with @Qualifier neither.
> I am getting this:
> http://pastebin.com/raw.php?i=i9DVqeaC
> You see that InstrumentationPerformDecider.decidePerformingInstrumentation observes BeforeDroneInstantiated so when it is treated twice, you are going to instantiate two Drones which is another argument why Drone does it wrong.
> When I declare Drone injection like that, it results into two instances of WebDrivers so that means it instruments Android package twice with two Selendroids so that mean I am getting NoUniqueWebDriverException when I want to start some activity because from now on you have "by accident" two webdrivers instrumenting the same deployment as a result of a bug where putting custom annotation on Drone instantiates it twice.
--
This message was sent by Atlassian JIRA
(v6.2.3#6260)
10 years, 1 month
[JBoss JIRA] (ARQ-1772) Arquillian Debug does not print real event class
by Karel Piwko (JIRA)
Karel Piwko created ARQ-1772:
--------------------------------
Summary: Arquillian Debug does not print real event class
Key: ARQ-1772
URL: https://issues.jboss.org/browse/ARQ-1772
Project: Arquillian
Issue Type: Bug
Security Level: Public (Everyone can see)
Components: Base Implementation
Affects Versions: 1.1.4.Final
Reporter: Karel Piwko
When using inheritance to define events, Arquillian Debug prints out following:
{code}
(E) PrepareDrone
(O) EventRegisterObserver.register
(O) DroneConfigurator.prepareDrone
(E) DroneConfigurationEvent
(O) EventRegisterObserver.register
(E) DroneConfigurationEvent
(O) EventRegisterObserver.register
(E) DroneLifecycleEvent
(O) EventRegisterObserver.register
(E) DroneLifecycleEvent
(O) EventRegisterObserver.register
(E) Before
(O) EventRegisterObserver.register
(O) DroneLifecycleManager.before
(E) DroneLifecycleEvent
(O) EventRegisterObserver.register
(E) DroneLifecycleEvent
(O) EventRegisterObserver.register
(O) DroneEnhancer.enhanceDrone
(E) DroneLifecycleEvent
(O) EventRegisterObserver.register
(E) DroneLifecycleEvent
(O) EventRegisterObserver.register
(O) DroneEnhancer.enhanceDrone
{code}
Which is not really super useful, as debug log can't show what actual events were fired.
--
This message was sent by Atlassian JIRA
(v6.2.3#6260)
10 years, 1 month
[JBoss JIRA] (ARQ-1771) Putting custom annotation on Drone creates multiple instances
by Stefan Miklosovic (JIRA)
[ https://issues.jboss.org/browse/ARQ-1771?page=com.atlassian.jira.plugin.s... ]
Stefan Miklosovic commented on ARQ-1771:
----------------------------------------
It seems that DroneTestEnricher#ensureInjectionPointPrepared parse Drone point without custom annotation, only @Drone and annotations with @Qualifier are treated so it thinks that @Drone @Mobile @Custom is different from @Drone @Mobile so it instantiates it for the second time with missleading log message.
> Putting custom annotation on Drone creates multiple instances
> -------------------------------------------------------------
>
> Key: ARQ-1771
> URL: https://issues.jboss.org/browse/ARQ-1771
> Project: Arquillian
> Issue Type: Bug
> Security Level: Public(Everyone can see)
> Components: Extension - Drone
> Affects Versions: drone_2.0.0.Alpha1
> Reporter: Stefan Miklosovic
>
> I have a test case like this
> {code}
> @RunWith(Arquillian.class)
> @RunAsClient
> public class SomeTestCase
> {
> @Drone
> @Mobile
> @Custom
> private WebDriver mobile;
> // tests
> }
> {code}
> where @Custom is just an annotation:
> {code}
> @Retention(RetentionPolicy.RUNTIME)
> @Target({ ElementType.FIELD, ElementType.PARAMETER })
> public @interface Custom {
> }
> {code}
> it is _not_ annotated with @Qualifier.
> Realize that the same problem arise when using @OperateOnDeployment from Arquillian which is not annotated with @Qualifier neither.
> I am getting this:
> http://pastebin.com/raw.php?i=i9DVqeaC
> You see that InstrumentationPerformDecider.decidePerformingInstrumentation observes BeforeDroneInstantiated so when it is treated twice, you are going to instantiate two Drones which is another argument why Drone does it wrong.
> When I declare Drone injection like that, it results into two instances of WebDrivers so that means it instruments Android package twice with two Selendroids so that mean I am getting NoUniqueWebDriverException when I want to start some activity because from now on you have "by accident" two webdrivers instrumenting the same deployment as a result of a bug where putting custom annotation on Drone instantiates it twice.
--
This message was sent by Atlassian JIRA
(v6.2.3#6260)
10 years, 1 month
[JBoss JIRA] (ARQ-1771) Putting custom annotation on Drone creates multiple instances
by Stefan Miklosovic (JIRA)
Stefan Miklosovic created ARQ-1771:
--------------------------------------
Summary: Putting custom annotation on Drone creates multiple instances
Key: ARQ-1771
URL: https://issues.jboss.org/browse/ARQ-1771
Project: Arquillian
Issue Type: Bug
Security Level: Public (Everyone can see)
Components: Extension - Drone
Affects Versions: drone_2.0.0.Alpha1
Reporter: Stefan Miklosovic
I have a test case like this
{code}
@RunWith(Arquillian.class)
@RunAsClient
public class SomeTestCase
{
@Drone
@Mobile
@Custom
private WebDriver mobile;
// tests
}
{code}
where @Custom is just an annotation:
{code}
@Retention(RetentionPolicy.RUNTIME)
@Target({ ElementType.FIELD, ElementType.PARAMETER })
public @interface Custom {
}
{code}
it is _not_ annotated with @Qualifier.
Realize that the same problem arise when using @OperateOnDeployment from Arquillian which is not annotated with @Qualifier neither.
I am getting this:
http://pastebin.com/raw.php?i=i9DVqeaC
You see that InstrumentationPerformDecider.decidePerformingInstrumentation observes BeforeDroneInstantiated so when it is treated twice, you are going to instantiate two Drones which is another argument why Drone does it wrong.
When I declare Drone injection like that, it results into two instances of WebDrivers so that means it instruments Android package twice with two Selendroids so that mean I am getting NoUniqueWebDriverException when I want to start some activity because from now on you have "by accident" two webdrivers instrumenting the same deployment as a result of a bug where putting custom annotation on Drone instantiates it twice.
--
This message was sent by Atlassian JIRA
(v6.2.3#6260)
10 years, 1 month