Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion Docs/source/pages/alttester-editor.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ In the following sections you can see a breakdown of all the sections in the GUI

Will add "ALTTESTER" to the scripting define symbols. This is usually done automatically when entering in play mode or building the application. This option is not recommended if you are developing your application but can be used if you are on a branch where you only write tests.

- *Keep AltTester® prefab in scene*:

When enabled, if the AltTester® Prefab is already present as a root object in the active scene it will be kept untouched — no new prefab is created. If the prefab is not present in the scene, it will be inserted automatically. When this option is disabled (default), the prefab is removed and recreated on each Play/Stop cycle, matching the previous behavior.

- *AltTester® Server Host*

Refers to the host the AltTester® Server is listening on.
Expand All @@ -67,6 +71,11 @@ In the following sections you can see a breakdown of all the sections in the GUI
Refers to the port the AltTester® Server is listening on.
You can change this value and make a new app build if you want to use another port.

- *App Name*

Refers to the name used to identify the app on the AltTester® Server.
You can change this value and make a new app build if you want to use another app name.

- *Reset Connection Data*

In case you are building your app on the same device but you do not want to start the new build with the connection data from the old build, you will want to check this box. Even if you managed to connect to the old build with different data, your new build will use the host, port, app name, and secure mode specified in the Build Settings.
Expand All @@ -86,7 +95,11 @@ In the following sections you can see a breakdown of all the sections in the GUI
- MacOS: Press <kbd>Ctrl</kbd> + <kbd>Opt</kbd> + <kbd>T</kbd>
- Mobile (Android/iOS): Hold three fingers on the screen for one second.

- *Secure Mode (WSS)*
- *Show Native Popup Option* [Non-GPL]

Determines whether the native popup is displayed at startup on Android, iOS, and WebGL platforms. This popup allows changing connection data through Appium or Selenium.

- *Secure Mode (WSS)* [Non-GPL]

Enables or disables secure communication between the instrumented application
and the AltTester® Server.
Expand Down
103 changes: 98 additions & 5 deletions Docs/source/pages/alttester-with-appium.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
# Running tests together with Appium
# Running tests together with Appium / Selenium

When it comes to mobile automation testing, there are many different choices for a test tool. One popular option is [Appium](http://appium.io), an open source project which enables running automated tests on both **Android** and **iOS** devices.
AltTester® Unity SDK can be used together with different automation frameworks depending on your target platform:

- **[Appium](http://appium.io)** for mobile automation testing on **Android** and **iOS** devices
- **[Selenium](https://www.selenium.dev/)** for **WebGL-based** builds running in web browsers

Both are open source projects that enable automated testing and can be used alongside AltTester® Unity SDK to handle platform-specific interactions and operations that AltTester® Unity SDK cannot perform directly.

## Appium - Mobile Testing (Android & iOS)

When it comes to mobile automation testing, [Appium](http://appium.io) is a popular choice for automating tests on both **Android** and **iOS** devices.

No registration is needed and you can either download the latest version of the standalone app [here](https://github.com/appium/appium-desktop/releases/), or you can install the cli version by running:

Expand All @@ -11,16 +20,16 @@ No registration is needed and you can either download the latest version of the
> appium & # start appium
```

We've created an example python project which can be found [here](https://github.com/alttester-test-examples/Python-Android-with-Appium-AltTrashCat-) which hopefully can get you started on your own projects. Using it will also automatically install the requirements needed for running the tests. More details about it [below](#alttester-unity-sdk-with-appium-example).
We've created an example Python project which can be found [here](https://github.com/alttester-test-examples/Python-Android-with-Appium-AltTrashCat-) This project demonstrates a working setup and includes the necessary dependencies. More details about it [below](#alttester-unity-sdk-with-appium-example).

## Why use Appium together with AltTester® Unity SDK
### Why use Appium together with AltTester® Unity SDK

There's a couple of reasons/scenarios for which you would want to use both of these frameworks:

- By itself, AltTester® Unity SDK cannot launch an app on a device. If you want to run tests in a pipeline, or by using [cloud services](./alttester-with-cloud), you can either create a script which will start your app, or you can use Appium before the tests execution;
- AltTester® Unity SDK cannot perform some types of actions, such as interacting with any native popups your app might have, or putting the app in the background and resuming it. In any of these cases you can use Appium to do the things that AltTester® Unity SDK can't.

## AltTester® Unity SDK with Appium example
### AltTester® Unity SDK with Appium example

After you cloned our example project, there are a couple of things you need to check before running the tests:

Expand Down Expand Up @@ -59,3 +68,87 @@ The script will install any requirements that are missing from your machine (exc
3. The Appium driver needs to be created before the reverse port forwarding needed by AltTester® Unity SDK is done. This is because Appium clears any other reverse port forwarding when it starts.

```

## Selenium - WebGL Testing

[Selenium](https://www.selenium.dev/) is a powerful automation framework for web browsers. When running AltTester® Unity SDK on WebGL builds, Selenium allows you to automate browser interactions and handle web-specific operations that complement AltTester® Unity SDK's game automation capabilities.

### Why use Selenium together with AltTester® Unity SDK

There are several scenarios where you would want to use Selenium with AltTester® Unity SDK for WebGL builds:

- By itself, AltTester® Unity SDK cannot handle browser-specific operations such as opening new tabs, managing cookies, or interacting with browser dialogs;
- Selenium provides robust browser management and can handle native browser popups and dialogs that AltTester® Unity SDK cannot interact with;
- You can use Selenium to perform cross-browser testing of your WebGL builds on different browsers (Chrome, Firefox, Safari, Edge, etc.);
- Selenium allows you to automate tasks before launching your WebGL application, such as logging in on a web page or navigating to a specific URL.

## Connection settings popup for Appium / Selenium flows

When running AltTester® Unity SDK builds in the cloud and driving them with Appium or Selenium, you might not know in advance which app name to use from your test scripts to connect to the correct instrumented instance. To address this, AltTester® Unity SDK provides an optional native connection settings popup that can be shown in the app.

The popup allows you to:

- Enter the AltTester® Server host;
- Enter the AltTester® Server port;
- Enter the app name that will be used by the tests when connecting;
- Check "Don't show this again" to prevent the popup from appearing on subsequent launches.

Because the popup is built using native UI elements, you can fully interact with it from Appium or Selenium: locate the fields and buttons using your preferred locator strategy (for example accessibility id, xpath, or text), type the desired host, port and app name values, and confirm the dialog before starting your AltTester® tests.

Whether this popup is shown or not is controlled by a dedicated setting in AltTester® Unity SDK. Enable this setting when you want the popup to appear (for example in cloud/Appium/Selenium runs where connection details are provided dynamically), and disable it when you prefer to configure connection parameters directly in your game or test code without any additional UI.

### Examples: identifying and interacting with the popup in Appium / Selenium

```eval_rst

.. tabs::

.. tab:: Appium
Below is a simple example that shows how you can identify and fill in the connection settings popup with Appium before starting your AltTester® tests.

.. tabs::
.. tab:: C#

.. literalinclude:: ../_static/examples~/appium/csharp-appium.cs
:language: c#

.. tab:: Java

.. literalinclude:: ../_static/examples~/appium/java-appium.java
:language: java

.. tab:: Python

.. literalinclude:: ../_static/examples~/appium/python-appium.py
:language: py

.. tab:: Robot

.. literalinclude:: ../_static/examples~/appium/robot-appium.robot
:language: robot

.. tab:: Selenium
Below is a simple example that shows how you can identify and fill in the connection settings popup with Selenium before starting your AltTester® tests.

.. tabs::
.. tab:: C#

.. literalinclude:: ../_static/examples~/selenium/csharp-selenium.cs
:language: c#

.. tab:: Java

.. literalinclude:: ../_static/examples~/selenium/java-selenium.java
:language: java

.. tab:: Python

.. literalinclude:: ../_static/examples~/selenium/python-selenium.py
:language: py

.. tab:: Robot

.. literalinclude:: ../_static/examples~/selenium/robot-selenium.robot
:language: robot

```
Loading
Loading