How to reuse stepdefinations and pageobjects in Reactnative app's test automation?

Viewed 305

I have created a Java-Cucumber framework, which uses Cucumber-JVM, appium, java, maven for running automation scenarios on ReactNative driven App. So, using ReactNative we've Android & iOS apps.

The framework is based on Selenium Multibrowser concept, where driver once instanciated ( for a browser) can make use of existing page objects.

Issue 1: Whereas in case of Mobile, Although Page Object methods are same, but locators for IOS & Android are different. [I have not used Page factory (@Findby annotations) So, I would like to know how could I reuse the page object methods written of the iOS, for Android? Issue 2: I have used Pico-Container for seeding Page objects into Step-defs. World is instanciated in BaseClass which is parent class of both Android & iOS Stepdefs. But If I invoke, page objectmager in Android step defs then getting NullPointer exception.

Issue 3: Using Cucumber how to reuse the step-defs implementation of the iOS for Android?

We use Singleton pattern for Appium driver instantiation.

1 Answers

You should take a look to QAF which is designed to support web, mobile and web-service functional test automation with different test authoring way including BDD.

With locator repository concept with resource management you can utilize same code/page.

More over you can reuse step implementation within project for different platform or across the projects (common reusable steps packaged in jar and added jar in project). If because of functionality difference step have different implementation for different platform, you can manage it by having step implementation in different package. In such case you can configure step provider package at the time of execution.

To be brief you can achieve highest level of re-usability by employing different concepts provided by the framework.

Related