Native Applications Testing - TestlumFramework/Testlum GitHub Wiki
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
โ Native testing is still highly flexible and allows you to cover a wide range of mobile app scenarios effectively!
<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!
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).
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. |
<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
The swipeNative
command simulates a swipe gesture, allowing you to swipe either across the entire page or inside a specific element.
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). |
<swipeNative comment="Swipe an element to the right">
<element comment="Swipe right on element" locator="profile.card" direction="right" percent="70" quantity="1"/>
</swipeNative>
<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
The webView
command switches the context to a web view, allowing you to interact with web content inside a native app.
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. |
<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.
Explore different ways to run and useful information for native tests: