Examples of App Activity Usage in Appium Testing

Here are a few examples to demonstrate the use of App Activity in Appium Testing:

1. When Testing Different User Flows

Sometimes the Android app may have different flows that a user can go through. This includes Mobile Games which have different flows for different users depending on their game level for example. To do this, we can use a set of conditional statements:

Kotlin




if (userFlow.equals("flowA")) {
    capabilities.setCapability("appActivity", "com.example.sampleapp.ActivityA")
} else if (userFlow.equals("flowB")) {
    capabilities.setCapability("appActivity", "com.example.sampleapp.ActivityB")
}


2. Navigating To A Specific Screen

To allow the test to be executed on a specific screen, the Appium Screen can be configured like this:

Kotlin




capabilities.setCapability("appActivity", "com.example.sampleapp.LoginActivity")


The test here will thus execute at the Login Screen that is represented by LoginActivity. This eliminates any redundant Navigation.

3. When Testing Specific Functionality

Not only is it possible to test the specified screen but also possible to test specific functionality. For example, the Login/Logout functionality on a specified screen could be tested as shown:

Kotlin




driver.findElementById("logoutButton").click()
capabilities.setCapability("appActivity", "com.example.sampleapp.LoginActivity")


Understanding App Activity in Appium | How it Works, Importance, Best Practices

Appium is integral to UI Automation within different domains in Tech: Mobile, Web, and even Desktop. The platform aims to streamline Software Testing through the following goals as outlined by its creators:

  1. Make platform-specific automation capabilities available under a cross-platform, standard API.
  2. Allow easy access to this API from any programming language.
  3. Provide tools to enable convenient community development of Appium extensions.

Appium is a suitable choice for Mobile Developers who want to benefit from the automation of UI Testing due to its ease of use and versatility. This article seeks to define what App Activity is in the context of Appium and Android.

Similar Reads

Understanding App Activity in Appium

Android...

Importance of App Activity in Mobile App Testing

It is time to dive deeper into why App Activity is important in Appium. Here are some of the points of importance of App Activity in Appium:...

How App Activity Works in Appium?

As we now know why we should include App Activity in our Appium Tests, let us now explore the process in which App Activity works in Appium:...

Configuring App Activity in Appium

Configuring the App Activity in Appium is a straightforward process that is easily replicable. To demonstrate the application of App Activity in Appium, here is the documentation of a sample UI Test using UIAutomator2 in Android:...

Examples of App Activity Usage in Appium Testing

...

Best Practices for Managing App Activity in Appium

Here are a few examples to demonstrate the use of App Activity in Appium Testing:...

Conclusion

...

Contact Us