[arquillian-issues] [JBoss JIRA] (ARQ-1771) Putting custom annotation on Drone creates multiple instances
Stefan Miklosovic (JIRA)
issues at jboss.org
Mon May 12 04:53:56 EDT 2014
[ https://issues.jboss.org/browse/ARQ-1771?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12967002#comment-12967002 ]
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)
More information about the arquillian-issues
mailing list