What is the approach to create a framework that should handle both Web and mobile app automation cases



  • I have an application which has web and mobile app (hybrid). Test cases are same for both but locators and actions are different. I would like to create a single automation framework that can handle both. How do I effectively create one? Please share your suggestions. TIA.



  • You can implement your page object as polymorphic interfaces, so your tests will run the same commands, but the underlying code is dispatched in runtime to the specific behavior.

    interface LoginPage {
    
       fun login();
    
    }
    
    class MobileLogin implements LoginPage {
        fun login() { ... }
    }
    
    
    class WebLogin implements LoginPage {
        fun login() { ... }
    }
    

    Then just use your Inversion of Control configuration to create the right object in run time. For Mobile:

    <?xml version = "1.0" encoding = "UTF-8"?>
    
    <beans xmlns = "http://www.springframework.org/schema/beans"
       xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation = "http://www.springframework.org/schema/beans
       http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
    
       <bean id = "MobileLoginPage" class = "..." />
       <bean id = "MobileUserPage" class = "..." />
    
    </beans>
    

    For Web:

    <?xml version = "1.0" encoding = "UTF-8"?>
    
    <beans xmlns = "http://www.springframework.org/schema/beans"
       xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation = "http://www.springframework.org/schema/beans
       http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
    
       <bean id = "WebLoginPage" class = "..." />
       <bean id = "WebUserPage" class = "..." />
    
    </beans>
    


Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2