appium / java-client

Java language binding for writing Appium Tests, conforms to W3C WebDriver Protocol

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Enhancement] Spring configuration, beans and aspects vs EventFiringWebdriver

TikhomirovSergey opened this issue · comments

The Selenium project has an interesting solution,
EventFiringWebDriver:

Everything is cool but I think there are disadvantages for Appium users:

  • this implementation restricts the using of mobile-specific functions till
AppiumDriver d = (AppiumDriver) eventFiringWebDriver.getWrappedDriver();

The same is true for elements

MobileElement e = (MobileElement) ((WrapsElement) element).getWrappedDriver();
  • almost all interfaces which are nested in WebDriver has protected/private implementations here. So an end user has to duplicate the present code when there is need to extend it

What is supposed to be designed:

  • it is supposed that the WebDriverEventListener interface will be reused. Also it would be cool if there were interfaces whose implementations allow to listen to (optionally) events of alerts, windows, contexts and so on.
  • To design a solution which has linear architecture. It would be cool to use Spring & AspectJ here.
    http://www.mkyong.com/spring3/spring-aop-aspectj-annotation-example/

Isn't it very strict to depend on Spring and AspectJ for proxifying objects for logging and other features?

@GiannisPapadakis
Why not? :)

It would be good to have same AndroidDriver/IOSDriver or MobileElement with subclasses that also provide an ability to log events implicitly. Spring and AspectJ provide ability to create proxies of whole classes (not only interfaces) and implement that logging architecture in transparent and linear style.

There are probably another suitable tools...

It is ok with this solution of course. There are a lot of possibilities for Spring AOP to cover. You need of course to have a bean lifecycle. I could try some examples and review together if you want.

@GiannisPapadakis
So do you consider that Spring could be more widely used in java_client? You are right definitely. The logging is just the most obvious capability :)

Of course it would be great to have Spring features into java_client. But careful design should be approached in order to expose ApplicationContext and referenced beans correctly.

Ok. I've got and this will be kept in mind.
For now this feature is being just imagined. Also there is some dependency on few PR's to Selenium...