Address behaviour changes across platforms
Ekam provides the capability of running same test in Android and iOS platforms.
SwitchView
It may so happen that, the behaviour of application could differ in Android and iOS platforms. IOSSwitchView
helps to over-ride the behaviour in iOS for this purpose.
Example: Let us assume the behaviour of Login differs in Android and iOS platforms.
Steps:
1. Create new class `LoginView` extending from `LoginScreen`
2. Provide new implementation for `login` method in `LoginView`
3. Specify `IOSSwitchView` annotation to `login` method of `LoginScreen` class
The below line specifies that the method is being over-ridden@IOSSwitchView(view = LoginView.class)
LoginView.class
is the class where the over-ridden method is defined
public class LoginScreen extends MobileScreen {
@MobileStep(keyword = "When", description = "I login")
@IOSSwitchView(view = LoginView.class)
public void login() {
// Define behaviour on Android here
}
}
public class LoginView extends LoginScreen {
@Overide
@MobileStep(keyword = "When", description = "I login")
public void login() {
// Over-ride behaviour on iOS here
}
}
- When test is executed on Android,
login
method ofLoginScreen
class would be consumed. - When the same test is executed on iOS,
login
method ofLoginview
class would be consumed.
The same test now can be executed against Android and iOS platforms.
In absence of Ekam, we had to create two different repositories and two different tests - One for Android and one for iOS. Ekam saves 50% of efforts, as you now can have one repositiry and one test.