1

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.

  • Why do you want the single framework? Would it not make more sense to have layers that have known communication methods? – Kate Paulk Jan 17 at 18:37
1

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>
| improve this answer | |
0

Why not use a simple existing framework like testRigor? You can not only use the same language interchangeably, but it is very easy to build cross-web-and-mobile test cases. The test would look like this:

login
generate email and enter into "Email"
enter "Password123" into "Password"
tap "Sign Up"
validate that email had been received
check that page contains button "Confirm Email"
click "Confirm Email"
check that page contains "Email confirmed"

Disclaimer: I'm a co-founder of testRigor.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.