Native Applications Testing - TestlumFramework/Testlum GitHub Wiki

๐Ÿ“ฒ Native Applications Testing with Testlum

Testlum allows you to perform native application testing just like web testing โ€” the structure and usage of commands remain largely consistent.

The main difference is that all native-specific actions must be wrapped inside the native tag.

โšก Special for Native Testing:
Native testing introduces 3 additional commands:

  • refresh
  • swipeNative
  • webview

โš ๏ธ Limitations in Native Testing:
The following commands available in web testing are not supported in native testing:

  • scroll
  • javascript
  • dropDown
  • include
  • hovers
  • switchToFrame
  • scrollTo
  • tab
  • hotKey
  • doubleClick

๐Ÿ”— Check the list of all available web commands

โœ… Native testing is still highly flexible and allows you to cover a wide range of mobile app scenarios effectively!

Example:

<native comment="Test native behavior">
    <input comment="Input user email" locator="login.email" value="[email protected]"/>
</native>

This structure keeps your testing process consistent, organized and adaptable for mobile-specific scenarios!

Special Native Commands

refresh

๐Ÿ”„ refresh

The refresh command is used to refresh the app interface if it supports "pull-to-refresh" functionality (e.g., swipe down to reload content).

โš™๏ธ Parameters

Parameter Type Required Default Description
comment String โœ… - Description of the refresh action being performed.
condition Boolean โŒ - Condition to decide if this step should be executed.
threshold Integer (ms) โŒ - Maximum allowed execution time; step fails if exceeded.

๐Ÿงช Example Usage

<refresh comment="Refreshing the app content"/>

โœ… Tip:

  • Use the refresh command on screens that implement swipe-to-refresh to ensure updated content is loaded.
  • Combine with a wait command if additional time is needed for the refreshed data to appear.
swipeNative

๐Ÿ‘† swipeNative

The swipeNative command simulates a swipe gesture, allowing you to swipe either across the entire page or inside a specific element.

โš™๏ธ Parameters

Parameter Type Required Default Description
comment String โœ… - Description of the swipe action.
direction String (up, down, left, right) โœ… - Direction of the swipe gesture.
type String (element or page) โœ… - Whether to swipe the full page or a specific element.
locator String โŒ (Required if type="element") - Locator for the UI element to swipe (only for element type).
percent Integer (1โ€“100) โŒ 70 Percent of the screen or element to swipe over.
quantity Integer โŒ 1 Number of consecutive swipes to perform.
condition Boolean Expression โŒ - Condition to decide if this step should be executed.
threshold Integer (ms) โŒ - Maximum allowed execution time; step fails if exceeded.
locatorStrategy String โŒ locatorId Custom locator strategy if needed (more info in Locators Guide).

๐Ÿงช Example Usage

Swipe on an Element

<swipeNative comment="Swipe an element to the right">
    <element comment="Swipe right on element" locator="profile.card" direction="right" percent="70" quantity="1"/>
</swipeNative>

Swipe Across the Page

<swipeNative comment="Swipe the page to the left">
    <page comment="Swipe left across the page" direction="left" percent="70" quantity="1"/>
</swipeNative>

โœ… Tip:

  • Use element swipes for containers or carousels.
  • Use page swipes for navigating through screens.
  • Adjust percent for shorter or longer swipe gestures.
webView

๐ŸŒ webView

The webView command switches the context to a web view, allowing you to interact with web content inside a native app.

โš™๏ธ Parameters

Parameter Type Required Default Description
comment String โœ… - Description of the action to switch to the web view.
condition Boolean Expression โŒ - Condition to decide if this step should be executed.
threshold Integer (ms) โŒ - Maximum allowed execution time; step fails if exceeded.

๐Ÿงช Example Usage

<webView comment="Switching to the webView">

    <input comment="Input user email" locator="login.email" value="[email protected]"/>

</webView>

โœ… Tip:
Use this command when you need to interact with web content embedded inside a native app, like a hybrid mobile app with web views.

๐Ÿ“ฑ Running Native Applications Tests: Platforms and Methods

Explore different ways to run and useful information for native tests:

โš ๏ธ **GitHub.com Fallback** โš ๏ธ