Mobile Testing Plugin/en: Unterschied zwischen den Versionen

Aus expecco Wiki (Version 2.x)
Zur Navigation springen Zur Suche springen
(→‎Windows: new supplement version)
 
(167 dazwischenliegende Versionen von 4 Benutzern werden nicht angezeigt)
Zeile 1: Zeile 1:
[[Mobile_Testing_Plugin|Deutsche Version]] | '''English Version'''

= Introduction =
= Introduction =
Use the "''Mobile Testing Plugin''" to test and automate applications on Android- and iOS devices. This includes both real and emulated devices.
With the ''Mobile Testing Plugin'' applications can be tested on Android and iOS devices. This includes both real and emulated devices. It does not matter whether real mobile devices or emulated devices are used. The plugin can (and usually is) used in conjunction with the [[Expecco_GUI_Tests_Extension_Reference|GUI-Browser]], which supports the creation of tests. It can also be used to record test procedures.
The plugin can be used together with the [[Expecco_GUI_Tests_Extension_Reference|GUI-Browser]], which supports the creation of tests and activities of GUI applications. In addition, it supports recording of action sequences.


The physical connection and protocol used is [http://appium.io/ Appium, which is a free open source framework for test and automation of mobile devices.
[http://appium.io/ Appium] is used to connect to the devices. Appium is a free open source framework for testing and automating mobile applications.


We recommend that the [[#Tutorial|Tutorial]] examples are tried to get started. This gives you step-by-step examples on the typical test-case creation procedure and provides additional background information.
We recommend to go through the [[Mobile_Testing_Tutorial/en|Tutorial]] to familiarize yourself with the Mobile Plugin. This tutorial leads step by step through the creation of a test case using an example and explains the necessary basics.


= Installation and Setup =
= Installation and Setup =
To use the ''Mobile Testing Plugin'', you must have installed expecco together with the corresponding plugin, and you'll need a license. In addition, the Appium framework and especially the Appium server must be installed either on the local or on a remote machine. expecco communicates with the mobile devices through this Appium server.
To use the ''Mobile Testing Plugin'', you must have installed expecco together with the corresponding plugin, and you need the appropriate licenses. expecco communicates with the mobile devices via an Appium server, which either runs on the same computer as expecco, or on a second computer. This must be accessible for expecco.
Please make sure that the server is reachable in case of firewalls or other network limitations.


'''Installation overview for expecco 18.1:'''
== Installation Overview ==
'''Computer running expecco:'''
* Appium-Server<sup>a</sup> 1.6.4 for Android
* Java JDK version 8, 9, 10 or 11
* Appium-Server<sup>b</sup> 1.8.0 for iOS
'''Computer connected to Android devices :'''
for Android-devices starting with version 4.3:
* Appium Server, you can install it via the Mobile Testing Supplement (see below), of which we regularly provide a new version
* Java JDK<sup>a</sup> Version 7, 8 or 9
* Android SDK, you can also get it with the Mobile Testing Supplement
* Android SDK<sup>a</sup>
for iOS-devices starting with version 9.3:
* Java JDK version 8, 9, 10 or 11
'''Computer connected to iOS devices<sup>*</sup>:'''
* Xcode 9.3.x
* Appium Server, you can install it via the Mobile Testing Supplement for MacOS (see below), of which we regularly provide a new version
* Apple-Developer-Certificate incl. matching private key
* Xcode in a version that supports the iOS version used, available from the Apple App Store
* Java JDK version 8, 9, 10 or 11
* Apple Developer Certificate incl. matching private key (to sign the WebDriverAgent)
* Provisioning Profile for the mobile devices to be used
* Provisioning Profile for the mobile devices to be used
(<sup>a</sup>) contained in Mobile Testing Supplement<br>
(<sup>b</sup>) contained in Mobile Testing Supplement for Mac OS


<sup>*</sup> Please note that due to the requirements (no connection to non-Apple devices available) iOS devices can only be controlled from a Mac.
'''Installation overview for expecco 2.11:'''
* Appium-Server<sup>ab</sup> 1.6.4
for Android-devices starting with version 4.3:
* Java JDK<sup>a</sup> Version 7 or 8
* Android SDK<sup>a</sup>
for iOS-devices starting with version 9.3:
* Xcode 8.3.x
* Apple-Developer-Certificate incl. matching private key
* Provisioning Profile for the mobile devices to be used
(<sup>a</sup>) contained in Mobile Testing Supplement<br>
(<sup>b</sup>) contained in Mobile Testing Supplement for Mac OS


Depending on the setup, the above-mentioned computers can also be the same device. expecco can either connect to a remote Appium Server and mobile devices connected to it via the network, or start an Appium Server locally itself and use it with local mobile devices. However, some of expecco's functions that make it easier to create test cases are only available if the mobile devices are connected to the same computer on which expecco is running. A possible setup may therefore look like the following figure:
'''Installation overview for expecco 2.10:'''
* Appium-Server<sup>ab</sup> 1.4.16
for Android-devices starting with version 2.3.3 up to version 6.0:
* Java JDK Version<sup>a</sup> 7 or 8
* Android SDK<sup>a</sup>
for iOS-devices up to version 9.3:
* Xcode 7.3.x
* Apple-Developer-Certificate <sup>c</sup> incl. matching private key
* Provisioning Profile<sup>c</sup> for the mobile devices to be used
(<sup>a</sup>) contained in Mobile Testing Supplement<br>
(<sup>b</sup>) contained in Mobile Testing Supplement for Mac OS<br>
(<sup>c</sup>) in order to sign the appp

Please note, that it is only possible to control iOS devices from a MAC computer. expecco is able to connect to any Appium server running anywhere in your network, in order to talk to an iOS device. The following chapters will describe the installation procedure both for Windows and Mac OS machines.


[[Datei:MobileTestingAufbau.png | 400px]]
[[Datei:MobileTestingAufbau.png | 400px]]

The following explains how to install Appium and other necessary applications for Windows and Mac OS.


== Windows ==
== Windows ==
The easiest way is to install everything from our Mobile Testing Supplement. However, newer versions do not contain a JDK anymore due to a change in Oracle's license terms, so you have to install it additionally. Of course, you are free to install Appium directly to use the version you want. However, to then be able to start an Appium server with expecco, a suitable batch file must be available and specified in the [[Mobile_Testing_Plugin/en#Plugin_Configuration|settings]]. However, connections can also be established to other running Appium servers.
The easiest way is to install everything from our Mobile Testing Supplement:
*'''expecco 18.2''': [http://download.exept.de/transfer/h-expecco-18.2.0/MobileTestingSupplement.exe Mobile Testing Supplement 1.7.3.0]
*'''expecco 23.2''': [https://download.exept.de/transfer/h-expecco-23.2.0/MobileTestingSupplement.exe Mobile Testing Supplement 1.13.3.2]
:Same versions as in the predecessor, but with updated chromedriver versions
:This installs Appium version 1.8.1. In addition, an installation of ''Android Debug Bridge'' and ''Google USB Driver'' ([https://gsmusbdrivers.com/download/adb-fastboot-drivers/ adb-setup-1.4.3]) is offered. This covers drivers for a broad range of Android devices, and you won't have to install an individual driver for each device. A '''JDK is not contained anymore''', you have to download it on your own, e.g. from [https://www.oracle.com/technetwork/java/javase/downloads/index.html Oracle].
*expecco 23.1: [https://download.exept.de/transfer/h-expecco-23.1.0/MobileTestingSupplement.exe Mobile Testing Supplement 1.13.3.1]
:Same versions as in the predecessor, but the installer now allows to add Appium to the Autostart.
*expecco 22.2 and 22.1: [https://download.exept.de/transfer/h-expecco-22.1.0/MobileTestingSupplement.exe Mobile Testing Supplement 1.13.2.0]
:Appium 1.22.3*
:Node 14.17.5
:adb 1.0.41 from platform-tools 33.0.2
:''* We added the capability'' startChromedriverTimeout ''to Appium, to get a timeout earlier, if Chromedriver cannot be initialized. (see [[#startChromedriverTimeout|Problems and Solutions]])''
*expecco 21.2: [https://download.exept.de/transfer/h-expecco-21.2.0/MobileTestingSupplement.exe Mobile Testing Supplement 1.12.0.0]
:Contains Appium version 1.22.0, Node still is version 12.13.1.
*expecco 20.1: [https://download.exept.de/transfer/h-expecco-20.1.0/MobileTestingSupplement.exe Mobile Testing Supplement 1.10.1.0]
:Only minor changes compared to the previous version.
*expecco 19.2: [http://download.exept.de/transfer/h-expecco-19.2.0/MobileTestingSupplement.exe Mobile Testing Supplement 1.10.0.0]
:Compared to the previous version, Appium was updated to version 1.16.0-rc.1 and node 12 is used.
*expecco 19.1: [http://download.exept.de/transfer/h-expecco-19.1.0/MobileTestingSupplement.exe Mobile Testing Supplement 1.8.1.0]
:This installs Appium in the version 1.12.0 and now additionally contains build-tools in the version 28.0.3 in the android-sdk. Apart from this, it is the same as the previous version.
*expecco 18.2: [http://download.exept.de/transfer/h-expecco-18.2.0/MobileTestingSupplement.exe Mobile Testing Supplement 1.7.3.0]
:This installs Appium in the version 1.8.1. In addition, an installation of ''Android Debug Bridge'' and ''Google USB Driver'' ([https://gsmusbdrivers.com/download/adb-fastboot-drivers/ adb-setup-1.4.3]) is offered. This covers drivers for a broad range of Android devices, and you won't have to install an individual driver for each device. A '''JDK is not contained anymore (due to a change in Oracle's license terms)''', you have to download it on your own, e.g. from [https://www.oracle.com/technetwork/java/javase/downloads/index.html Oracle].
*expecco 18.1: same procedure as for expecco 2.11
*expecco 18.1: same procedure as for expecco 2.11
*expecco 2.11: [http://download.exept.de/transfer/h-expecco-2.11.1/MobileTestingSupplement_1.6.0.2_Setup.exe Mobile Testing Supplement 1.6.0.2]
*expecco 2.11: [http://download.exept.de/transfer/h-expecco-2.11.1/MobileTestingSupplement_1.6.0.2_Setup.exe Mobile Testing Supplement 1.6.0.2]
:This installs a Java JDK Version 8, android-sdk and Appium Version 1.6.4. In addition, installation of a universal adb-driver is offered ([http://download.clockworkmod.com/test/UniversalAdbDriverSetup.msi ClockworkMod]). This driver supports a wide range of Android Devise, and avoids the need to search for individual device-specific drivers.
:This installs a Java JDK Version 8, android-sdk and Appium Version 1.6.4. The supplement also offers a universal adb driver ([http://download.clockworkmod.com/test/UniversalAdbDriverSetup.msi ClockworkMod]). This driver supports a wide range of Android Devise, and avoids the need to search for individual device-specific drivers.
*expecco 2.10: [http://download.exept.de/transfer/h-expecco-2.10.0/Mobile_Testing_Supplement_1.5.0.0_Setup.exe Mobile Testing Supplement 1.5.0.0]
*expecco 2.10: [http://download.exept.de/transfer/h-expecco-2.10.0/Mobile_Testing_Supplement_1.5.0.0_Setup.exe Mobile Testing Supplement 1.5.0.0]
:This installs a Java JDK Version 8, android-sdk and Appium Version 1.4.16. During the installation, the Appium GUI will appear, which you can close immediately. In addition, installation of a universal adb-driver is offered ([http://download.clockworkmod.com/test/UniversalAdbDriverSetup.msi ClockworkMod]). This driver supports a wide range of Android Devise, and avoids the need to search for individual device-specific drivers.
:It installs a Java JDK version 8, android-sdk and Appium version 1.4.16. During the installation the graphical user interface of Appium is started, you can close this window immediately. The supplement also offers a universal adb driver (ClockworkMod). This combines drivers for a wide range of Android devices so that you do not have to search for and install a separate driver for each device.


If expecco has to use mobile devices that are connected to another computer, you have to start an Appium server there. You can do this by using the file <code>appium_standalone.cmd</code>. The server is then started on default port 4723. If you want to use a different port number, start the server with
When Appium is started, it may happen that the Windows firewall blocks access to the Node-Server, and expecco cannot start/connect to the Appium server. To verify correct operation after the installation, run the "appium.cmd" program found in the "appium" folder of the ''Mobile Testing Supplement''. If that works on the command line, it should also be ok for expecco. If not (any error messages from the firewall), you should allow access via the Windows firewall settings.

appium_standalone.cmd -p <portnummer>

The server is ready, as soon as the line
<blockquote>Appium REST http interface listener started on 0.0.0.0:4723</blockquote>
is displayed, where you can read the used port number at the end.

If your Android device is connected to a remote machine,
you may want to see the live screen locally using a tool like
[https://github.com/Genymobile/scrcpy scrcpy].


When Appium is started for the first time – either standalone or by expecco – it may happen that the Windows firewall blocks access to the node server. Allow the access or Appium cannot be started.


== Mac OS ==
== Mac OS ==
Note: the following can be ignored if you do not plan to test iOS (iPhone) devices. The Mac setup is not needed for Android devices.
Note: the following can be ignored if you do not plan to test iOS (iPhone) devices. The Mac setup is not needed for Android devices.


=== expecco 18.1 ===
=== Xcode ===
Automation with iOS devices needs [https://developer.apple.com/xcode/ Xcode]. You can install it from the App Store. Please make sure that the version matches the tested iOS versions.
We provide an updated [http://download.exept.de/transfer/h-expecco-18.1.0/Mobile_Testing_Supplement_for_Mac_OS_1.1.94.tar.bz2 Mobile Testing Supplement für Mac OS (1.1.94)], which includes Appium 1.8.0. For devices with IOS 11 and newer, you'll also need Xcode 9, with at least a corresponding minor version number, i.e. Xcode 9.3 für iOS 11.3. Other than that, the setup is the same as with expecco 2.11.
{| class="wikitable"
|-
|'''iOS'''&nbsp;&nbsp;
|'''Xcode'''
|'''macOS'''
|-
|10.x
|8.x
|10.12 (Sierra)
|-
|11.x
|9.x
|10.13 (High Sierra)
|-
|12.x
|10.x
|10.14 (Mojave)
|-
|13.x
|11.x
|10.15 (Catalina)
|-
|14.x
|12.x
|11.0 (Big Sur)
|-
|15.x
|13.x
|12.0 (Monterey)
|-
|16.x
|14.x
|12.5 (Monterey)
|}
This table is only a simplified overview, better see [https://xcodereleases.com/ Xcode releases] or [https://en.wikipedia.org/wiki/Xcode#Version_comparison_table Xcode versions] for the exact versions. For new iOS minor versions, there is usually also a new release of Xcode, e.g. for iOS 10.2 you need at least Xcode 8.2, for iOS 10.3 at least Xcode 8.3, etc. So if you are upgrading to a newer iOS version, you will usually need a newer Xcode version as well. Newer versions of Xcode may not run on older operating systems, which in turn may require an operating system upgrade. If you also want to test older iOS versions, it can be useful to install the corresponding Xcode versions in parallel.


=== expecco 2.11 ===
=== Appium ===
You can install Appium either as command-line tool or use it with [https://github.com/appium/appium-desktop Appium Desktop], which provides a GUI to start the server. Meanwhile there is also Appium 2.0, which is not tested with expecco yet and therefore not recommended to use.
The used Mac should have OS X 10.12 (Sierra) and Xcode 8.3 or newer installed. Xcode can be installed from the App Store. In addition, a Java installation is required by Appium. For that, install a JDK in Version 7 or 8. Then install Appium 1.6.4 using our [http://download.exept.de/transfer/h-expecco-2.11.1/Mobile_Testing_Supplement_for_Mac_OS_1.0.94.tar.bz2 Mobile Testing Supplements for Mac OS (1.0.94)]. After the download, move it to any folder (eg. your Home directory) and unpack it in a terminal window. A shell command to do this could be:


==== Appium Desktop ====
tar -xvpf Mobile_Testing_Supplement_for_Mac_OS_1.0.94.tar.bz2
Download the newest version of [https://github.com/appium/appium-desktop/releases/ Appium Desktop]. For the Mac, it is best to take the dmg file and install it to the applications. When starting ''Appium Server GUI'' you will probably get the error message, that it is not possible for security reasons. In this case, open the context menu of the app file (right click or Ctrl + click) and choose ''Open'' there. Then confirm that you really want to open the application. From now on you can open the application normally.


[[Datei:OpenAppiumServerGUI1.png|text-top]] [[Datei:OpenAppiumServerGUI2.png|text-top]]
''Note: To automate iOS devices starting with version 10, the installation of a comparable new Xcode8 is always a prerequisite (i.e. for iOS 10.'''2''' at least. Xcode 8.'''2''', for iOS 10.'''3''' at least. Xcode 8.'''3''', etc.). Newer Xcode versions usually will not run on older iOS versions, which means that you may have to upgrade the OS version in order to be able to run a newer Xcode version. And vice versa, if you upgrade your iOS version, you may have to upgrade the Xcode version as well. (see also [https://en.wikipedia.org/wiki/Xcode#Version_comparison_table Xcode-Versionen]).''


Since Xcode 14 there are problems with signing the WebDriverAgent, which Appium loads on the device for the automation. This means that no connection is possible with version 1.22.3-4 of Appium Desktop. In newer versions of WebDriverAgent, this problem is solved, but currently there is no version of Appium Desktop using such a new version (as of November 2022). However, you can manually download a new version (e.g. 4.10.2) and replace the files in Appium. To do this, download one of the two archive files (zip or tar.gz) containing the source code from the [https://github.com/appium/WebDriverAgent/releases/ WebDriverAgent download page]. Then open and extract this file. Copy the contents of the folder ''WebDriverAgent-4.10.2' to
If your standard Xcode Installation is Xcode 8.3, Appium can be directly started with:
Mobile_Testing_Supplement/bin/start-appium-1.6.4
If you have a different Xcode as standard, you'll have to define the path in the ''''DEVELOPER_DIR'''' environment variable. For example, if Xcode8.3 is installed in ''''/Applications/Xcode-8.3.app'''', you would have to start appium with:
DEVELOPER_DIR="/Applications/Xcode-8.3.app/Contents/Developer" Mobile_Testing_Supplement/bin/start-appium-1.6.4
To find out, which Xcode version is currently your default, enter the following command in a terminal window:
xcode-select -p
If Appium cannot find your Xcode installation, a message appears like:
''<blockquote>org.openqa.selenium.SessionNotCreatedException - A new session could not be created. (Original error: Could not find path to Xcode, environment variable DEVELOPER_DIR set to: /Applications/Xcode.app but no Xcode found)</blockquote>''
In that case, try again after correction of the ''''DEVELOPER_DIR'''' path setting.


/Applications/Appium\ Server\ GUI.app/Contents/Resources/app/node_modules/appium/node_modules/appium-webdriveragent/
To connect to an iOS device, you'll need an Apple account. For evaluation, you can use a (cost-) free private account. However, this has the big disadvantage, that the profiles are only valid for a single week and need to be recreated after that time period. Be careful when sharing accounts with others, as it may happen that certificates are invalidated by automatic generation. As a result, apps which were already signed may cease to be startable.


If you navigate there by Finder, make a context click (right click or Ctrl + click) on the application and choose ''Show Package Contents'' from the menu. Replace all files that are already present with the same name.
Step by step connection procedure:
* connect the iOS device via USB to the Mac.
* start Xcode and open ''Preferences''.
* switch to the "Accounts" page and add an entry for your account.
* go to ''Manage Certificates...'', to see (and check) the certificates which are associated with that account.
* in order to execute a test on the device, you'll need an iOS-development certificate and a matching private key. If there is none yet present, create a certificate now.
* if there is already a certificate, but it is not yet in your keychain (indicated by a "Not in Keychain" notice), you should import that certificate.
* in any case open the keychain management on the Mac and choose "xxx???". To import a certificate from a PKCS#12 file (suffix is typically ".p12"), select the "File" - "Import Objects" menu item. If you do not know where the certificate is stored, you can retract it in Xcode and recreate in your keychain. But only do so, if you are sure that the old certificate is not longer in use. Now your keychain should include an iOS-development certificate.
* rightclick and choose ''Information''. Under the certificate's "details", you'll find the Team-ID, (called "organizational unit" here). Remember this Team-ID to fill it into the corresponding field in the expecco plugin settings (see [[#Konfiguration_des_Plugins|Configuration of the Plugin]]).


==== Install Appium using npm ====
Return to Xcode und select "''File''" -> "''Open...''", to open the WebDriverAgent project. This is found in the ''Mobile Testing Supplements'' folder under
You can install Appium using npm (Node Package Manager) as well. To do this, you have to install node/npm first. This can be done using [https://github.com/nvm-sh/nvm nvm] (Node Version Manager), which you can get on Github. If the following installation instructions should not work for you, you will find detailed information in the [https://github.com/nvm-sh/nvm#readme Readme] there.
"<code><nowiki>Mobile_Testing_Supplement/lib/node_modules/appium-1.6.4-beta/node_modules/appium-xcuitest-driver/WebDriverAgent/WebDriverAgent.xcodeproj</nowiki></code>"


Open a Terminal window. Then clone the Github repository of nvm
[[Datei:MobileTestingWebDriverAgentXcode.png]]
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.2/install.sh | bash
and load it
export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")" [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm


Then execute
Select ''WebDriverAgentLib'' and the General page. In the Signing section, set the ''Automatically manage signing'' option and then select a team. Now switch to ''WebDriverAgentRunner'' and also to the ''General'' page. Set automatic signing here as well and select your team here as well. Here you should see errors indicating that no Provisioning Profiles have been created or found. Therefore, go to the ''Build Settings'' page and look for the entry ''Product Bundle Identifier'' in the ''Packaging'' section. Change this from com.facebook.WebDriverAgentRunner to something Xcode accepts by changing the prefix. Xcode can now generate a matching Provisioning Profile and the errors on the General page should disappear. After that you can quit Xcode.
command -v nvm
to see if it works. It should print ''nvm''. If there is no response, execute
touch ~/.zshrc
and try again.


Now you can install node with the following command.
If you now connect to your device from expecco, the WebDriverAgent will be installed and started on it and then switch to the app to be tested. On the device, however, the execution of the WebDriverAgent must still be trusted. To do this, open the settings during the connection setup on the device and then the entry Device management under General. This entry is only visible if a developer app is installed on the device. You may therefore have to wait until the WebDriverAgent is installed before the entry appears. Select the entry of your Apple account and trust it. Since the WebDriverAgent will be uninstalled again if the start did not work, you have to do this during the connection setup. If this is too hectic for you, you can also execute the following code:
nvm install 16.15.1
As there are problems installing Appium using the newest version of node, we recommend this version.


After node is installed, you can use it to install Appium:
''xcodebuild -project Mobile_Testing_Supplement/lib/node_modules/appium-1.6.4-beta/node_modules/appium-xcuitest-driver/WebDriverAgent/WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination 'id=<udid>' test''
npm install -g appium


The Appium server now simply can be started with the command
This installs the WebDriverAgent on the device without deleting it again. Please refer to the Apple documentation for more information on installing and trusting such apps.
appium
The output will then be written directly to the terminal.

This version also has problems with signing the WebDriverAgent, like explained in [[#Appium_Desktop | Appium Desktop]]. Therefore download a newer version of WebDriverAgent in this case as well and replace the old files. You will find them at
/Users/<user>/.nvm/versions/16.15.1/lib/appium/node_modules/appium-webdriveragent/

==== Mobile Testing Supplement ====
We provide older versions of Appium via the Mobile Testing Supplement for Mac OS, with which you can easily install it:
* '''expecco 20.2''': [https://download.exept.de/transfer/h-expecco-20.2.0/Mobile_Testing_Supplement_for_Mac_OS.tar.bz2 Mobile Testing Supplement for Mac OS (1.2.2)]
:Contains Appium version 1.18.3 and uses node 14.

* expecco 20.1: [https://download.exept.de/transfer/h-expecco-20.1.0/Mobile_Testing_Supplement_for_Mac_OS.tar.bz2 Mobile Testing Supplement for Mac OS (1.2.0)]
:Only a few changes compared to the previous version.

* expecco 19.2: [http://download.exept.de/transfer/h-expecco-19.2.0/MobileTestingSupplement_for_MacOS.tar.bz2 Mobile Testing Supplement for Mac OS (1.1.98)]
:Appium is updated to version 1.16.0-rc.1 and node 12 is used.

* expecco 19.1: [http://download.exept.de/transfer/h-expecco-19.1.0/Mobile_Testing_Supplement_for_Mac_OS_1.1.96.tar.bz2 Mobile Testing Supplement for Mac OS (1.1.96)]
:This version contains Appium 1.12.0.

* expecco 18.1: [http://download.exept.de/transfer/h-expecco-18.1.0/Mobile_Testing_Supplement_for_Mac_OS_1.1.94.tar.bz2 Mobile Testing Supplement for Mac OS (1.1.94)]
:This version contains Appium 1.8.0.

* expecco 2.11:[http://download.exept.de/transfer/h-expecco-2.11.1/Mobile_Testing_Supplement_for_Mac_OS_1.0.94.tar.bz2 Mobile Testing Supplement for Mac OS (1.0.94)]
:This version contains Appium 1.6.4.

* expecco 2.10: [http://download.exept.de/transfer/h-expecco-2.10.0/Mobile_Testing_Supplement_for_Mac_OS_1.0.tar.bz2 Mobile Testing Supplement for Mac OS]
:Diese Version entält Appium 1.4.16.

After you have downloaded the supplement, you can move it to a directory of your choice (e.g. your home directory) and unpack it there. A suitable command in a shell could look like this, adjust the version number accordingly:

tar -xvpf Mobile_Testing_Supplement_for_Mac_OS_1.1.98.tar.bz2

If your default Xcode installation is the one you want to use, you can start Appium directly from the file in the ''bin'' directory with the appropriate version number:

Mobile_Testing_Supplement/bin/start-appium-1.16.0-rc.1

If you want to use another Xcode than the one configured as default, you have to tell Appium the corresponding path by using the environment variable ''DEVELOPER_DIR''. For example, if you have installed Xcode in ''/Applications/Xcode-11.3.app'', you can start Appium this way:

DEVELOPER_DIR="/Applications/Xcode-11.3.app/Contents/Developer" Mobile_Testing_Supplement/bin/start-appium-1.16.0-rc.1

To find out what is set as the default Xcode installation on your system, use this command:


=== expecco 2.10 ===
The Mac used should run OS X 10.11.5 (El Capitan) or later as operating system version. To automate with iOS devices up to version 9.3, you need to install Xcode 7.3, which does not run on older operating systems (see also [https://en.wikipedia.org/wiki/Xcode#Version_comparison_table Xcode-Versionen]). Install Xcode from the App Store. Appium also requires a Java installation. Install a JDK in version 7 or 8. You can now install Appium 1.4.16 using our [http://download.exept.de/transfer/h-expecco-2.10.0/Mobile_Testing_Supplement_for_Mac_OS_1.0.tar.bz2 Mobile Testing Supplements für Mac OS]. After you have downloaded it, you can move it to a directory of your choice (e.g. your home directory) and unpack it there. A suitable command in a shell could look like this:
tar -xvpf Mobile_Testing_Supplement_for_Mac_OS_1.0.tar.bz2
If Xcode 7.3 is your default Xcode installation, you can start Appium directly:
Mobile_Testing_Supplement/bin/start-appium-1.4.16
If Xcode 7.3 is not configured as the default Xcode, you must specify the appropriate path to Appium using the DEVELOPER_DIR environment variable. For example, if you have Xcode installed in /Applications/Xcode-7.3.app, you can start Appium this way:
DEVELOPER_DIR="/Applications/Xcode-7.3.app/Contents/Developer" Mobile_Testing_Supplement/bin/start-appium-1.4.16
You can use this command to find out what is set as the default Xcode installation in your system:
xcode-select -p
xcode-select -p

If Appium does not find your Xcode installation, an error message like this appears when connecting:
If Appium cannot find your Xcode installation, a message like this appears:
''<blockquote>org.openqa.selenium.SessionNotCreatedException - A new session could not be created. (Original error: Could not find path to Xcode, environment variable DEVELOPER_DIR set to: /Applications/Xcode.app but no Xcode found)</blockquote>''
''<blockquote>org.openqa.selenium.SessionNotCreatedException - A new session could not be created. (Original error: Could not find path to Xcode, environment variable DEVELOPER_DIR set to: /Applications/Xcode.app but no Xcode found)</blockquote>''
In such a case, restart Appium by specifying a valid ''DEVELOPER_DIR''.
In such a case, restart Appium by specifying a valid ''DEVELOPER_DIR''.


==== Signing WebDriverAgent ====
== Konfiguration of Plugins ==
For automation, Appium installs an App called WebDriverAgent on the device and therefore has to be able to sign it. You need an Apple account and a respective certificate for this. For evaluation you can use a free account. This has the disadvantage that created profiles are only valid for one week and must be recreated afterwards. Also be careful when sharing the account, as certificates may be revoked or invalidated by automatic generation. As a result, apps that have already been signed can no longer be used.
Before you get started, you should check the settings of the Mobile Testing Plugin and adjust them if necessary. Open in the menu the item "''Extras''"". > ''Settings'' and there under "''Extensions''"" the ''entry'' Mobile Testing (s. fig.). ''By default, these paths are found automatically (1). To adjust a path manually, deactivate the corresponding check mark to the right of it. You will see a drop-down list with some paths to choose from. If an entered path is wrong or cannot be found, the field is marked red and a message appears. Make sure that all paths are specified correctly.''

If you already have a respective certificate and its associated private key in your keychain on the Mac, you can have the WebDriverAgent automatically signed. If not, it is recommended to set and manage the signing using Xcode.

First, connect the device you want to use to your Mac via USB. Make sure both the Mac and the device are in the same network or there will be problems when connection with Appium. Start Xcode and open ''Preferences''. Go to the Accounts page and create an entry with your account. You can then click on ''Manage Certificates...'' to see the certificates that belong to that account. To run tests, you need an iOS Development Certificate and the associated private key. If you do not already have one, create one. If you already have one, but it is not in your keychain (indicated by "Not in Keychain"), you can import it. You can do that by the [https://support.apple.com/en-us/guide/keychain-access/welcome/mac keychain access] on your Mac, if you have exported it previously from the keychain, where it is stored. The certificate with the associated key should be in the keychain ''Login''. It can be exported from there as PKCS#12 file (typical ending .p12). To import a certificate into your keychain, select the option ''Import objects'' from the ''File'' menu. If you don't know where the certificate is stored, you can also revoke it in Xcode and recreate it in your keychain. However, only do this if you know that the old certificate is no longer in use because it can no longer be used afterwards. Now the keychain should contain an iOS development certificate.
<!--(Den folgenden Teil braucht man wohl nicht mehr, wenn es in Xcode eingestellt ist)From the right-click menu, select Information. Under the details of the certificate you will find the Team ID, which is referred to here as the Organizational Unit. Enter it in the Team ID field of the plug-in's settings, see [[#Plugin_Configuration|Plugin Configuration]].-->

Now open the WebDriverAgent project in Xcode. If you have installed the Mobile Testing Supplement, you will find it in this directory at
''<nowiki>Mobile_Testing_Supplement/lib/node_modules/appium-1.16.0-rc.1/node_modules/appium-xcuitest-driver/WebDriverAgent/WebDriverAgent.xcodeproj</nowiki>''
If you have installed Appium Desktop, you will find it at
''<nowiki>/Applications/Appium\ Server\ GUI.app/Contents/Resources/app/node_modules/appium/node_modules/appium-webdriveragent/WebDriverAgent.xcodeproj</nowiki>''

You can use the Finder to navigate to the Xcode project file and open it by double clicking. Note, that you have to perform a context click (right click or Ctrl + click) on the Appium Server GUI app and select ''Show Package Contents'' in the menu, to get to its subdirectory.

[[Datei:MobileTestingWebDriverAgentXcode.png]]

Select ''WebDriverAgentLib'' and the page ''Signing & Capabilities''. In the section ''Signing'' set the option ''Automatically manage signing'' and then select a team. Now switch to ''WebDriverAgentRunner'' and do the same there.
<!-- (The following seems to not be relevant anymore.) Here you should see errors indicating that no Provisioning Profiles have been created or found. Therefore, go to the ''Build Settings'' page and look for the entry ''Product Bundle Identifier'' in the ''Packaging'' section. Change this from com.facebook.WebDriverAgentRunner to something Xcode accepts by changing the prefix. Xcode can now generate a matching Provisioning Profile and the errors on the General page should disappear. After that you can quit Xcode. -->
By setting the team, the errors showing up for WebDriverAgentRunner should disappear. If Xcode should not be able to create a Provisioning Profile matching the Bundle ID ''com.facebook.WebDriverAgentRunner'', you can edit the latter so that it fits your certificate. After that you can quit Xcode or you can, like explained further below, directly start the build in Xcode, so the project will be already built when Appium wants to use it.

If you now connect to your device from expecco, the WebDriverAgent will be installed and started on it and then switch to the app to be tested. You may still have to trust the execution of the WebDriverAgent on the device. It maybe a sign that you have to do this, if the app WebDriverAgent first appears on the device and tries to start, but then is uninstalled again. To trust the execution, open the settings during the connection setup on the device and then the entry ''Device management'' under ''General''. This entry is only visible if a developer app is installed on the device. You may therefore have to wait until the WebDriverAgent is installed before the entry appears. Select the entry of your Apple account and trust it. Since the WebDriverAgent will be uninstalled again if the start did not work, you have to do this during the connection setup. If this is too hectic for you, you can also execute the following code:

xcodebuild -project Mobile_Testing_Supplement/lib/node_modules/appium-1.16.0-rc.1/node_modules/appium-xcuitest-driver/WebDriverAgent/WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination 'id=<udid>' test

or
xcodebuild -project /Applications/Appium\ Server\ GUI.app/Contents/Resources/app/node_modules/appium/node_modules/appium-webdriveragent/WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination 'id=<udid>' test

This installs the WebDriverAgent on the device without deleting it again.

If there are problems while installing the WebDriverAgent, you can also try and start the build in Xcode. Make sure the right target ''WebDriverAgent'' is selected. Error messages in Xcode might indicate easier what the problem is about. Sometimes it even helps to try for a second time, if it took too long for the first time and got aborted. It may occur, that you are asked several times during the build to enter the password for the keychain.

[[Datei:WebDriverAgentCodesign.png]]

Read also the documentation of Appium on [https://github.com/appium/appium-xcuitest-driver/blob/master/docs/real-device-config.md Setting up tests with iOS devices]. Refer to the [https://support.apple.com/en-us/HT204460 Apple documentation] for details on installing and trusting of apps.

Once the WebDriverAgent is installed on the device, it will be reused for later connections und connecting should work faster. The signed version is then already on your Mac as well and doesn't have to be built again. This should speed up the connect with other devices as well. If you know, that the connect has to build and sign the WebDriverAgent first, it is advisable to set the capability ''wdaLaunchTimeout''. This timeout specifies how long Appium waits for the WebDriverAgents to start up on the device and is per default set to 60000&nbsp;ms. Building often takes a little longer than one minute, so the connect attempt will be canceled. A value of 120000 will be more reliable here.

== Plugin Configuration ==
Before you start, please check the settings of the Mobile Testing Plugin and adjust them if necessary. Select the menu item "''Extras''" &#8594; "''Settings''" &#8594; "''Extensions''" &#8594; "''Mobile Testing''" (see fig.). By default, these paths are found automatically (1). To adjust a path manually, deactivate the corresponding check mark at the right. You'll see a drop-down list with some paths to choose from. If an entered path is wrong or cannot be found, the field is marked red and a message appears. Make sure that all paths are specified correctly.


[[Datei:MobileTestingEinstellungen.png | thumb | 400px | Konfiguration des Plugins]]
[[Datei:MobileTestingEinstellungen.png | thumb | 400px | Plugin Configuration]]


*'''appium''': Enter here the path to the executable file with which Appium can be started in the command line. Under Windows this file will usually be called "appium.cmd". This path is used when expecco starts an Appium server.
*'''appium''': Enter the path to the executable file with which Appium can be started in the command line. Under Windows this file will usually be called "<code>appium.cmd</code>". This path is used when expecco starts an Appium server.
*'''node''': Enter the path to the executable file that starts Node (also called "Node.js"). This path is passed to Appium when a server is started so that Appium can find it independently of the PATH variable. Under Windows this file is usually called "<code>node.exe</code>".
*'''node''': Enter the path to the executable that starts Node (also called (also called "Node.js"). This path is passed to Appium when a server is started so that Appium can find it independently of the PATH variable. Under Windows this file is usually called "<code>node.exe</code>".
*'''JAVA_HOME''': Enter the path to a JDK here. This path is passed on to each Appium server. Leave the field blank to use the value from the environment variable. To set which Java should be used by expecco, set this path in the Java Bridge settings.
*'''JAVA_HOME''': Enter the path to a JDK (Java Development Kit)here. This path is passed to each Appium server. Leave the field blank to use the value from the environment variable. To specify which Java should be used by expecco, set this path in the Java Bridge settings.
*'''ANDROID_HOME''': Enter the path to an Android SDK here. This path is passed on to each Appium server. Leave the field blank to use the value from the environment variable.
*'''ANDROID_HOME''': Enter the path to an Android SDK here. This path is passed to each Appium server. Leave the field blank to use the value from the environment variable.
*'''adb''': This is the path to the adb command. Under Windows the file is called adb.exe. This file is used by expecco, for example, to get the list of connected devices. This path should be selected automatically, because the command is used in the ANDROID_HOME directory. This is also used by Appium. If expecco and Appium use different versions of adb, conflicts may occur.
*'''adb''': The path to the adb command. Under Windows the file is called "<code>adb.exe</code>". This file is used by expecco, for example, to get the list of connected devices. This path should be selected automatically, if the command is found in the ANDROID_HOME directory. This is also used by Appium. If expecco and Appium use different versions of adb, conflicts may occur.
*'''android.bat''': This file is only needed to start the AVD and the SDK Manager. The file in the ANDROID_HOME directory will be searched automatically.
*'''android.bat''': This file is only needed to start the AVD and the SDK Manager, which deal with phone emulators. The file in the ANDROID_HOME directory will be selected automatically, if present there.
*'''aapt''': Enter the path to the aapt command here. Under Windows this file is called ''aapt.exe''. expecco uses aapt only in the connection editor to read the package and activities of an apk file. The file in the ANDROID_HOME directory will be searched automatically.
*'''aapt''': The path to the "aapt" command here. Under Windows this file is called "<code>aapt.exe</code>". expecco uses "aapt" only in the connection editor to read the package and activities of an "apk" file. The file in the ANDROID_HOME directory will be selected automatically, if present there.


[[Datei:MobileTestingJavaBridgeEinstellungen.png | thumb | 400px | Konfiguration des JDKs]]
[[Datei:MobileTestingJavaBridgeEinstellungen.png | thumb | 400px | JDK Configuration]]


From expecco 2.11 there is a field ''Team-ID''. If you run iOS tests, enter the team ID of your certificate here. This is used for every iOS connection, unless you change the value in the connection settings. How to get the Team ID is described in the [[#expecco_2.11|Installation on Mac OS with expecco 2.11]] section. With expecco 2.10 you can enter the Team-ID only for each connection setting separately as capability. However, you must use the [[#Extended_View|Extended View]] to do this. Enter here the Capability ''xcodeOrgId'' and set as value the Team-ID of the certificate.
Starting with expecco 2.11, there is an additional field called ''Team ID''. If you run iOS tests, enter the Team ID of your certificate here. This is used for every iOS connection, unless you change the value in the connection settings in individual cases. For information on how to obtain the team ID, please refer to the section on [[#Signing| signing]] for installations on Mac OS. With expecco 2.10 and older, you can only enter the Team ID as capability for each connection setting separately. However, you must use the [[#Extended_View|extended view]] to do this. Enter the capability ''xcodeOrgId'' here and set the Team ID of the certificate as value.


The server address setting at the bottom of the page refers to the behavior of the connection editor. It checks at the end whether the server address ends in ''/wd/hub'' as this is the usual form. If not, a dialog asks how to react. The defined behavior can be viewed and changed here.
The server address setting at the bottom of the page refers to the behavior of the connection editor. It checks at the end whether the server address ends in ''/wd/hub'' as this is the usual form. If not, a dialog asks how to react. The defined behavior can be viewed and changed here.
Zeile 149: Zeile 262:
You can also use the system settings.
You can also use the system settings.


== Prepare Android device ==
== Prepare Android Device ==
If you connect an Android device under Windows, you may still need an adb driver for the device. You can usually find a suitable driver on the manufacturer's website. If you have installed the universal driver from the Mobile Testing Supplement, everything should already work for most devices. In some cases, Windows will automatically try to install a driver when you connect the device for the first time.
If you connect an Android device under Windows, you may still need an adb driver for the device. You can usually find a suitable driver on the manufacturer's website. If you have installed the universal driver from the Mobile Testing Supplement, everything should already work for most devices. In some cases, Windows will automatically try to install a driver when you connect the device for the first time. <br>
'''Attention''': Before you can control a mobile device with the Appium plugin, you have to allow this debugging!


For Android devices, you can find this option in the settings under ''[https://developer.android.com/studio/debug/dev-options Developer Options]'' called ''USB-Debugging''. If the developer options are not displayed, you can unlock them by tapping Build Number seven times in About the Phone.
Bevor Sie ein Mobilgerät mit dem Appium-Plugin ansteuern können, müssen Sie für dieses Debugging erlauben. Für Android-Geräte finden Sie diese Option in den Einstellungen unter ''[https://www.droidwiki.org/wiki/Entwickleroptionen Entwickleroptionen]'' mit dem Namen ''[https://www.droidwiki.org/USB-Debugging USB-Debugging]''. Falls die Entwickleroptionen nicht angezeigt werden, können Sie diese freischalten, indem Sie unter ''Über das Telefon'' siebenmal auf ''Build-Nummer'' tippen. Aktivieren Sie auch die Funktion ''Wach bleiben'', damit das Gerät nicht während der Testerstellung oder -ausführung den Bildschirm abschaltet. Aus Sicherheitsgründen muss USB-Debugging für jeden Computer einzeln zugelassen werden. Beim Verbinden des Geräts mit dem PC über USB müssen Sie dabei am Gerät der Verbindung zustimmen. Falls Sie dies für Ihren Computer noch nicht getan haben, aber auf dem Gerät kein entsprechender Dialog erscheint, kann es helfen, das Gerät aus- und wieder einzustecken. Das kann insbesondere dann passieren, wenn Sie den ADB-Treiber installiert haben während das Gerät bereits über USB angeschlossen war. Falls auch das nicht hilft, öffnen Sie die Benachrichtigungen, indem Sie sie vom oberen Bildschirmrand herunter ziehen. Dort finden Sie die USB-Verbindung und Sie können die Optionen dazu öffnen. Wählen Sie einen anderen Verbindungstypen aus; in der Regel sollten MTP oder PTP funktionieren.


Also enable the ''Stay awake'' feature to prevent the device from turning off the screen during test creation or execution.
Sie können auch auf einem Emulator testen. Dieser muss nicht mehr gesondert vorbereitet werden, da er bereits für USB-Debugging ausgelegt ist. Es ist sogar möglich, einen Emulator bei Testbeginn zu starten.


For security reasons, USB debugging must be allowed for each computer individually. When connecting the device to the PC via USB, you must agree to the connection on the device. If you haven't done this for your computer yet, but no corresponding dialog appears on the device, it may help to unplug and reconnect the device. This can happen especially if you have installed the ADB driver while the device was already connected via USB. If this doesn't help either, open the notifications by dragging them from the top of the screen. There you will find the USB connection and you can open the options. Select another type of connection; usually MTP or PTP should work.
Um zu überprüfen, ob ein Gerät, das Sie an Ihren Rechner angeschlossen haben, verwendet werden kann, öffnen Sie den [[#Verbindungseditor|Verbindungseditor]]. Das Gerät sollte dort angezeigt werden.


You can also test on an emulator. It does not need to be prepared separately, as it is already designed for USB debugging. It is even possible to start an emulator at the beginning of the test.
=== Verbindung über WLAN ===

Es ist auch möglich, Android-Geräte über WLAN zu verbinden. Dazu müssen Sie zunächst das Gerät über USB mit dem Rechner verbinden. Öffnen Sie dann die Eingabeaufforderung und geben Sie dort
To check if a device you have connected to your computer can be used, open the [[#Connection_Editor|connection editor]]. The device should be displayed there.

=== Connection via WLAN ===
It is possible to connect to Android devices via Wireless LAN. For devices using Android 11 or newer, this can be done wirelessly, else you have to connect initially via USB. Since expecco 22.1, WiFi connections can be established using the [[Mobile_Testing_Plugin/en#Connection_Editor|Connection Editor]]. It is also possible to do this using a command window.
==== Wireless Connect (Android 11) ====
In the developer options of your device, enable wireless debugging and open its options. You initially have to pair your machine with the device. To do this, choose "''Pair device with pairing code''" to get a pairing code and an IP address with port. Then open a command window (terminal window) on your machine and enter:
<nowiki>adb pair <Device IP Address>:<Pairing Port></nowiki>
where <tt><Device IP Address>:<Pairing Port></tt> is the IP address and port as shown on the device. After that, you will be asked for the pairing code. If everything went right, the popup on the device should have closed and your machine is added to the list of paired devices. Then enter at the command window:
<nowiki>adb connect <Device IP Address>:<Debugging Port></nowiki>
The IP address is the same as for pairing, but the port is different. Both are shown as IP address & Port on the device. The device should now be connected via WLAN and can be used in the same way as with a USB connection. You can check this by entering <tt>adb devices -l</tt> or open the connection dialog in expecco. In the list, the device appears with its IP address and port. Remember that the WLAN connection no longer exists when the ADB server or the device is restarted. Restarting the device often disables wireless debugging and the used port is changed. The pairing, however, is permanent and has not to be done again the next time you connect.
==== Start via USB ====
First, connect your device via USB. Then open a command window (terminal window) and enter:
<nowiki>adb tcpip 5555</nowiki>
<nowiki>adb tcpip 5555</nowiki>
The device listens for a TCP/IP connection on port 5555. If you have several devices connected or emulators running, you have to specify which device you mean. Enter in this case:
ein. Damit lauscht das Gerät auf eine TCP/IP-Verbindung an Port 5555. Sollten Sie mehrere Geräte angeschlossen oder Emulatoren laufen haben, müssen Sie genauer angeben, welches Gerät Sie meinen. Geben Sie in diesem Fall
<nowiki>adb devices -l</nowiki>
<nowiki>adb devices -l</nowiki>
to get a list of all devices, where the first column gives the device's ID.
ein. Sie erhalten eine Liste aller Geräte, wobei die erste Spalte deren Kennung ist. Schreiben Sie dann stattdessen
Then, enter:
<nowiki>adb -s <Gerätekennung> tcpip 5555</nowiki>
<nowiki>adb -s <deviceID> tcpip 5555</nowiki>
mit der Gerätekennung des gewünschten Geräts. Sie können die USB-Verbindung nun trennen. Jetzt müssen Sie die IP-Adresse Ihres Gerätes in Erfahrung bringen. Sie finden diese üblicherweise irgendwo in den Einstellungen des Geräts, beispielsweise beim Status oder in den WLAN-Einstellungen. Geben Sie dann
with the device identification of the desired device. You can now disconnect the USB connection.<br>Now you have to find out the IP address of your device. You can usually find it somewhere in the device's settings, for example in the Status or WLAN settings of the phone. Then type in:
<nowiki>adb connect <IP-Adresse des Geräts></nowiki>
<nowiki>adb connect <IP address of device></nowiki>
ein. Damit sollte das Gerät nun über WLAN verbunden sein und kann genauso verwendet werden, wie mit USB-Verbindung. Sie können dies überprüfen, indem Sie wieder <tt>adb devices -l</tt> eingeben oder in expecco den Verbindungsdialog öffnen. In der Liste taucht das Gerät mit seiner IP-Adresse und dem Port auf. Bedenken Sie, dass die WLAN-Verbindung nicht mehr besteht, wenn der ADB-Server oder das Gerät neu gestartet werden.
The device should now be connected via WLAN and can be used in the same way as with a USB connection. You can check this by entering <tt>adb devices -l</tt> again or open the connection dialog in expecco. In the list, the device appears with its IP address and port. Remember that the WLAN connection no longer exists when the ADB server or the device is restarted.


== iOS-Gerät und App vorbereiten ==
== Preparing an iOS-Device and App ==
Das Ansteuern von iOS-Geräten ist nur über einen Mac möglich. Lesen Sie daher auch den Abschnitt zur [[#Mac_OS|Installation unter Mac OS]].
Control of iOS devices is only possible via a Mac. Please also read the section [[#Mac_OS|Installation under Mac OS]].


Before you can control a mobile device with the Mobile Testing Plugin, you must allow debugging for iOS devices with iOS 8 or higher. Activate the option "''Enable UI Automation''" under the "''Developer''" menu in the device settings.<br>If you cannot find the "''Developer''" entry in the settings, proceed as follows: Connect the device to the Mac via USB. If necessary, you must still agree to the connection on the device. Start Xcode and then select "''Devices''" from the menu bar at the top of the screen in the "''Window''" menu. A window opens in which a list of the connected devices is displayed. Select your device there. Then the entry "''Developer''" should appear in the settings on the device. You may have to exit the settings and restart.
Bevor Sie ein Mobilgerät mit dem Mobile Testing Plugin ansteuern können, müssen Sie für iOS-Geräte ab iOS 8 Debugging erlauben. Aktivieren Sie dazu die Option ''Enable UI Automation'' unter dem Menüpunkt ''Entwickler'' in den Einstellungen des Geräts. Falls Sie den Eintrag ''Entwickler'' in den Einstellungen nicht finden, gehen Sie wie folgt vor: Schließen Sie das Gerät über USB an den Mac an. Dabei müssen Sie ggf. am Gerät noch der Verbindung zustimmen. Starten Sie Xcode und wählen Sie dann in der Menüleiste am oberen Bildschirmrand im Menü ''Window'' den Eintrag ''Devices''. Es öffnet sich ein Fenster, in dem eine Liste der angeschlossenen Geräte angezeigt wird. Wählen Sie dort Ihr Gerät aus. Danach sollte der Eintrag ''Entwickler'' in den Einstellungen auf dem Gerät auftauchen. Dazu müssen Sie möglicherweise die Einstellungen beenden und neu starten.


[[Datei:Alert.png | thumb | 270px | Alert unter iOS]]
[[Datei:Alert.png | thumb | 270px | Alert unter iOS]]
It is not possible to establish a connection to the device as long as it shows certain alerts. Such an alert may appear if FaceTime is activated (by displaying a message about SMS charges as shown in the screenshot). Be sure to configure the device so that it does not show such alerts when idle.
Ein Verbindungsaufbau zu dem Gerät ist nicht möglich solange es bestimmte Alerts zeigt. Ein solcher Alert kann z.&#x202f;B. erscheinen wenn FaceTime aktiviert ist, indem ein Hinweis auf anfallende SMS-Gebühren angezeigt wird (siehe Screenshot). Achten Sie darauf, das Gerät so zu konfigurieren, dass es im Leerlauf keine solchen Alerts zeigt.


=== expecco 2.11 ===
=== expecco 2.11 and later ===
Sie können beliebige Apps testen, die auf dem verwendeten Gerät lauffähig oder bereits installiert sind. Wenn die App als Development-Build vorliegt, muss die UDID des Geräts in der App hinterlegt sein. In jedem Fall muss der WebDriverAgent für das Gerät signiert werden. Lesen Sie dazu den Abschnitt zur [[#expecco_2.11|Vorbereitung unter Mac OS]].
You can test any app which is executable or already installed on the device used. If the app is available as a development build, the UDID of the device must be stored in the app. In any case, the WebDriverAgent must be signed for the device. Please read the section about [[#Signing|signing]] under Mac OS.


Falls Sie in einem Test den Home-Button verwenden wollen, müssen Sie auf dem Gerät AssistiveTouch aktivieren. Sie finden diese Option in den Einstellungen unter ''Allgemein'' > ''Bedienungshilfen'' > ''AssistiveTouch''. Platzieren Sie dann das Menü in der Mitte des oberen Bildschirmrands. Sie können das Drücken des Home-Buttons dann mit dem entsprechenden Menüeintrag im Recorder aufzeichnen oder direkt den Baustein ''Press Home Button'' benutzen.
If you want to use the Home button in a test, you must activate "AssistiveTouch" on the device. You will find this option in the settings under "''General''" > "''Operating Help''" > "''AssistiveTouch''". Then place the menu in the middle of the upper edge of the screen. You can then record pressing the Home button with the corresponding menu entry in the recorder or use the "''Press Home Button''" block directly.


=== expecco 2.10 ===
=== expecco 2.10 ===
The app you want to use must be available as a development build. The UDID of the device must also be stored in the app.
Die App, die Sie verwenden wollen, muss als Development-Build vorliegen. Außerdem muss die UDID des Geräts in der App hinterlegt sein.


=== Sign the development build ===
=== Development-Build signieren ===
A development build of an app is only allowed for a limited number of devices and cannot be started on other devices. However, it is possible to exchange the certificate and the usable devices in a development build.
Ein Development-Build einer App ist nur für eine begrenzte Zahl von Geräten zugelassen und kann auf anderen Geräten nicht gestartet werden. Es ist aber möglich, das Zertifikat und die verwendbaren Geräte in einem Development-Build auszutauschen.


* Evaluierung mit Demo-App von eXept:
* Evaluation with demo app of eXept:
:We will be happy to provide you with a demo app which is available as a development build and which we can sign for your device. Please send the UDID of your device to your eXept contact person. How to determine the UDID of your device is described in the following section.
:Gerne stellen wir Ihnen eine Demo-App zur Verfügung, die als Development-Build vorliegt und die wir für Ihr Gerät signieren können. Senden Sie dazu bitte Ihrem eXept-Ansprechpartner die UDID Ihres Gerätes zu. Wie Sie die UDID Ihres Gerätes ermitteln können, ist im folgenden Abschnitt beschrieben.


* Using your own app for your test device:
* Eigene App für Ihr Testgerät verwenden:
:If you receive a development build (IPA file) from the app developers that is approved for your test device, you can use it directly. To do this, you must tell the developers the UDID of your device so they can enter it. '''You can use Xcode to read the UDID of a device'''. Start Xcode and select ''Devices'' from the menu bar at the top of the screen in the ''Window'' menu. A window opens in which a list of the connected devices is displayed. Select your device and search for the ''Identifier'' entry in Properties. The UDID is a 40-digit hexadecimal number.
:Wenn Sie von den App-Entwicklern einen Development-Build (IPA-Datei) erhalten, der für Ihr Testgerät zugelassen ist, können Sie diesen direkt verwenden. Dazu müssen Sie den Entwicklern die UDID Ihres Geräts mitteilen, damit sie diese eintragen können. '''Sie können die UDID eines Gerätes mithilfe von Xcode auslesen'''. Starten Sie dazu Xcode und wählen Sie in der Menüleiste am oberen Bildschirmrand im Menü ''Window'' den Eintrag ''Devices''. Es öffnet sich ein Fenster, in dem eine Liste der angeschlossenen Geräte angezeigt wird. Wählen Sie Ihr Gerät aus und suchen Sie in Eigenschaften den Eintrag ''Identifier''. Die UDID ist eine 40-stellige Hexadezimalzahl.


* Externally developed app for your test device:
* Extern entwickelte App für Ihr Testgerät umsignieren:
:You can also re-sign apps to make them run on other devices. However, this process is complicated and requires access to an Apple Developer account. A documentation on the procedure is currently in preparation.
:Es können auch Apps umsigniert werden, damit Sie auf anderen Geräten lauffähig sind. Dieser Vorgang ist jedoch kompliziert und setzt insbesondere einen Zugang zu einem Apple-Developer-Account voraus. Eine Dokumentation zur Vorgehensweise ist derzeit in Vorbereitung.


:For the evaluation we will gladly support you with the re-signing of your app..
:Für die Evaluierung unterstützen wir Sie gerne beim Umsignieren Ihrer App.
<!--
<!--
Melden Sie sich beim [https://developer.apple.com/ Apple-Webinterface] an. Navigieren Sie zu ''Certificates, IDs & Profiles''. Erzeugen Sie hier ggf. ein Developer-Zertifikat und ein Provisioning Profile für Ihr Gerät und laden Sie beide herunter. Sollten Sie noch keinen Developer Account haben, erstellen Sie hier einen: https://developer.apple.com/enroll/. Hierzu müssen Sie sich mit einer Apple-ID anmelden.
Log in to the [https://developer.apple.com/ Apple-Webinterface]. Navigate to ''Certificates, IDs & Profiles''. If necessary, create a Developer Certificate and a Provisioning Profile for your device here and download both. If you don't have a Developer Account yet, create one here: https://developer.apple.com/enroll/. For this you have to register with an Apple-ID.


# Team-ID herausfinden (''Membership'' -> ''Team ID'')
# Find out Team ID (''Membership'' -> ''Team ID'')
# Unter ''Certificates, IDs & Profiles'' Development-Zertifikat auswählen (unter ''+'' anlegen, falls nicht vorhanden) und herunterladen.
# Under ''Certificates, IDs & Profiles'' select development certificate (under ''+'' create, if not available) and download
# Unter ''App ID'' Wildcard-App-ID erzeugen, falls nicht vorhanden. App-ID notieren (AppID = Prefix.ID)
# Under ''App ID'' create Wildcard App ID, if not present. Note App ID (AppID = Prefix.ID)
# Gerät hinzufügen, dazu UDID (bzw. ''Identifier'') des Geräts herausfinden (''Xcode'' -> ''Window'' (oben in Menüleiste) -> ''Devices'')
# Add device, find out UDID (or ''Identifier'') of the device (''Xcode'' -> ''Window'' (above in menu bar) -> ''Devices'')
# Provisionen Profile erstellen: ''iOS App Development'' -> ''AppID'' auswählen -> Zertifikat wählen -> Gerät auswählen -> Profilname anlegen -> Provisioning Profile herunterladen.
# Create commission profiles: ''iOS App Development'' -> Select ''AppID'' -> Select certificate -> Select device -> Create profile name -> Download provisioning profiles.
# Das heruntergeladene Zertifikat importieren (''Downloads'' -> Zertifikat (.cer)
# Import the downloaded certificate (''Downloads'' -> Certificate (.cer)
# SHA1-Fingerabdruck kopieren. Dazu Rechtsklick auf Zertifikat -> ''Information'', anschließend bis zum Ende der Seite scrollen).
# Copy SHA1 fingerprint. Right click on Certificate -> ''Information'', then scroll to the bottom of the page).
# Entitlements.plist erstellen (''Terminal' öffnen -> Downloads/Mobile_Testing_Supplement/bin/gen-entitlements_plist 'Team-ID' 'App ID' Downloads/Mobile_Testing_Supplement/bin/re-sign-ipa <Pfad zum ipa (z.B. Downloads/expeccoMobileDemo.ipa)> \
# Create Entitlements.plist (''Open Terminal' -> Downloads/Mobile_Testing_Supplement/bin/gen-entitlements_plist 'Team-ID' 'App ID' Downloads/Mobile_Testing_Supplement/bin/re-sign-ipa <path to ipa (z.B. Downloads/expeccoMobileDemo.ipa)> \
"<Zertifikat (SHA1-Fingerabdruck, z.B. 76 E8 4B E8 78 D5 D7 F9 2E 09 8B D7 E8 FB CE 30 0C F5 D0 EF)>" \
"<Zertifikat (SHA1-Fingerabdruck, z.B. 76 E8 4B E8 78 D5 D7 F9 2E 09 8B D7 E8 FB CE 30 0C F5 D0 EF)>" \
<Pfad zum Provisionen Profile (z.B. /Users/exept_test/Downloads/dut.mobileprovision)> \
<Path to Commission Profile (e.g. /Users/exept_test/Downloads/dut.mobileprovision)> \
<Pfad für das Ergebnis-ipa (z.B. Downloads/expeccoMobileDemo_re-signed.ipa)> \
<Path for the result ipa (z.B. Downloads/expeccoMobileDemo_re-signed.ipa)> \
[Pfad zur entitlements.plist] (z.B. /Users/exept_test/entitlements.plist)
[Pfad zur entitlements.plist] (z.B. /Users/exept_test/entitlements.plist)


Zum Umsignieren können Sie das entsprechende Skript aus dem Mobile Testing Supplement für Mac OS oder jedes beliebige andere Tool (z.B. isign) verwenden.
To re-sign, you can use the corresponding script from the Mobile Testing Supplement for Mac OS or any other tool (e.g. isign).
-->
-->


For more information about using iOS devices, see also the
Weitere Informationen zur Verwendung von iOS-Geräten finden Sie auch in der [http://appium.io/slate/en/master/?java#appium-on-real-ios-devices Dokumentation von Appium].
[http://appium.io/slate/en/master/?java#appium-on-real-ios-devices Appium documentation].


=== Native iOS-Apps ===
=== Native iOS-Apps ===
You can also use apps that are already natively present on the device. To do this, you must know their bundle ID and then enter it in the connection settings. Here is a small selection of common apps:
Sie können auch Apps verwenden, die bereits nativ auf dem Gerät vorhanden sind. Dazu müssen Sie deren Bundle-ID kennen und diese dann in die Verbindungseinstellungen eintragen. Hier eine kleine Auswahl gängiger Apps:
{| style="text-align:left"
{| style="text-align:left"
! App
! App
Zeile 275: Zeile 403:
|}
|}


Weitere Bundle-IDs finden Sie [https://github.com/joeblau/apple-bundle-identifiers hier].
You can find further Bundle-IDs [https://github.com/joeblau/apple-bundle-identifiers here].


= Beispiele =
= Examples =
Bei den Demo-Testsuiten für expecco finden Sie auch Beispiele für Tests mit dem Mobile Testing Plugin. Wählen Sie dazu auf dem Startbildschirm die Option ''Beispiel aus Datei'' und öffnen Sie den Ordner ''mobile''.
In the demo test suites for expecco you will also find examples for tests with the Mobile Testing Plugin. To do this, select the option "''Example from File''" on the start screen and open the folder named "''mobile''".


==<span id="TestsuiteMobileTestingDemo"><!-- Referenced by m01_MobileTestingDemo.ets --></span> ''m01_MobileTestingDemo.ets'' ==
==<span id="TestsuiteMobileTestingDemo"><!-- Referenced by m01_MobileTestingDemo.ets --></span> ''m01_MobileTestingDemo.ets'' ==
Die Testsuite enthält zwei einfache Testpläne: "''Simple CalculatorTest''" und "''Complex Calculator and Messaging Test''". Beide Tests verwenden einen Android-Emulator, den Sie vor Beginn starten müssen. Die Apps, die im Test verwendet werden, gehören zur Grundausstattung des Emulators und müssen daher nicht mehr installiert werden. Da sich die Apps unter jeder Android-Version unterscheiden können, ist es wichtig, dass Ihr Emulator unter Android 6.0 läuft. Außerdem muss die Sprache auf Englisch gestellt sein.
The test suite contains two simple test plans: "''Simple CalculatorTest''" and "''Complex Calculator and Messaging Test''". Both tests use an Android emulator, which you must start before starting. The apps used in the test are part of the basic equipment of the emulator and therefore no longer need to be installed. Since the apps may differ under every Android version, it is important that your emulator runs under Android 6.0. In addition, the language must be set to English.


; Simple CalculatorTest
; Simple CalculatorTest
: This test connects to the calculator and enters the formula ''2+3''. The result of the calculator is compared with the expected value ''5''.
: Dieser Test verbindet sich mit dem Taschenrechner und gibt die Formel ''2+3'' ein. Das Ergebnis des Rechners wird mit dem erwarteten Wert ''5'' verglichen.


; Complex Calculator and Messaging Test
; Complex Calculator and Messaging Test
: This test connects to the calculator and then opens the message service. There it waits for an incoming message from the number ''15555215556'', in which a formula to be calculated is sent. The message is generated before via a socket at the emulator. When the message arrives, it is opened by the test and its contents are read. Then the calculator is opened again, the received formula is entered and the result is read. The test then switches back to the message service and sends the result as an answer.
: Dieser Test verbindet sich mit dem Taschenrechner und öffnet anschließend den Nachrichtendienst. Dort wartet er auf eine einkommende Nachricht von der Nummer ''15555215556'', in der eine zu berechnende Formel gesendet wird. Die Nachricht wird zuvor über einen Socket beim Emulator erzeugt. Nach dem Eintreffen der Nachricht wird diese vom Test geöffnet und deren Inhalt gelesen. Danach wird wieder der Taschenrechner geöffnet, die erhaltene Formel eingegeben und das Ergebnis gelesen. Anschließend wechselt der Test wieder zum Nachrichtendienst und sendet das Ergebnis als Antwort.


== ''m02_expeccoMobileDemo.ets'' und ''m03_expeccoMobileDemoIOS.ets'' ==
== ''m02_expeccoMobileDemo.ets'' und ''m03_expeccoMobileDemoIOS.ets'' ==
Diese sind Bestandteil des Tutorials zum Mobile Testing Plugin. Der jeweils enthaltene Testfall ist unvollständig und wird im Zuge des Tutorials ergänzt. Lesen Sie dazu den Abschnitt [[#Tutorial|Tutorial]].
These are part of the tutorial for the Mobile Testing Plugin. The included test case is incomplete and will be added during the tutorial. Please read the section [[#Tutorial|Tutorial]].


= Tutorial =
= Tutorial =
Dieses Tutorial beschreibt das grundsätzliche Vorgehen zur Erstellung von Tests mit dem Mobile Testing Plugin. Grundlage dafür ist ein mitgeliefertes Beispiel, bestehend aus einer einfachen App und einer expecco-Testsuite.
There is a tutorial describing the basic procedure for creating tests with the Mobile Testing Plugin. It is based on a supplied example consisting of a simple app and an expecco test suite.


You find it on the page [[Mobile_Testing_Tutorial/en|Mobile Testing Tutorial]] in two versions for Android and iOS devices.
Die App ''expecco Mobile Demo'' berechnet und überprüft verschiedene alltägliche Codes: die IBAN aus dem europäischen Zahlungsverkehr, die internationalen GTIN-13-Produktcodes, wie man sie bei Strichcodes im Einzelhandel findet, und die Seriennummern auf Euro-Banknoten.
* <span id="FirstStepsAndroid"><!-- Referenced by m02_expeccoMobileDemo.ets --></span> [[Mobile_Testing_Tutorial/en#First_steps_with_Android|First steps with Android]]
* <span id="FirstStepsIOS"><!-- Referenced by m03_expeccoMobileDemoIOS.ets --></span> [[Mobile_Testing_Tutorial/en#First_steps_with_iOS|First steps with iOS]]


= Dialogs of the Mobile Testing Plugin =
Die Testsuite enthält Testfälle für einzelne Funktionen der App. Dabei sind noch nicht alle Funktionen abgedeckt, sondern werden im Laufe des Tutorials ergänzt.
== Connection Editor ==
You can use the Connection Editor to quickly define, change, or establish connections. Depending on the task, the dialog has small differences and is opened differently:
*If you want to establish a connection, access the dialog in the GUI browser by clicking on ''Connect'' and then selecting ''Mobile Testing''.
*To change or copy an existing connection in the GUI browser, select it, right-click and select ''Edit Connection'' or ''Copy Connection'' from the context menu.
*If you do not want to create connection settings for the GUI browser but for use in a test, choose ''Create Connection Settings'' from the Mobile Testing Plugin menu.... This only allows you to create the settings for a connection without creating a connection in the GUI browser.


The Connection Editor menu has several buttons, some of which are only visible when creating connection settings:
Es gibt zwei Versionen dieses Tutorials:
[[Datei:MobileTestingVerbindungseditorMenu.png]]
*'''[[#Erste_Schritte_mit_Android|Erste Schritte mit Android]]'''
#''Delete Settings'': Resets all entries. (Only visible when creating settings.)
*'''[[#Erste_Schritte_mit_iOS|Erste Schritte mit iOS]]'''
#''Load settings from file'': Allows to open a saved settings file (*.csf). Its settings are transferred to the dialog. Entries already made without conflict are retained.
#''Load settings from attachment'': Allows you to open an attachment with connection settings from an open project. These settings are applied to the dialog. Entries already made without conflict are retained.
#''Save settings to file'' and
#''Save settings to attachment'': Here you can save the entered settings to a file (*.csf) or create them as an attachment in an open project. Both options have a delayed menu in which you can choose to save only a certain part of the settings. (Only visible when creating settings.)
#''Advanced View'': Allows you to switch to the advanced view to make additional settings. Read more about this at the end of this chapter. (Only visible when creating settings.)
#''Help'': A help text for the respective step is shown or hidden on the right side.


Das Vorgehen ist in beiden Versionen nahezu identisch, lediglich die Verbindungskonfigurationen werden unterschiedlich erzeugt. Die fertigen Tests unterscheiden sich dann im Wesentlichen in den Pfaden zur Adressierung der benutzten Elemente, da diese technologieabhängig sind.


The dialog is divided into three steps. In the first step you select the device you want to use, in the second step you select which App should be used and in the last step the settings for the Appium server are made.
==<span id="FirstStepsAndroid"><!-- Referenced by m02_expeccoMobileDemo.ets --></span> Erste Schritte mit Android ==
Es wird vorausgesetzt, dass Sie das Kapitel [[#Installation_und_Aufbau|Installation und Aufbau]] bereits gelesen und die nötigen Vorbereitungen für die Verwendung von Android-Geräten unter Windows abgeschlossen haben.


===<span id="AppiumConnectionEditorStep1"><!-- Referenced by AppiumConnectionEditor in Mobile Testing Plugin --></span>Step 1: Select Device ===
=== Schritt 1: Demo ausführen ===
In the upper part you will see a list of all connected Appium devices that are detected. With the checkbox below you can hide devices that are detected but not ready. If you want to enter a device that is not connected, you can create it with the corresponding button ''Enter Android device'' or ''Enter iOS device''. However, you need to know the required properties of your device. The device is then created in a second device list and can be selected there. If no list with connected elements can be displayed, various messages are displayed instead:
Starten Sie expecco und öffnen Sie die Testsuite ''m02_expeccoMobileDemo.ets'' über die Schaltfläche ''Beispiel aus Datei'' (Abb. 1). Ab expecco 2.11 befindet sich diese im Unterordner ''mobile''. In dieser Testsuite befindet sich bereits ein vorgefertigter Testplan mit einigen Testfällen für diese App.
*No devices found
*:expecco could not find any Android devices.
*:To automatically configure a connection to a device, make sure
*:*it is connected
*:*it is turned on
*:*that it has an appropriate adb driver installed
*:*it is enabled for debugging (see below).
*No available devices found
*:expecco could not find any available Android devices. But not available ones were found, e.g. with the status "unauthorized".
*:To configure a connection to a device automatically, make sure that
*:*it is connected
*:*it is turned on
*:*that it has an appropriate adb driver installed
*:*it is enabled for debugging (see below).
*:To view unavailable devices, enable this option below.
*Connection lost
*:expecco has lost the connection to the adb server. Try to re-establish the connection by clicking on the button.
*Connection failed
*:expecco could not connect to the adb server. Possibly it is not running or the specified path is not correct.
*:Check the adb configuration in the settings and try to start the adb server and establish a connection by clicking on the button.
*Connect ...
*:expecco connects to the adb server. This may take a few seconds.
*Start adb-Server ...
*:expecco starts the adb-Server. This may take a few seconds.


<!--With ''Automation by'' you can specify, which automation engine is to be used. If you leave the setting at ''(Default)'' the corresponding capability is not set at all. Otherwise Appium, Selendroid and from expecco 2.11 XCUITest are available. Selendroid is usually only used for Android devices prior to version 4.1.-->With ''Next'' you get to the next step. If you enter settings for the GUI browser, this is only possible once a device has been selected.
[[Datei:MobileTestingBeispielÖffnen.png | frame | left | Abb. 1: Beispiel-Testsuite öffnen]]
<br clear="all">
In der Testsuite ist das Paket der Demo-App als Anhang enthalten (''expeccoMobileDemo-debug.apk''). Mithilfe des bereitgestellten Bausteins ''Export Demo App'' können Sie die Datei an einen beliebigen Ort auf Ihrem Rechner exportieren. Wählen Sie dazu den Baustein aus (1) und klicken Sie auf den grünen Play-Knopf (2) um den Baustein auszuführen (Abb. 2). Der Baustein öffnet einen Dateidialog, in dem Sie angeben, wo das Paket gespeichert werden soll.


<span id="UnlockingDeveloperOptions">Note on unlocking</span>: In newer Android versions the developer options are no longer offered in the settings at first. If your Android device does not show an entry for "''Developer options''" in the settings, first select the entry "''Phone info''", then "''SoftwareVersionsInfo''" and click on the entry "''BuildVersion''" several times.
[[Datei:MobileTestingExportApp.png | frame | left | Abb. 2: App exportieren]]
<br clear="all">
Bevor wir uns mit dem weiteren Inhalt der Testsuite beschäftigen, konfigurieren Sie zuerst die Verbindung und welches Gerät Sie benutzen wollen. Schließen Sie dazu ein Gerät über USB an Ihren Rechner an oder starten Sie einen Emulator.


==== Manage Chromedrivers ====
[[Datei:MobileTestingVerbinden.png | frame | left | Abb. 3: Verbindungseditor öffnen]]
If the App you want to automate uses WebViews with Chrome, Appium needs to have access to an appropriate Chromedriver. If you have selected a device in the list, you can use "''Manage Chromedrivers''" to see, which Chrome versions are installed on the device and which Chromedriver versions are provided by expecco. With this dialog you can also download required Chromedriver versions. Beware that there may be several Chrome versions on the device. An App doesn't have to use the version of the installed Chrome browser for its WebViews. The Chromedriver you use should fit your app for everything to work properly. You can also change the path to the Chromedriver in the capabilities generated at the end of the connection editor.
<br clear="all">
Öffnen Sie nun den GUI-Browser (1) und wählen Sie unter ''Verbinden'' (2) den Eintrag ''Mobile Testing'' (3) (Abb. 3), um den Verbindungsdialog zu öffnen.


==== Connect WiFi Android Device ====
Sie sehen eine Liste aller angeschlossenen Android-Geräte (1) (Abb. 3). Sollte Ihr Gerät nicht in der Liste auftauchen, stellen Sie sicher, dass es eingeschaltet und über USB verbunden ist. Lesen Sie ansonsten den Abschnitt [[#Android-Ger.C3.A4t_vorbereiten|Android-Gerät vorbereiten]]


You can connect to Android devices using WiFi as well. In this case, the device has to be connected to ADB first, see [[Mobile_Testing_Plugin/en#Connection_via_WLAN|Connection via WLAN]]. Since expecco 22.1, the connection editor provides a dialog helping to set this up, which can be used instead of the command window. For devices using Android 11 or newer, you can pair the device with your machine here by specifying the appropriate parameters and then establish the connection by specifying the IP address and port. You can also use this to establish a wireless connection for devices that are connected via USB. When you select the corresponding device in the list, the required information is read out automatically.
[[Datei:MobileTestingGerätAuswählen.png | frame | left | Abb. 4: Gerät im Verbindungsdialog auswählen]]
<br clear="all">
Haben Sie Ihr Gerät in der Liste gefunden, wählen Sie es aus und klicken Sie auf ''Weiter'' (2).


Note that establishing a wireless connection is not part of the connection settings. If you want to establish a new connection with the generated settings, you must make sure that the device is connected to ADB with the specified IP address and port so that it can be found. The ADB connection will be lost if the ADB server or the device are restarted. The permission for wireless debugging is also often reset when the device is restarted and the debug port can then change. Therefore, a wireless connection must always be established manually.
Als nächstes geben Sie an, welche App Sie verwenden wollen (Abb. 5). Dabei können Sie wählen, ob Sie eine App starten möchten, die bereits auf dem Gerät installiert ist (''App auf dem Gerät'') oder ob eine App installiert und gestartet werden soll (''App installieren''). Für den Fall, dass Sie eine bereits installierte App benutzen wollen, erhalten Sie eine Liste aller auf dem Gerät installierten Pakete (1), die in Systempakete und Fremdpakete (2) unterteilt sind, sowie deren Activities (3). Diese können Sie dann einfach in den jeweiligen Feldern auswählen.


===<span id="AppiumConnectionEditorStep2"><!-- Referenced by AppiumConnectionEditor in Mobile Testing Plugin --></span>Step 2: Select App===
[[Datei:MobileTestingAppAuswählen.png | frame | left | Abb. 5: Auf dem Gerät installierte App angeben]]
Here you can enter information about the app to be tested. You can decide if you want to use an app that is already installed on the device or if you want to install an app for the test. Select the appropriate tab above. Depending on whether you selected an Android or an iOS device in the previous step, the required input will change.
<br clear="all">
Für dieses Tutorial soll die App installiert werden, die Sie eben aus der Testsuite exportiert haben. Wählen Sie also ''App installieren'' aus und tragen Sie bei App (1) den entsprechenden Pfad ein (Abb. 6). Sie können den Knopf links benutzen (2), um einen Dateidialog zu öffnen, mit dem Sie zu der Datei navigieren können, um sie einzugeben. Das Paket (3) und die Activity (4) der App werden automatisch eingetragen. Sollte die App mehrere Activities besitzen, können Sie die gewünschte auswählen. Klicken Sie nun auf ''Weiter'' (5).


*'''Android'''
[[Datei:MobileTestingAppInstallieren.png | frame | left | Abb. 6: App angeben, die auf dem Gerät installiert werden soll]]
**''App on Device''
<br clear="all">
**:If you have selected a connected device in the first step, the packages of all installed apps are automatically retrieved and you can select from the drop-down lists. The installed apps are divided into third-party packages and system packages; select the appropriate package list. This selection does not belong to the settings, but only provides the corresponding package list. You can use the filter to further narrow down the list and then select the desired package. The activities of the selected package are also automatically retrieved and made available as a drop-down list. Select the activity you want to start. As a rule, an activity is automatically entered from the list. If you are not using a connected device, you must enter the package and the activity manually.
Auf der letzten Seite sehen Sie eine Übersicht aller bisherigen Angaben (1) (Abb. 7). Darunter können Sie einen Namen für die Verbindung angeben, unter dem sie im GUI-Browser angezeigt wird (2). Außerdem lässt sich eine Verbindung über diesen Namen identifizieren und in Bausteinen verwenden; der Name muss daher eindeutig sein. Falls Sie keinen Namen angeben, wird generisch einer erzeugt. Geben Sie als Namen ''expeccoMobileDemo'' ein. Im Feld darunter ist die Adresse zum Appium-Server einzutragen (3). Appium ist die Schnittstelle, über die die angeschlossenen Geräte gesteuert werden. Für dieses Tutorial wird die Verwaltung der Instanzen des Appium-Servers von expecco übernommen. Tragen Sie dafür ist die lokale Standard-Adresse ''<nowiki>http://localhost:4723/wd/hub</nowiki>'' ein. Diese ist immer der unterste Eintrag der Vorschlagsliste. Außerdem ist die Option ''Bei Bedarf starten'' aktiviert (4). expecco überprüft dann, ob an der Adresse bereits ein Appium-Server läuft und startet und beendet ihn bei Bedarf automatisch. Wenn der Port ''4723'' bereits belegt ist oder wenn Sie einmal mehrere Verbindungen parallel betreiben wollen, verwenden Sie an dieser Stelle entsprechend einen anderen Port. Es ist dabei üblich die ungeraden Portnummern oberhalb von ''4723'' zu verwenden, also ''4725'', ''4727'' usw. Natürlich können Sie auch entfernte Server verwenden, das automatische Starten und Beenden eines Servers kann expecco aber nur lokal für Sie übernehmen.
**''Install App''
**:Under ''App'', enter the path to an app. The path must be valid for the Appium server being used. You can also specify a URL. If you are using a local Appium server, you can use the right button to navigate to the App installation file and enter this path. If possible, the corresponding package and the activity are also entered in the fields below. However, this entry is not necessary.


*'''iOS'''
[[Datei:MobileTestingServerkonfiguration.png | frame | left | Abb. 7: Verbindungsnamen und Appium-Server konfigurieren]]
**''App on Device''
<br clear="all">
**:Specify the bundle ID of an installed app. You can find out the IDs of the installed apps using Xcode, for example. Start Xcode and select ''Devices'' from the menu bar at the top of the screen in the ''Window'' menu. A window will open displaying a list of connected devices. If you select your device, you will see a list of the apps you have installed in the overview.
Klicken Sie nun auf ''Speichern'' (5) um die Einstellungen für die Testausführung zu speichern. Einstellungen können als Anhang einer Testsuite oder in eine externe Datei gespeichert werden (Abb. 8). Falls Sie mehrere Projekte gleichzeitig offen haben, können Sie in der Liste das Projekt auswählen, in dem der Anhang angelegt werden soll. Klicken Sie auf ''Speichern'' im Bereich ''Einstellungen im Anhang speichern'' und geben Sie als Name ''expeccoMobileDemo'' an. Klicken Sie nun auf ''Server starten und verbinden'' (6) um mit der angegebenen Konfiguration eine Verbindung herzustellen.
**''Install App''
**:Under ''App'', enter the path to an app. The path must be valid for the Appium server being used. You can also specify a URL. For the requirements of apps for real devices, please read the section [[#iOS-Ger.C3.A4t_and_App_Preparing|Preparing an iOS-Device and App]].


In the lower part you can specify whether the app should be reset or uninstalled when the connection is terminated, and whether it should be reset initially. Again, the corresponding capability is not set if you select ''(Default)''. With ''Next'' you get to the next step.
[[Datei:MobileTestingEinstellungenSpeichern.png | frame | left | Abb. 8: Einstellungen speichern]]
<br clear="all">
Der Verbindungsaufbau kann eine Weile dauern. Warten Sie bis die Verbindung aufgebaut ist und im GUI-Browser angezeigt wird. Sie sehen, dass die App auf dem Gerät gestartet wird. Nun wissen Sie, dass die Konfiguration funktioniert. Die gespeicherten Einstellungen sollen nun für den Test verwendet werden, der dann die gleiche Verbindung aufbaut. Wählen Sie die Verbindung im GUI-Browser aus, machen Sie einen Rechtsklick und wählen Sie im Kontextmenü ''Verbindung abbauen'', damit es zu keinem Konflikt kommt. Wechseln Sie dann zurück zum Reiter der Testsuite.


===<span id="AppiumConnectionEditorStep3"><!-- Referenced by AppiumConnectionEditor in Mobile Testing Plugin --></span>Step 3: Server Settings===
In der Testsuite wurden die Einstellungen als Anhang ''expeccoMobileDemo'' angelegt (Abb 9). Wählen Sie den Baustein ''Connect'' (1) aus und wechseln Sie rechts zur Ansicht ''Netzwerk'' (2). Ziehen Sie per Drag-and-drop die Einstellungen in das Netzwerk des Bausteins (3). Verbinden Sie den Ausgangspin ''pathName'' mit dem Eingangspin ''stringOrFilename[1]'' des Bausteins ''Connect from File'' (4). Mit ''Übernehmen'' (5) bestätigen Sie die Änderungen. Dieser Baustein wird zu Beginn des Tests die Verbindung zur App herstellen.
In the last step, a list of all the capabilities that result from your entries in the previous steps is first displayed in the upper part. If you are familiar with Appium and want to set additional capabilities that are not covered by the connection editor, you can click on ''Edit'' to open the extended view. See the section below for more information.


If you enter settings for the GUI browser, you can enter the ''Connection name'' with which the connection is displayed. This is also the name under which devices can use this connection when it is established. If you leave the field blank, a name will be generated. If the box "''Managed by expecco''" is checked, expecco will start a local Appium server on a free port, or use a free server that has already been started. To use your own server, turn this feature off and enter the appropriate address. You will get the local default address and already used addresses to choose from.
[[Datei:MobileTestingConnectblock.png | frame | left | Abb. 9: Verbindungsbaustein editieren]]
<br clear="all">
Wechseln Sie nun zum Testplan ''Demo-Test'' (1) (Abb. 10). Dieser Testplan enthält bereits einige fertige Testfälle. Vor und nach der Ausführung (2) ist außerdem jeweils ein Baustein eingetragen: Der eben bearbeitete Baustein ''Connect'' für den Aufbau und der Baustein ''Disconnect'' für den Verbindungsabbau. Durch das Eintragen der beiden Bausteine an dieser Stelle geschieht der Verbindungsabbau insbesondere auch dann, wenn der Test vorzeitig abgebrochen wird, z. B. weil einer der Testfälle fehlschlägt.


In older expecco versions the box is labeled "''Start on demand''". In this case, you must also enter an address if you want expecco to start the server. expecco then tries to start an Appium server at the given address when connecting, if none is running there yet. This server will then also be shut down when the connection is terminated. This only works for local addresses. Make sure that you only use port numbers that are free. It is best to only use odd port numbers from the standard port 4723. The following port number is also used when establishing a connection, which could otherwise lead to conflicts.
[[Datei:MobileTestingTestplan.png | frame | left | Abb. 10: Testplanausführung]]
<br clear="all">
Jetzt können Sie den Testplan ''Demo-Test'' starten, indem Sie auf den grünen Play-Knopf (3) klicken. Der Testplan sollte ohne Fehler durchlaufen.


Depending on how you opened the dialog, there are now different buttons to close it. In any case you have the option to save. This opens a dialog where you can either select an open project to save the settings there as an attachment, or choose to save it to a file that you can then specify. Saving does not close the dialog, allowing you to select another option.
=== Schritt 2: Einen Baustein mit dem Recorder erstellen ===
Mit Hilfe des integrierten Recorders lassen sich einfach Ausführungssequenzen aufnehmen und in einem Baustein speichern. Dafür muss eine Verbindung zu einem Testgerät bestehen, mit dessen Hilfe der Test erstellt wird.


If you have opened the editor for establishing a connection, you can finally click on ''Connect'' or ''Start and connect server'', depending on whether the check mark for server start is set. For changing or copying a connection in the GUI Browser, this option is called ''Apply'', since in this case only the connection entry is changed or created, but the connection setup is not started. If necessary, you can do this afterwards via the context menu. If you have changed capabilities of an existing connection, a dialog then prompts you to decide whether these changes should be applied directly by closing the connection and establishing the new connection or not. In this case, the changes only take effect after you reestablish the connection.
Um eine Verbindung aufzubauen, wechseln Sie zurück zum GUI-Browser. In diesem ist noch die Verbindung eingetragen, die Sie zuvor angelegt haben. Da für die Verbindung im Testlauf derselbe Name verwendet wurde, wurden die Einstellungen damit überschrieben (In unserem Fall waren die Einstellungen ohnehin identisch). Die Verbindung ist zur Zeit nicht aktiv, da sie am Ende der Ausführung abgebaut wurde. Die Einstellungen sind dort aber noch eingetragen. Um die Verbindung mit dieser Konfiguration wieder aufzubauen, wählen Sie sie aus, gefolgt von einem Rechtsklick und ''Verbinden''.


To use the connection editor, also read the corresponding section in the respective tutorial in step 1. (Android: [[Mobile_Testing_Tutorial/en#Step_1:_Run_Demo|Run Demo]], iOS: [[Mobile_Testing_Tutorial/en#Step_1:_Run_Demo_2|Run Demo]]).
Warten Sie, bis die Verbindung aufgebaut ist (1) und drücken Sie dann den Aufnahme-Knopf (2), um eine Aufzeichnung zu starten (Abb. 11).


===Extended View===
[[Datei:MobileTestingRecorderStarten.png | frame | left | Abb. 11: Recorder starten]]
The extended view of the connection editor can be obtained either by clicking on ''Edit'' in the third step or at any time via the corresponding menu item if you have started the editor via the plugin menu. This view displays a list of all configured Appium Capabilities. You can add, change or remove further entries to this list. To add a capability, select it from the drop-down list of the input field. In this list all known capabilities are sorted into the categories ''Common'', ''Android'' and ''iOS''. If you have selected a capability, a short information text is displayed. You can also enter a capability manually in the field. Then click on ''Add'' to add the capability to the list. There you can set the value in the right column. To delete an entry, select it and click on ''Remove''. With ''Back'' you leave the extended view.
<br clear="all">
Es öffnet sich ein Fenster mit dem Mobile Testing Recorder (Abb. 12). Dieser zeigt einen Screenshot des verbundenen Geräts. Über diese Anzeige können Sie das Gerät fernsteuern. Dabei wird jede Aktion, die Sie ausführen, im Hintergrund aufgezeichnet.


[[Datei:MobileTestingErweiterteAnsicht.png]]
In der oberen Menüleiste können Sie das Werkzeug auswählen (1), mit dem Sie eine Aktion eingeben möchten. Als Voreinstellung ist das Werkzeug ''Auto'' ausgewählt. Sie können damit bestimmte Aktionen aufzeichnen, indem Sie mit dem Mauszeiger entsprechende Gesten auf der Anzeige ausführen. Wenn Sie zum Beispiel mit der linken Maustaste lange klicken, entspricht das einem langen Antippen des Elements an dieser Stelle. Anstatt die gewünschte Aktion mit der entsprechenden Geste zu bestimmen, können Sie diese alternativ auch manuell auswählen.


== Running Appium Servers ==
Es soll nun ein neuer Test für das Erkennen korrekter GTIN-13-Codes aufgenommen werden. Klicken Sie zunächst in der Anzeige kurz auf den Button ''GTIN-13 (EAN-13)'' (2) der App um einen entsprechenden Klick auf dem Gerät auszulösen. Während der Ausführung dieser Aktion wird der Rahmen des Recorders kurzzeitig rot. Falls der Recorder danach nicht die aktuelle Ansicht der App darstellen sollte, klicken Sie im Recorder auf das Aktualisierungssymbol (3).
In the menu of the Mobile Testing Plugin you will find the entry ''Appium-Server...''. This opens a window with an overview of all Appium servers started by expecco and on which port they are running. By clicking on the icon in the column ''Show Log'' you can view the logfile of the corresponding server. This is deleted when the server is shut down. With the icons in the column ''Exit'' the corresponding server can be terminated. However, this is prevented if expecco still has an open connection via this server. The rightmost column shows for which connection the server is in use. If it reads ''<idle>'', the server is currently not used by expecco.


[[Datei:MobileTestingAppiumServer.png]]
[[Datei:MobileTestingRecorder1.png | frame | left | Abb. 12: Über Recorder zur GTIN-13-Activity wechseln]]
<br clear="all">
Anschließend soll im Eingabefeld der neuen Seite eine korrekte GTIN-13 eingegeben werden. Führen Sie dazu einen Rechtsklick auf dem Eingabefeld (1) aus und wählen Sie im Kontextmenü die Aktion ''Text setzen'' (2) (Abb. 13). Geben Sie in den sich daraufhin öffnenden Dialog eine beliebige gültige Artikelnummer im GTIN-13-Format ein, bspw. ''4006381333986'' (3). Dieser Text wird nun in der App gesetzt.


When opening the editor to start an Appium connection, an Appium server is started immediately to speed up the connection process. For this purpose, expecco always keeps one idle running Appium server. Additional running servers however, which are not in use anymore, will be terminated automatically after a while.
[[Datei:MobileTestingRecorder2.png | frame | left | Abb. 13: GTIN-13-Code über Recorder eingeben]]
<br clear="all">
Klicken Sie nun auf ''Verify'' (1) (Abb. 14). In der App erscheint nun als Ergebnis ''OK'' (2). Der Test soll feststellen, ob tatsächlich dieses Ergebnis angezeigt wird. Nach einem Rechtsklick darauf können Sie im Kontextmenü die Aktion ''Attribut zusichern'' (3) auswählen. Wählen Sie im Dialog, der sich daraufhin öffnet, die Eigenschaft ''text'' (4) aus und bestätigen Sie mit ''OK'' (5). Dieses Mal wird keine Aktion auf dem Gerät ausgelöst, sondern nur ein Baustein aufgezeichnet, der fehlschlägt, sollte das Ergebnis vom erwarteten Wert ''OK'' abweichen.


In the menu of the Mobile Testing Plugin you will also find the entry ''Close all Connections and Servers''. This is intended for cases where connections or servers cannot be terminated in any other way. If possible, always terminate connections in the GUI browser or by executing a corresponding block. Servers that you have started in the server overview should be terminated there; servers that were started with a connection are automatically terminated with this connection.
[[Datei:MobileTestingRecorder3.png | frame | left | Abb. 14: Antwort der App über Recorder auslesen]]
<br clear="all">
Schließen Sie nun den Recorder. Im ''Arbeitsbereich'' des GUI-Browsers sehen Sie, dass für jede der aufgenommenen Aktionen ein Baustein angelegt wurde (Abb. 15). Sie können nun testen, ob sich das Aufgenommene wieder abspielen lässt. Dazu müssen Sie zunächst die App auf Ihrem Gerät in den Anfangszustand zurückbringen, indem Sie auf dem Gerät die Schaltfläche ''HOME'' oben rechts benutzen. Klicken Sie dann in expecco auf den grünen Play-Knopf (1). Wird alles grün, war die Ausführung erfolgreich. Erstellen Sie nun daraus einen neuen Baustein in der Testsuite, indem Sie auf das Bausteinsymbol (2) in der rechten oberen Ecke klicken. Geben Sie ihm den Namen ''GTIN_Verify_OK'' (3) und bestätigen Sie (4).


Note that only servers started and managed by expecco are listed in the overview. Possible other Appium servers that were started in a different way are not recognized.
[[Datei:MobileTestingArbeitsbereich.png | frame | left | Abb. 15: Neuen Baustein aus Arbeitsbereich exportieren]]
<br clear="all">
Bauen Sie nun die Verbindung ab, indem Sie die Verbindung auswählen, rechtsklicken und im Kontextmenü ''Verbindung abbauen'' auswählen.


== Recorder ==
Wechseln Sie zurück zum Reiter der Testsuite. Dort wurde der neue Baustein angelegt. Wählen Sie wieder den Testplan ''Demo-Test'' aus und fügen Sie den aufgenommenen Testfall ''GTIN_Verify_OK'' per Drag-and-drop am Ende des Testplans hinzu. Übernehmen Sie die Änderung und starten Sie erneut. Der Testplan sollte wieder ohne Fehler durchlaufen.
If the GUI browser is connected to a device, the integrated recorder can be used to record a test section with that device. To start the recorder, select the appropriate connection in the GUI browser and click the Record button. A new window opens for the recorder. The recorded actions are created in the GUI browser work area. It is therefore possible to edit the recorded data in parallel.


[[Datei:MobileTestingRecorder.png|caption|]]
=== Schritt 3: XPath anpassen mithilfe des GUI-Browsers ===
Ihr neuer Baustein funktioniert auf anderen Geräten möglicherweise nicht. Die verwendeten Elemente werden über einen XPath adressiert und dieser kann auf anderen Geräten nicht stimmen. Lesen Sie dazu den Abschnitt [[#XPath_anpassen_mithilfe_des_GUI-Browsers|XPath anpassen mithilfe des GUI-Browsers]]. Falls Ihnen ein weiteres Gerät zur Verfügung steht, können Sie nun versuchen, die Pfade in Ihren erstellten Bausteinen zu verallgemeinern. Sie können diesen Schritt aber auch überspringen.


====Components of the Recorder Window====
Wenn es Ihnen schwerfällt, verkürzte Pfade zu finden, orientieren Sie sich dabei an den Pfaden der bereits vorhandenen Bausteine. Starten Sie den Test erneut. Sollte der Test jetzt fehlschlagen, überprüfen Sie die Pfade noch einmal im GUI-Browser.
#'''Continue/Pause Recording''': You can pause the recording by clicking the right icon. You will then see a large pause sign in the view. All actions that you perform now in the recorder are executed, but no blocks are recorded. You can switch back to normal recording mode by clicking the left icon.
Um den Test nun auf einem zweiten Gerät auszuführen, öffnen Sie im Menü ''Erweiterungen'' > ''Mobile Testing'' > ''Verbindungseinstellungen erstellen''. Sie erhalten einen Dialog ähnlich zum Verbindungsdialog. Allerdings können Sie hier nur Einstellungen erstellen und speichern aber keine Verbindung herstellen. Sie haben jedoch die Möglichkeit, einzelne Aspekte der Einstellungen zu speichern wie bspw. nur das Gerät. Wählen Sie das neue Gerät aus und klicken Sie länger auf das Symbol zum Speichern im Anhang bis sich das verzögerte Menü öffnet (Abb. 16). Wählen Sie hier ''Geräte-Einstellungen speichern''. Benennen Sie den Anhang am besten nach dem Gerät. Danach können Sie den Dialog wieder schließen.
#'''Stop Recording''': Stops the recording and closes the recorder window.
#'''Update''': Gets the current image and element tree from the device. This is necessary if the device takes longer to execute an action or if something changes without being triggered by the recorder. Since expecco 21.2, there is an additional submenu here that can be used to enable automatic update by checking for changes in the background (see also ''Automatic Update'' further below).
#'''Follow Mouse''': Select the element under the mouse pointer in the GUI browser.
#'''Element Highlighting''': The element under the mouse is outlined in red.
#'''Show Elements''': Show the borders of all elements in the view.
#'''Tools''': Selection, which tool is used for recording. The selected action is triggered with each click on the view. The following actions are available:
#*Element Actions:
#**Click: Short click on the element under cursor. To determine more precisely which element is used, use the Follow Mouse or Element Highlighting function.
#**Tap with Duration (Element): Similar to click, except that the duration of the click will be recorded as well. This allows the recording of long clicks.
#**Tap with Position (Element): Similar to click, but additionally records the position inside the element. The position can be recorded relative to the element size or, when pressing Ctrl while clicking, as absolute position from the upper left corner of the element.
#**Set Text: Allows to set the text of an input field.
#**Clear Text: Clears the text of an input field.
#*Device Actions:
#**Tap (Screen): Triggers a click at the screen position.
#**Tap with Duration (Screen): Triggers a click at the screen position, which also considers the duration.
#**Swipe: Swipe in a straight line from the point where you press the mouse button until you release it. The duration is also recorded.
#:Please note for this actions that the result may differ on different devices, e.g. with different screen resolutions.
#*Test Flow Blocks
#**Check Attribute: Compares the value of a specified attribute of the element with a predefined value. The result triggers the corresponding output.
#**Assert Attribut: Compares the value of a specified attribute of the element with a predefined value. If the values are not equal, the test fails.
#**Get Attribute: Gets the current value of a specified attribute of the element.
#*Auto
#:If the Auto tool is selected, you can use all actions by specific input methods: ''Click'', ''Tap Element'' and ''Swipe'' still work by clicking, but are distinguished by the duration and movement of the cursor. To trigger a ''Tap'', hold down Ctrl while clicking. The remaining actions are available in a context menu by right-clicking on the element.
#'''Context Actions''': Here you can record actions concerning contexts:
#*Switch to Context: Shows a list of all currently available contexts and you can select to which one you want to switch.
#*Get Current Context: Gets the handle of the current context.
#*Get Context Handles: Gets a list of all currently available contexts.
#'''Softkeys''': Only for Android. Simulates pressing the buttons Back, Home, Menu and Power.
#'''Home Button''': Only for iOS since expecco 2.11. Allows pressing the Home button.Prior to expecco 19.2, it only works if AssistiveTouch is activated and the menu is located in the middle of the upper screen border. From expecco 19.2 on, the function no longer uses AssistiveTouch.
#'''Help''': Opens this online documentation on the general page about [[GuiBrowser_Recorder/en|GUI Browser recorders]].
#'''View''': Shows a screenshot of the device. Actions are triggerd by mouse depending on the selected tool. If a new action can be recorded, the window has a green frame, else it is red.
#'''Resize Window to Image''': Resizes the recorder window so that the screenshot can be displayed completely.
#'''Resize Image to Window''': Scales the screenshot to a size that makes use of the full size of the window.
#'''Adjust Display''': Opens a dialog to adjust the displayed image, if expecco does not show it right. You can correct the scaling or rotate the image by 90°.
#'''Correct Orientation''': Corrects the image if it is upside down. Using the arrow to the right, the image can also be rotated by 90°, if this should ever be necessary. Since expecco 19.1 you find this functionality under ''Adjust Display''. The orientation of the image is irrelevant for the functionality of the recorder, it only works on the elements it receives.
#'''Scaling''': Changes the scaling of the screenshots.
#'''Messages''': Shows the path of the current selected element or other messages. It has a context menu to show a list of previous messages.


====Usage====
[[Datei:MobileTestingGerätSpeichern.png | frame | left | Abb. 16: Einstellungen für ein Gerät speichern]]
Each click in the window triggers an action and is recorded in the workspace of the GUI browser. There you can run, edit, or create a new block from what you have recorded. You find the actions to trigger softkeys directly in the menu bar (see above). To record actions on elements, either change the selection of the tool in the menu bar (see above) and then click on the element or select the corresponding action from the context menu by right-clicking on the corresponding element. For text input it is also possible to place the cursor over the element and enter the text. This opens the input dialog for this action. On how to use the recorder, see also step 2 in the tutorial ([[Mobile_Testing_Tutorial/en#Step_2:_Creating_a_Block_with_the_Recorder|Android]] resp. [[Mobile_Testing_Tutorial/en#Step_2:_Creating_a_block_with_the_Recorder_2|iOS]]).
<br clear="all">
Wählen Sie den Baustein ''Connect'' aus und ziehen Sie die Einstellungen für das neue Gerät in dessen Netzwerk. Verbinden Sie nun dessen Ausgangspin ''pathName'' mit dem Eingangspin ''stringOrFilename[2]'' des Bausteins ''Connect from File''. Der Baustein Connect from File liest die Angaben an den Eingangspins von oben nach unten ein, mehrfache Eigenschaften werden dabei ersetzt. In diesem Fall werden also die Einstellungen zum verwendeten Gerät ersetzt, während die übrigen Einstellungen gleich bleiben. Wenn Sie die Pfade geschickt gewählt haben, wird der Test nun auch auf dem anderen Gerät erfolgreich ablaufen.


====Hide elements====
=== Schritt 4: Noch einen Baustein erstellen ===
Since expecco 21.2 it is also possible to hide the selected element in the recorder from the context menu. This means that this element cannot be selected from now on. This function is useful for ignoring elements that are in the foreground to be able to access elements below them. To undo this state, you have to find the corresponding element in the tree of the GUI browser, which also has such an entry in the context menu.
Falls sich gleiche Abläufe im Test wiederholen, können Sie dafür bereits erstellte Bausteine wiederverwenden oder abwandeln. Der in Schritt 2 erstellte Baustein prüft die Erkennung korrekter GTIN-13-Codes. Es fehlt noch ein Test, der umgekehrt das Erkennen eines falschen GTIN-13-Codes prüft. Die Struktur der beiden Tests ist identisch, sie unterscheiden sich lediglich in ihren Parametern. Kopieren Sie daher den Baustein ''GTIN_Verify_OK'' und benennen Sie die Kopie in ''GTIN_Verify_NOT_OK'' um. Ändern Sie die Eingabe der GTIN-13 in einen falschen Code zum Beispiel durch Ändern der letzten Ziffer (''4006381333987'') und setzen Sie den Überprüfungswert der Ausgabe auf ''NOT OK'' (Abb. 17).


====Automatic Update====
[[Datei:MobileTestingGTIN_Verify_NOT_OK.png | frame | left | Abb. 17: Baustein editieren]]
The recorder doesn't show a live image of the device, but only a snapshot. Therefore an update is needed after changes to match what is displayed on the device. The recorder updates automatically after executing an action. Since expecco 20.2 there are further automatic updates possible. You can enable the, in the menu "View".
<br clear="all">
Fügen Sie diesen neuen Test ebenfalls zum Testplan Demo-Test hinzu und setzen Sie ihn ans Ende. Führen Sie den Testplan aus, aber vergessen Sie nicht, vorher die Verbindung im GUI-Browser abzubauen.


One option is, to check after an action has been executed, if there are further changes after the first update. If so, a second update is triggered. This shall fix the problem, that the recorder is not up to date after an action, because the update has been done too early.
Der neue Test wird fehlschlagen, weil Ihr aufgenommener Baustein nicht wieder zur Startseite der App zurückkehrt, die Tests aber jeweils von dort aus starten. In den anderen Bausteinen ist dies bereits berücksichtigt; sie führen abschließend immer den Baustein ''Back to main menu'' aus. Sie sehen das, indem Sie einen der anderen Bausteine, z. B. ''GTIN_Calculate'', auswählen und auf seine Schema-Ansicht wechseln. Dort steht der Baustein ''Back to main menu'' im Feld ''Nach Ausführung'' (Abb. 18). Wie beim entsprechenden Feld beim Testplan wird auch dieser Baustein immer am Ende ausgeführt, unabhängig davon, ob der Test erfolgreich verläuft oder abbricht. Ergänzen Sie diesen Eintrag nun in Ihren Bausteinen ''GTIN_Verify_OK'' und ''GTIN_Verify_NOT_OK''. Wählen Sie dazu den Baustein aus und ziehen Sie in der Schema-Ansicht den Baustein ''Back to main menu'' einfach auf das Eingabefeld ''Nach Ausführung''. Nun können Sie den Testplan starten und alle Tests sollten wieder problemlos ausgeführt werden.


The second option is to enable a periodical update. After a set interval the recorder is automatically updated if there are changes. Thereby the recorder view is mostly up to date, but this causes an overhead regarding the communication to the device.
[[Datei:AppiumDemo Nach Ausführung.png | frame | left | Abb. 18: Nach-Ausführungs-Baustein setzen]]
<br clear="all">


== AVD Manager und SDK Manager ==
=== Schritt 5: Test vervollständigen ===
AVD Manager und SDK Manager sind beides Anwendungen von Android. Im Menü des Mobile Testing Plugins bietet expecco die Möglichkeit, diese zu starten. Ansonsten finden Sie diese Programme bei Ihrer Android-Installation. Mit dem AVD Manager können Sie AVDs, also Konfigurationen für Emulatoren, erstellen, bearbeiten und starten. Mit dem SDK Manager erhalten Sie einen Überblick über Ihre Android-Installation und können diese bei Bedarf erweitern.
Für die Activity IBAN sind bereits alle Antwortmöglichkeiten der App mit Testfällen abgedeckt. In der GTIN-13-Activity werden ein korrekter und ein fehlerhafter Code getestet und eine Prüfziffer berechnet, das Verhalten der App bei Eingaben falscher Länge wird aber bisher nicht getestet (Bei Verify '''Input must be exactly 13 digits''. und ''…12 digits''. bei Calculate). Die Activity zum Prüfen der Seriennummern von Eurobanknoten wird noch gar nicht getestet. Wie bei der IBAN können hier drei Fälle auftreten: eine korrekte Seriennummer wurde eingegeben (Antwort: ''OK''), eine falsche Seriennummer wurde eingegeben (Antwort: ''NOT OK'') oder die Angabe entspricht nicht dem Format (Antwort: ''A serial number consists of 12 characters with the first one or two being capital letters (A-Z).''). Sie können die Testabdeckung jetzt noch erweitern, indem Sie entsprechende Testfälle erstellen. Die Bausteine dafür können Sie wie in Schritt 2 mit dem Recorder erstellen und die XPaths bei Bedarf verallgemeinern. Wenn Sie mit dem grundsätzlichen Umgang mit expecco vertraut sind, können Sie Bausteine natürlich auch ohne Recorder erstellen, indem Sie sie manuell aus vorhandenen Bausteinen der Bibliothek zusammensetzen. Sie können auch beide Vorgehensweisen nach Belieben kombinieren.


= Hybrid Apps and WebViews =
Beachten Sie, dass die hier vorgestellten Testfälle jeweils nur einzelne Eingaben prüfen. Wenn Sie Testfälle für Ihre eigenen Apps schreiben, wollen Sie vermutlich engmaschiger testen, indem Sie noch weitere unterschiedliche Werte eingeben, die insbesondere auch Randfälle enthalten.
'''!!! IMPORTANT NOTICE - If you have problems switching to the webview, please set the "Default Application - Browser App" in Android Settings to "Chrome" !!!'''


Hybrid apps contain platform native elements as well as other elements that are integrated in a WebView. These elements can also be used, but you first have to switch to the corresponding context. With the block ''Get Current Context'' you get the current context. Initially this is ''NATIVE_APP'', i.e. the context of the native elements. With the block ''Get Context Handles'' you get a collection of all existing contexts. If there is a WebView context, it is called ''WEBVIEW_1'' or ''WEBVIEW_<package>'' with the package of the WebView. Several WebView contexts are also possible. For each WebView context, there is a corresponding WebView element in the native context. You can use the ''Switch to Context'' block to switch to such a context and from now on only have access to the elements in this context.
==<span id="FirstStepsIOS"><!-- Referenced by m03_expeccoMobileDemoIOS.ets --></span> Erste Schritte mit iOS ==
Es wird vorausgesetzt, dass Sie das Kapitel [[#Installation_und_Aufbau|Installation und Aufbau]] bereits gelesen und die nötigen Vorbereitungen für die Verwendung von iOS-Geräten unter Mac OS abgeschlossen haben. Schließen Sie das Gerät, das Sie verwenden wollen, an den Mac an. Laden Sie die iOS-Version der [http://download.exept.de/transfer/h-expecco-2.11.0-pre/expeccoMobileDemo.ipa expeccoMobileDemo-App] auf den Mac herunter. Da es sich bei der App um einen Debug-Build handelt, müssen Sie sie noch für Ihr Gerät signieren (siehe [[#iOS-Ger.C3.A4t_und_App_vorbereiten|iOS-Gerät und App vorbereiten]]). Starten Sie nun einen Appium-Server auf dem Mac.


In the GUI browser, the existing contexts are displayed at the top of the tree as well as the tree of a context is inserted below the corresponding WebView element.
=== Schritt 1: Demo ausführen ===
Starten Sie expecco und öffnen Sie die Testsuite ''m03_expeccoMobileDemoIOS.ets'' über die Schaltfläche ''Beispiel aus Datei'' (Abb. 1). Ab expecco 2.11 befindet sich diese im Unterordner ''mobile''. Ansonsten laden Sie die Testsuite [http://download.exept.de/transfer/h-expecco-2.10.0/m03_expeccoMobileDemoIOS.ets m03_expeccoMobileDemoIOS.ets] auf den Rechner, auf dem sich Ihre expecco-Installation befindet, und öffnen diese. In dieser Testsuite befindet sich bereits ein vorgefertigter Testplan mit einigen Testfällen für diese App.

[[Datei:MobileTestingIOSBeispielÖffnen.png | frame | left | Abb. 1: Beispiel-Testsuite öffnen]]
<br clear="all">
Bevor wir uns mit dem weiteren Inhalt der Testsuite beschäftigen, konfigurieren Sie zuerst die Verbindung und welches Gerät Sie benutzen wollen. Öffnen Sie nun den GUI-Browser (1) und wählen Sie unter ''Verbinden'' (2) den Eintrag ''Mobile Testing'' (3) (Abb. 2), um den Verbindungsdialog zu öffnen.
[[Datei:MobileTestingVerbinden.png | frame | left | Abb. 2: Verbindungseditor öffnen]]
<br clear="all">

Hier können Sie ein iOS-Gerät nur von Hand eintragen. Wählen Sie dazu ''iOS-Gerät eingeben'' (Abb. 3). Den Namen und die iOS-Version des Geräts können Sie dessen Eigenschaften entnehmen. Um die Gerätekennung des Geräts zu erfahren, öffnen Sie auf dem Mac in Xcode das Fenster Devices (Command-Shift-2). Dort werden alle angeschlossenen Geräte sowie die zur Verfügung stehenden Simulatoren angezeigt. Hier sehen Sie auch die Gerätekennung (udid) Ihres Geräts und welche Apps installiert wurden. Nachdem Sie das Gerät im Verbindungseditor eingegeben haben, wählen Sie es in der Liste aus und klicken Sie dann auf Weiter.

[[Datei:MobileTestingIOSGerät.png | frame | left | Abb. 3: Hinzufügen eines iOS-Geräts]]
<br clear="all">

Als nächstes geben Sie an, welche App Sie verwenden wollen. Dabei können Sie wählen, ob Sie eine App starten möchten, die bereits auf dem Gerät installiert ist (''App auf dem Gerät'') oder ob eine App installiert und gestartet werden soll (''App installieren''). Für den Fall, dass Sie eine bereits installierte App benutzen wollen, müssen Sie deren Bundle-ID angeben. Diese erfahren Sie ebenfalls im Devices-Fenster von Xcode. Für die Demo-App lautet sie beispielsweise ''de.exept.expeccoMobileDemo''.

Für dieses Tutorial soll die Demo-App erst installiert werden. Wählen Sie also ''App installieren'' aus und tragen Sie bei App den Pfad zu der Datei auf dem Mac ein (Abb. 4). Wenn Sie expecco 2.11 verwenden, können Sie auf dieser Seite auch die Team-ID angeben, die für iOS-Verbindungen angibt, welches Zertifiat verwendet werden soll. Falls Sie bereits in den [[#Konfiguration_des_Plugins|Plugin-Einstellungen]] eine ID angegeben haben, wird diese verwendet. Sie wird hier grau dargestellt, solange Sie keinen anderen Wert angeben. Klicken Sie nun auf ''Weiter''.

[[Datei:MobileTestingIOSAppInstallieren.png | frame | left | Abb. 4: App angeben, die auf dem Gerät installiert werden soll]]
<br clear="all">

Auf der letzten Seite sehen Sie eine Übersicht aller bisherigen Angaben (1) (Abb. 5). Unterhalb der Capabilityliste können Sie einen Namen für die Verbindung angeben, unter dem sie im GUI-Browser angezeigt wird (2). Außerdem lässt sich eine Verbindung über diesen Namen identifizieren und in Bausteinen verwenden; der Name muss daher eindeutig sein. Falls Sie keinen Namen angeben, wird generisch einer erzeugt. Geben Sie als Namen ''expeccoMobileDemo'' ein. Im Feld darunter ist die Adresse zum Appium-Server einzutragen (3). Wenn Sie den Appium-Server mit Standardeinstellungen gestartet haben, müssen Sie dazu nur in der Standardadresse (unterster Eintrag der Vorschlagsliste) ''localhost'' durch die IP-Adresse des Macs ersetzen (im Bild ''172.23.1.49''). Um sicher zu gehen, auf welchem Port der Appium-Server lauscht, sehen Sie in dessen Ausgabe. Dort finden am Anfang die Zeile
<nowiki>info: Appium REST http interface listener started on 0.0.0.0:4723</nowiki>
Steht hier am Ende nicht der Standardport ''4723'' ändern Sie diese Angabe entsprechend ebenfalls in der Konfiguration.

Wenn die Option ''Bei Bedarf starten'' (4) aktiviert ist, überprüft expecco, ob an der Adresse bereits ein Appium-Server läuft, und startet und beendet ihn bei Bedarf automatisch. Das ist allerdings nur für lokale Serveradressen möglich, schalten Sie diese Option daher ab.

[[Datei:MobileTestingServerkonfigurationIOS.png | frame | left | Abb. 5: Verbindungsnamen und Appium-Server konfigurieren]]
<br clear="all">

Klicken Sie nun auf ''Speichern'' (5) um die Einstellungen für die Testausführung zu speichern. Einstellungen können als Anhang einer Testsuite oder in eine externe Datei gespeichert werden (Abb. 6). Falls Sie mehrere Projekte gleichzeitig offen haben, können Sie in der Liste das Projekt auswählen, in dem der Anhang angelegt werden soll. Klicken Sie auf ''Speichern'' im Bereich ''Einstellungen im Anhang speichern'' und geben Sie als Name ''expeccoMobileDemo'' an. Klicken Sie nun auf ''Verbinden'' (6) um mit der angegebenen Konfiguration eine Verbindung herzustellen.

[[Datei:MobileTestingEinstellungenSpeichern.png | frame | left | Abb. 6: Einstellungen speichern]]
<br clear="all">

Der Verbindungsaufbau kann eine Weile dauern. Wenn Sie die Server-Adresse korrekt angegeben haben, sollten Sie in der Ausgabe des Appium-Servers den Verbindungsversuch erkennen. Auf Ihrem iOS-Gerät sollte dabei die App gestartet werden. Passiert nichts auf dem Gerät, kann es daran liegen, dass entweder das Gerät oder die App nicht gefunden wird. Versucht Appium hingegen, die App zu starten und dies schlägt fehl, ist wahrscheinlich die App falsch signiert. Deinstallieren Sie in diesem Fall die App, damit sie mit einer neuen Signatur wieder installiert werden kann.

Warten Sie bis die Verbindung aufgebaut ist und im GUI-Browser angezeigt wird. Nun wissen Sie, dass die Konfiguration funktioniert. Die gespeicherten Einstellungen sollen nun für den Test verwendet werden, der dann die gleiche Verbindung aufbaut. Wählen Sie die Verbindung im GUI-Browser aus, machen Sie einen Rechtsklick und wählen Sie im Kontextmenü ''Verbindung abbauen'', damit es zu keinem Konflikt kommt. Wechseln Sie dann zurück zum Reiter der Testsuite.

In der Testsuite wurden die Einstellungen als Anhang ''expeccoMobileDemo'' angelegt (Abb 7). Wählen Sie den Baustein ''Connect'' (1) aus und wechseln Sie rechts zur Ansicht ''Netzwerk'' (2). Ziehen Sie per Drag-and-drop die Einstellungen in das Netzwerk des Bausteins (3). Verbinden Sie den Ausgangspin ''pathName'' mit dem Eingangspin ''stringOrFilename[1]'' des Bausteins ''Connect from File'' (4). Mit ''Übernehmen'' (5) bestätigen Sie die Änderungen. Dieser Baustein wird zu Beginn des Tests die Verbindung zur App herstellen.

[[Datei:MobileTestingConnectblock.png | frame | left | Abb. 7: Verbindungsbaustein editieren]]
<br clear="all">

Wechseln Sie nun zum Testplan ''Demo-Test'' (1) (Abb. 8). Dieser Testplan enthält bereits einige fertige Testfälle. Vor und nach der Ausführung (2) ist außerdem jeweils ein Baustein eingetragen: Der eben bearbeitete Baustein ''Connect'' für den Aufbau und der Baustein ''Disconnect'' für den Verbindungsabbau. Durch das Eintragen der beiden Bausteine an dieser Stelle geschieht der Verbindungsabbau insbesondere auch dann, wenn der Test vorzeitig abgebrochen wird, z. B. weil einer der Testfälle fehlschlägt.

[[Datei:MobileTestingTestplan.png | frame | left | Abb. 8: Testplanausführung]]
<br clear="all">
Jetzt können Sie den Testplan ''Demo-Test'' starten, indem Sie auf den grünen Play-Knopf (3) klicken. Der Testplan sollte ohne Fehler durchlaufen.

=== Schritt 2: Einen Baustein mit dem Recorder erstellen ===
Mit Hilfe des integrierten Recorders lassen sich einfach Ausführungssequenzen aufnehmen und in einem Baustein speichern. Dafür muss eine Verbindung zu einem Testgerät bestehen, mit dessen Hilfe der Test erstellt wird.

Um eine Verbindung aufzubauen, wechseln Sie zurück zum GUI-Browser. In diesem ist noch die Verbindung eingetragen, die Sie zuvor angelegt haben. Da für die Verbindung im Testlauf derselbe Name verwendet wurde, wurden die Einstellungen damit überschrieben (In unserem Fall waren die Einstellungen ohnehin identisch). Die Verbindung ist zur Zeit nicht aktiv, da sie am Ende der Ausführung abgebaut wurde. Die Einstellungen sind dort aber noch eingetragen. Um die Verbindung mit dieser Konfiguration wieder aufzubauen, wählen Sie sie aus, gefolgt von einem Rechtsklick und ''Verbinden''.

Warten Sie, bis die Verbindung aufgebaut ist (1) und drücken Sie dann den Aufnahme-Knopf (2), um eine Aufzeichnung zu starten (Abb. 9).

[[Datei:MobileTestingRecorderStarten.png | frame | left | Abb. 9: Recorder starten]]
<br clear="all">
Es öffnet sich ein Fenster mit dem Mobile Testing Recorder (Abb. 10). Dieser zeigt einen Screenshot des verbundenen Geräts. Über diese Anzeige können Sie das Gerät fernsteuern. Dabei wird jede Aktion, die Sie ausführen, im Hintergrund aufgezeichnet.

In der oberen Menüleiste können Sie das Werkzeug auswählen (1), mit dem Sie eine Aktion eingeben möchten. Als Voreinstellung ist das Werkzeug ''Auto'' ausgewählt. Sie können damit bestimmte Aktionen aufzeichnen, indem Sie mit dem Mauszeiger entsprechende Gesten auf der Anzeige ausführen. Wenn Sie zum Beispiel mit der linken Maustaste lange klicken, entspricht das einem langen Antippen des Elements an dieser Stelle. Anstatt die gewünschte Aktion mit der entsprechenden Geste zu bestimmen, können Sie diese alternativ auch manuell auswählen.

Es soll nun ein neuer Test für das Erkennen korrekter GTIN-13-Codes aufgenommen werden. Klicken Sie zunächst in der Anzeige kurz auf den Button ''GTIN-13 (EAN-13)'' (2) der App um einen entsprechenden Klick auf dem Gerät auszulösen. Während der Ausführung dieser Aktion wird der Rahmen des Recorders kurzzeitig rot. Falls der Recorder danach nicht die aktuelle Ansicht der App darstellen sollte, klicken Sie im Recorder auf das Aktualisierungssymbol (3).

[[Datei:MobileTestingRecorder1iOS.png | frame | left | Abb. 10: Über Recorder zur GTIN-13-Activity wechseln]]
<br clear="all">
Anschließend soll im Eingabefeld der neuen Seite eine korrekte GTIN-13 eingegeben werden. Führen Sie dazu einen Rechtsklick auf dem Eingabefeld (1) aus und wählen Sie im Kontextmenü die Aktion ''Text setzen'' (2) (Abb. 11). Geben Sie in den sich daraufhin öffnenden Dialog eine beliebige gültige Artikelnummer im GTIN-13-Format ein, bspw. ''4006381333986'' (3). Dieser Text wird nun in der App gesetzt.

[[Datei:MobileTestingRecorder2iOS.png | frame | left | Abb. 11: GTIN-13-Code über Recorder eingeben]]
<br clear="all">
Klicken Sie nun auf ''Verify'' (1) (Abb. 12). In der App erscheint nun als Ergebnis ''OK'' (2). Der Test soll feststellen, ob tatsächlich dieses Ergebnis angezeigt wird. Nach einem Rechtsklick darauf können Sie im Kontextmenü die Aktion ''Attribut zusichern'' (3) auswählen. Wählen Sie im Dialog, der sich daraufhin öffnet, die Eigenschaft ''value'' (4) aus und bestätigen Sie mit ''OK'' (5). Dieses Mal wird keine Aktion auf dem Gerät ausgelöst, sondern nur ein Baustein aufgezeichnet, der fehlschlägt, sollte das Ergebnis vom erwarteten Wert ''OK'' abweichen.

[[Datei:MobileTestingRecorder3iOS.png | frame | left | Abb. 12: Antwort der App über Recorder auslesen]]
<br clear="all">
Schließen Sie nun den Recorder. Im ''Arbeitsbereich'' des GUI-Browsers sehen Sie, dass für jede der aufgenommenen Aktionen ein Baustein angelegt wurde (Abb. 13). Sie können nun testen, ob sich das Aufgenommene wieder abspielen lässt. Dazu müssen Sie zunächst die App auf Ihrem Gerät in den Anfangszustand zurückbringen, indem Sie auf dem Gerät die Schaltfläche ''Home'' oben links benutzen. Klicken Sie dann in expecco auf den grünen Play-Knopf (1). Wird alles grün, war die Ausführung erfolgreich. Erstellen Sie nun daraus einen neuen Baustein in der Testsuite, indem Sie auf das Bausteinsymbol (2) in der rechten oberen Ecke klicken. Geben Sie ihm den Namen ''GTIN_Verify_OK'' (3) und bestätigen Sie (4).

[[Datei:MobileTestingArbeitsbereich.png | frame | left | Abb. 13: Neuen Baustein aus Arbeitsbereich exportieren]]
<br clear="all">
Bauen Sie nun die Verbindung ab, indem Sie die Verbindung auswählen, rechtsklicken und im Kontextmenü ''Verbindung abbauen'' auswählen.

Wechseln Sie zurück zum Reiter der Testsuite. Dort wurde der neue Baustein angelegt. Wählen Sie wieder den Testplan ''Demo-Test'' aus und fügen Sie den aufgenommenen Testfall ''GTIN_Verify_OK'' per Drag-and-drop am Ende des Testplans hinzu. Übernehmen Sie die Änderung und starten Sie erneut. Der Testplan sollte wieder ohne Fehler durchlaufen.

=== Schritt 3: XPath anpassen mithilfe des GUI-Browsers ===
Ihr neuer Baustein funktioniert auf anderen Geräten möglicherweise nicht. Die verwendeten Elemente werden über einen XPath adressiert und dieser kann auf anderen Geräten nicht stimmen. Lesen Sie dazu den Abschnitt [[#XPath_anpassen_mithilfe_des_GUI-Browsers|XPath anpassen mithilfe des GUI-Browsers]]. Falls Ihnen ein weiteres Gerät zur Verfügung steht, können Sie nun versuchen, die Pfade in Ihren erstellten Bausteinen zu verallgemeinern. Sie können diesen Schritt aber auch überspringen.

Wenn es Ihnen schwerfällt, verkürzte Pfade zu finden, orientieren Sie sich dabei an den Pfaden der bereits vorhandenen Bausteine. Starten Sie den Test erneut. Sollte der Test jetzt fehlschlagen, überprüfen Sie die Pfade noch einmal im GUI-Browser.
Um den Test nun auf einem zweiten Gerät auszuführen, öffnen Sie im Menü ''Erweiterungen'' > ''Mobile Testing'' > ''Verbindungseinstellungen erstellen''. Sie erhalten einen Dialog ähnlich zum Verbindungsdialog. Allerdings können Sie hier nur Einstellungen erstellen und speichern aber keine Verbindung herstellen. Sie haben jedoch die Möglichkeit, einzelne Aspekte der Einstellungen zu speichern wie bspw. nur das Gerät. Geben Sie das neue Gerät ein und wählen Sie es aus. Klicken Sie länger auf das Symbol zum Speichern im Anhang bis sich das verzögerte Menü öffnet und wählen Sie hier ''Geräte-Einstellungen speichern'' (Abb. 14). Benennen Sie den Anhang am besten nach dem Gerät. Danach können Sie den Dialog wieder schließen.

[[Datei:MobileTestingGerätSpeichern.png | frame | left | Abb. 14: Einstellungen für ein Gerät speichern]]
<br clear="all">
Wählen Sie den Baustein ''Connect'' aus und ziehen Sie die Einstellungen für das neue Gerät in dessen Netzwerk. Verbinden Sie nun dessen Ausgangspin ''pathName'' mit dem Eingangspin ''stringOrFilename[2]'' des Bausteins ''Connect from File''. Der Baustein Connect from File liest die Angaben an den Eingangspins von oben nach unten ein, mehrfache Eigenschaften werden dabei ersetzt. In diesem Fall werden also die Einstellungen zum verwendeten Gerät ersetzt, während die übrigen Einstellungen gleich bleiben. Wenn Sie die Pfade geschickt gewählt haben, wird der Test nun auch auf dem anderen Gerät erfolgreich ablaufen.

=== Schritt 4: Noch einen Baustein erstellen ===
Falls sich gleiche Abläufe im Test wiederholen, können Sie dafür bereits erstellte Bausteine wieder-verwenden oder abwandeln. Der in Schritt 2 erstellte Baustein prüft die Erkennung korrekter GTIN-13-Codes. Es fehlt noch ein Test, der umgekehrt das Erkennen eines falschen GTIN-13-Codes prüft. Die Struktur der beiden Tests ist identisch, sie unterscheiden sich lediglich in ihren Parametern. Kopieren Sie daher den Baustein ''GTIN_Verify_OK'' und benennen Sie die Kopie in ''GTIN_Verify_NOT_OK'' um. Ändern Sie die Eingabe der GTIN-13 in einen falschen Code zum Beispiel durch Ändern der letzten Ziffer (''4006381333987'') und setzen Sie den Überprüfungswert der Ausgabe auf ''NOT OK'' (Abb. 15).

[[Datei:MobileTestingGTIN_Verify_NOT_OK_iOS.png | frame | left | Abb. 15: Baustein editieren]]
<br clear="all">
Fügen Sie diesen neuen Test ebenfalls zum Testplan Demo-Test hinzu und setzen Sie ihn ans Ende. Führen Sie den Testplan aus, aber vergessen Sie nicht, vorher die Verbindung im GUI-Browser abzubauen.

Der neue Test wird fehlschlagen, weil Ihr aufgenommener Baustein nicht wieder zur Startseite der App zurückkehrt, die Tests aber jeweils von dort aus starten. In den anderen Bausteinen ist dies bereits berücksichtigt; sie führen abschließend immer den Baustein ''Back to main menu'' aus. Sie sehen das, indem Sie einen der anderen Bausteine, z. B. ''GTIN_Calculate'', auswählen und auf seine Schema-Ansicht wechseln. Dort steht der Baustein ''Back to main menu'' im Feld ''Nach Ausführung'' (Abb. 16). Wie beim entsprechenden Feld beim Testplan wird auch dieser Baustein immer am Ende ausgeführt, unabhängig davon, ob der Test erfolgreich verläuft oder abbricht. Ergänzen Sie diesen Eintrag nun in Ihren Bausteinen ''GTIN_Verify_OK'' und ''GTIN_Verify_NOT_OK''. Wählen Sie dazu den Baustein aus und ziehen Sie in der Schema-Ansicht den Baustein ''Back to main menu'' einfach auf das Eingabefeld ''Nach Ausführung''. Nun können Sie den Testplan starten und alle Tests sollten wieder problemlos ausgeführt werden.

[[Datei:AppiumDemo Nach Ausführung.png | frame | left | Abb. 16: Nach-Ausführungs-Baustein setzen]]
<br clear="all">

=== Schritt 5: Test vervollständigen ===
Für die Activity IBAN sind bereits alle Antwortmöglichkeiten der App mit Testfällen abgedeckt. In der GTIN-13-Activity werden ein korrekter und ein fehlerhafter Code getestet und eine Prüfziffer berechnet, das Verhalten der App bei Eingaben falscher Länge wird aber bisher nicht getestet (Bei Verify '''Input must be exactly 13 digits''. und ''…12 digits''. bei Calculate). Die Activity zum Prüfen der Seriennummern von Eurobanknoten wird noch gar nicht getestet. Wie bei der IBAN können hier drei Fälle auftreten: eine korrekte Seriennummer wurde eingegeben (Antwort: ''OK''), eine falsche Seriennummer wurde eingegeben (Antwort: ''NOT OK'') oder die Angabe entspricht nicht dem Format (Antwort: ''A serial number consists of 12 characters with the first one or two being capital letters (A-Z).''). Sie können die Testabdeckung jetzt noch erweitern, indem Sie entsprechende Testfälle erstellen. Die Bausteine dafür können Sie wie in Schritt 2 mit dem Recorder erstellen und die XPaths bei Bedarf verallgemeinern. Wenn Sie mit dem grundsätzlichen Umgang mit expecco vertraut sind, können Sie Bausteine natürlich auch ohne Recorder erstellen, indem Sie sie manuell aus vorhandenen Bausteinen der Bibliothek zusammensetzen. Sie können auch beide Vorgehensweisen nach Belieben kombinieren.

Beachten Sie, dass die hier vorgestellten Testfälle jeweils nur einzelne Eingaben prüfen. Wenn Sie Testfälle für Ihre eigenen Apps schreiben, wollen Sie vermutlich engmaschiger testen, indem Sie noch weitere unterschiedliche Werte eingeben, die insbesondere auch Randfälle enthalten.

= Dialoge des Mobile Testing Plugins =
== Verbindungseditor ==
Mithilfe des Verbindungseditors können Sie schnell Verbindungen definieren, ändern oder aufbauen. Je nach Aufgabe weist der Dialog kleine Unterschiede auf und wird unterschiedlich geöffnet:
*Wenn Sie eine Verbindung aufbauen wollen, erreichen Sie den Dialog im GUI-Browser, indem Sie auf ''Verbinden'' klicken und dann ''Mobile Testing'' auswählen.
*Um eine bestehende Verbindung im GUI-Browser zu ändern oder zu kopieren, wählen Sie diese aus, machen einen Rechtsklick und wählen im Kontextmenü entsprechend ''Verbindung bearbeiten'' oder ''Verbindung kopieren'' aus.
*Wollen Sie Verbindungseinstellungen nicht für den GUI-Browser sondern zur Verwendung in einem Test erstellen, wählen Sie im Menü des Mobile Testing Plugins den Punkt ''Verbindungseinstellungen erstellen...''. Darüber können nur die Einstellungen für eine Verbindung erstellt werden, ohne dass eine Verbindung im GUI-Browser angelegt wird.

Das Menü des Verbindungseditors weist verschiedenen Schaltflächen auf, von denen manche nur beim Erstellen von Verbindungseinstellungen sichtbar sind:
[[Datei:MobileTestingVerbindungseditorMenu.png]]
#''Einstellungen löschen'': Setzt alle Einträge zurück. (Nur beim Erstellen von Einstellungen sichtbar.)
#''Einstellungen aus Datei laden'': Erlaubt das Öffnen einer gespeicherten Einstellungsdatei (*.csf). Deren Einstellungen werden in den Dialog übernommen. Bereits getätigte Eingaben ohne Konflikt bleiben dabei erhalten.
#''Einstellungen aus Anhang laden'': Erlaubt das Öffnen eines Anhangs mit Verbindungseinstellungen aus einem geöffneten Projekt. Diese Einstellungen werden in den Dialog übernommen. Bereits getätigte Eingaben ohne Konflikt bleiben dabei erhalten.
#''Einstellungen in Datei speichern'' und
#''Einstellungen in Anhang speichern'': Hier können Sie die eingetragenen Einstellungen in eine Datei (*.csf) speichern oder als Anhang in einem geöffneten Projekt anlegen. Beide Optionen besitzen ein verzögertes Menü, in dem Sie auswählen können, nur einen bestimmten Teil der Einstellungen zu speichern. (Nur beim Erstellen von Einstellungen sichtbar.)
#''Erweiterte Ansicht'': Damit können Sie in die erweiterte Ansicht wechseln, um zusätzliche Einstellungen vorzunehmen. Lesen Sie dazu mehr am Ende des Kapitels. (Nur beim Erstellen von Einstellungen sichtbar.)
#''Hilfe'': An der rechten Seite wird ein Hilfetext zum jeweiligen Schritt ein- oder ausgeblendet.


Der Dialog ist in drei Schritte unterteilt. Im ersten Schritt wählen Sie das Gerät, das Sie verwenden möchten, im zweiten Schritt wählen Sie aus, welche App verwendet werden soll und im letzten Schritt erfolgen die Einstellungen zum Appium-Server.

===<span id="AppiumConnectionEditorStep1"><!-- Referenced by AppiumConnectionEditor in Mobile Testing Plugin --></span>Schritt 1: Gerät auswählen===
Im oberen Teil erhalten Sie eine Liste aller angeschlossenen Appium-Geräte, die erkannt werden. Mit der Checkbox darunter können Sie die Geräte ausblenden, die zwar erkannt werden, aber nicht bereit sind. Falls Sie ein Gerät eintragen wollen, das nicht angeschlossen ist, können Sie dies mit dem entsprechenden Knopf ''Android-Gerät eingeben'' bzw. ''iOS-Gerät eingeben'' anlegen. Dazu müssen Sie jedoch die benötigten Eigenschaften Ihres Geräts kennen. Das Gerät wird dann in einer zweiten Geräteliste angelegt und kann dort ausgewählt werden. Wenn keine Liste mit angeschlossenen Elementen angezeigt werden kann, werden stattdessen verschiedene Meldungen angezeigt:
*Keine Geräte gefunden
*:expecco konnte kein Android-Geräte finden.
*:Um eine Verbindung zu einem Gerät automatisch zu konfigurieren, stellen Sie sicher, dass es
*:*angeschlossen ist
*:*eingeschaltet ist
*:*einen passenden adb-Treiber installiert hat
*:*für Debugging freigeschaltet ist (siehe unten).
*Keine verfügbaren Geräte gefunden
*:expecco konnte keine verfügbaren Android-Geräte finden. Es wurden aber nicht verfügbare gefunden, z.B. mit dem Status "unauthorized".
*:Um eine Verbindung zu einem Gerät automatisch zu konfigurieren, stellen Sie sicher, dass es
*:*angeschlossen ist
*:*eingeschaltet ist
*:*einen passenden adb-Treiber installiert hat
*:*für Debugging freigeschaltet ist (siehe unten).
*:Um nicht verfügbare Geräte anzuzeigen, aktivieren Sie unten diese Option.
*Verbindung verloren
*:expecco hat die Verbindung zum adb-Server verloren. Versuchen Sie die Verbindung wieder herzustellen, indem Sie auf den Button klicken.
*Verbindung fehlgeschlagen
*:expecco konnte sich nicht mit dem adb-Server verbinden. Möglicherweise läuft er nicht oder der angegebene Pfad stimmt nicht.
*:Überprüfen Sie die adb-Konfiguration in den Einstellungen und versuchen Sie den adb-Server zu starten und eine Verbindung herzustellen indem Sie auf den Knopf klicken.
*Verbinden ...
*:expecco verbindet sich mit dem adb-Server. Dies kann einige Sekunden dauern.
*adb-Server starten ...
*:expecco startet den adb-Server. Dies kann einige Sekunden dauern.

<!--Bei ''Automatisierung durch'' können Sie angeben, welche Automation-Engine verwendet werden soll. Lassen Sie die Einstellung auf ''(Default)'' wird die entsprechende Capability gar nicht gesetzt. Ansonsten stehen Appium, Selendroid und ab expecco 2.11 XCUITest zur Verfügung. In der Regel wird Selendroid nur für Android-Geräte vor Version 4.1 gebraucht.-->Mit ''Weiter'' gelangen Sie zum nächsten Schritt. Wenn Sie Einstellungen für den GUI-Browser eingeben, ist das erst möglich, wenn ein Gerät ausgewählt wurde.

<span id="UnlockingDeveloperOptions">Anmerkung zum Freischalten</span>: In jüngeren Android Versionen werden die Entwickleroptionen zunächst nicht mehr in den Einstellungen angeboten. Falls ihr Android Gerät in den Einstellungen keinen Eintrag zu "''Entwickleroptionen''" zeigt, wählen Sie zunächst den Eintrag "''Telefoninfo''", dann "''SoftwareVersionsInfo''" und klicken darin mehrfach auf den Eintrag "''BuildVersion''".

===<span id="AppiumConnectionEditorStep2"><!-- Referenced by AppiumConnectionEditor in Mobile Testing Plugin --></span>Schritt 2: App auswählen===
Hier können Sie Angaben zur App machen, die getestet werden soll. Dabei können Sie entscheiden, ob Sie eine App verwenden wollen, die bereits auf dem Gerät installiert ist, oder ob für den Test eine App installiert werden soll. Wählen Sie oben den entsprechenden Reiter aus. Je nachdem, ob Sie im vorigen Schritt ein Android- oder ein iOS-Gerät ausgewählt haben, ändert sich die erforderte Eingabe.

*'''Android'''
**''App auf dem Gerät''
**:Wenn Sie im ersten Schritt ein angeschlossenes Gerät ausgewählt haben, werden die Pakete aller installierten Apps automatisch abgerufen und Sie können die Auswahl aus den Drop-down-Listen treffen. Die installierten Apps sind in Fremdpakete und Systempakete unterteilt; wählen Sie die entsprechende Paketliste aus. Diese Auswahl gehört nicht zu den Einstellungen, sondern stellt nur die entsprechende Paketliste zur Verfügung. Sie können den Filter benutzen, um die Liste weiter einzuschränken und dann das gewünschte Paket auswählen. Die Activities des ausgwählten Pakets werden ebenfalls automatisch abgerufen und als Drop-down-Liste zur Verfügung gestellt. Wählen Sie die Activity aus, die gestartet werden soll. In der Regel wird automatisch eine Activity aus der Liste eingetragen. Falls Sie kein verbundenes Gerät verwenden, müssen Sie die Eingabe des Pakets und der Activity von Hand vornehmen.
**''App installieren''
**:Geben Sie bei ''App'' den Pfad zu einer App an. Der Pfad muss für den Appium-Server gültig sein, der verwendet wird. Sie können auch eine URL angeben. Benutzen Sie einen lokalen Appium-Server, können Sie den rechten Butten benutzen, um zu der Installationsdatei der App zu navigieren und diesen Pfad einzutragen. Wenn möglich werden dabei auch das entsprechende Paket und die Activity in den Feldern darunter eingetragen. Diese Angabe ist aber nicht notwendig.

*'''iOS'''
**''App auf dem Gerät''
**:Geben Sie die Bundle-ID einer installierten App an. Sie können die IDs der installierten Apps bspw. mithilfe von Xcode erfahren. Starten Sie dazu Xcode und wählen Sie in der Menüleiste am oberen Bildschirmrand im Menü ''Window'' den Eintrag ''Devices''. Es öffnet sich ein Fenster, in dem eine Liste der angeschlossenen Geräte angezeigt wird. Wenn Sie Ihr Gerät auswählen, sehen Sie in der Übersicht eine Auflistung der von Ihnen installierten Apps.
**''App installieren''
**:Geben Sie bei ''App'' den Pfad zu einer App an. Der Pfad muss für den Appium-Server gültig sein, der verwendet wird. Sie können auch eine URL angeben. Zu den Vorraussetzungen an Apps für reale Geräte lesen Sie bitte den Abschnitt [[#iOS-Ger.C3.A4t_und_App_vorbereiten|iOS-Geräte und App vorbereiten]].

Im unteren Teil können Sie festlegen, ob die App beim Verbindungsabbau zurückgesetzt bzw. deinstalliert werden soll, und ob sie initial zurückgesetzt werden soll. Auch hier wird die entsprechende Capability gar nicht gesetzt, wenn Sie ''(Default)'' auswählen. Mit ''Weiter'' gelangen Sie zum nächsten Schritt.

===<span id="AppiumConnectionEditorStep3"><!-- Referenced by AppiumConnectionEditor in Mobile Testing Plugin --></span>Schritt 3: Servereinstellungen===
Im letzten Schritt befindet sich zunächst im oberen Teil eine Liste aller Capabilities, die sich aus Ihren Angaben der vorigen Schritte ergeben. Wenn Sie sich mit Appium auskennen und noch zusätzliche Capabilities setzen möchten, die der Verbindungseditor nicht abdeckt, können Sie durch Klicken auf ''Bearbeiten'' in die erweiterte Ansicht gelangen. Lesen Sie dazu den Abschnitt weiter unten.

Wenn Sie Einstellungen für den GUI-Browser eingeben, können Sie den ''Verbindungsnamen'' eintragen, mit dem die Verbindung angezeigt wird. Dies ist auch der Name unter dem Bausteine diese Verbindung verwenden können, wenn sie aufgebaut ist. Wenn Sie das Feld frei lassen, wird ein Name generiert. Um die Adresse für den Appium-Server anzugeben, erhalten Sie die lokale Standard-Adresse und bereits verwendete Adressen zur Auswahl. Wenn Sie den Haken für ''Bei Bedarf starten'' setzen, versucht expecco beim Verbinden einen Appium-Server an der angegebenen Adresse zu starten, wenn dort noch keiner läuft. Dieser Server wird dann beim Beenden der Verbindung ebenfalls heruntergefahren. Dies funktioniert nur für lokale Adressen. Achten Sie darauf, nur Portnummern zu verwenden, die auch frei sind. Verwenden Sie am besten nur ungerade Portnummern ab dem Standardport 4723. Beim Verbindungsaufbau wird ebenfalls die folgende Portnummer verwendet, wodurch es sonst zu Konflikten kommen könnte.

Je nachdem, wie Sie den Dialog geöffnet haben, gibt es nun verschiedene Schaltflächen um ihn abzuschließen. In jedem Fall haben Sie die Option zu speichern. Dabei öffnet sich ein Dialog, indem Sie entweder ein geöffnet Projekt auswählen können, um die Einstellungen dort als Anhang zu speichern, oder auswählen es in einer Datei zu speichern, die Sie anschließend angeben können. Durch das Speichern wird der Dialog nicht beendet, wodurch Sie anschließend noch eine andere Option auswählen könnten.

Wenn Sie den Editor zum Verbindungsaufbau geöffnet haben, können Sie abschließend auf ''Verbinden'' oder ''Server starten und verbinden'' klicken, je nachdem, ob der Haken für den Serverstart gesetzt ist. Für das Ändern oder Kopieren einer Verbindung im GUI-Brower heißt diese Option ''Übernehmen'', da in diesem Fall nur der Verbindungseintrag geändert bzw. neu angelegt wird, der Verbindungsaufbau aber nicht gestartet wird. Das können Sie bei Bedarf anschließend über das Kontextmenü tun. Falls Sie Capabilities einer bestehenden Verbindung geändert haben, fordert Sie anschließend ein Dialog auf zu entscheiden, ob diese Änderungen direkt übernommen werden sollen, indem die Verbindung abgebaut und mit den neuen Verbindungen aufgebaut wird, oder nicht. In diesem Fall werden die Änderungen erst wirksam, nachdem Sie die Verbindung neu aufbauen.

Zur Verwendung des Verbindungseditors lesen Sie auch den entsprechenden Abschnitt im jeweiligen Tutorial in Schritt 1 (Android: [[#Schritt_1:_Demo_ausf.C3.BChren|Demo ausführen]], iOS: [[#Schritt_1:_Demo_ausf.C3.BChren_2|Demo ausführen]]).

===Erweiterte Ansicht===
Die erweiterte Ansicht des Verbindungseditors erhalten Sie entweder durch Klicken auf ''Bearbeiten'' im dritten Schritt oder jederzeit über den entsprechenden Menüeintrag, wenn Sie den Editor über das Plugin-Menü gestartet haben. In dieser Ansicht erhalten Sie eine Liste aller eingestellten Appium-Capabilities. Zu dieser können Sie weitere hinzufügen, Einträge ändern oder entfernen. Um eine Capability hinzuzufügen, wählen Sie diese aus der Drop-down-Liste des Eingabefelds aus. In dieser befinden sich alle bekannten Capabilities sortiert in die Kategorien ''Common'', ''Android'' und ''iOS''. Haben Sie eine Capability ausgewählt, wird ein kurzer Informationstext dazu angezeigt. Sie können in das Feld auch von Hand eine Capability eingeben. Klicken Sie dann auf ''Hinzufügen'', um die Capabilitiy in die Liste einzutragen. Dort können Sie in der rechten Spalte den Wert setzen. Um einen Entrag zu löschen, wählen Sie diesen aus und klicken Sie auf ''Entfernen''. Mit ''Zurück'' verlassen Sie die erweiterte Ansicht.

[[Datei:MobileTestingErweiterteAnsicht.png]]

== Laufende Appium-Server ==
Im Menü des Mobile Testing Plugins finden Sie den Eintrag ''Appium-Server...''. Mit diesem öffnen Sie ein Fenster mit einer Übersicht aller Appium-Server, die von expecco gestartet wurden und auf welchem Port diese laufen. Durch Klicken auf das Icon in der Spalte ''Log anzeigen'' können Sie das Logfile des entsprechenden Servers anschauen. Dieses wird beim Beenden des Servers wieder gelöscht. Mit den icons in der Spalte ''Beenden'' kann der entsprechenden Server beendet werden. Allerdings wird dies verhindert, wenn expecco über diesen Server noch eine offene Verbindung hat.

Außerdem können Sie hier auch Server starten. Verwenden Sie die Eingabefelder zur Konfiguration der Serveradresse. Sie können die Felder auch frei lassen, um die Standardwerte zu verwenden. Bitte beachten Sie, dass Server nur lokal gestartet werden können und der gewählte Port nicht belegt sein darf. Typischerweise werden die ungeraden Portnummern ab 4723 verwendet. Die folgende Portnummer wird beim Verbinden mit einem Gerät ebenfalls benötigt, wodurch es mit den geraden Nummern zu Konflikten kommen könnte.

[[Datei:MobileTestingAppiumServer.png]]

Im Menü des Mobile Testing Plugins finden Sie auch den Eintrag ''Alle Verbindungen und Server beenden''. Dies ist für den Fall gedacht, dass Verbindungen oder Server auf andere Weise nicht beendet werden können. Beenden Sie Verbindungen wenn möglich immer im GUI-Browser oder durch Ausführen eines entsprechenden Bausteins. Server, die Sie in der Server-Übersicht gestartet haben, beenden Sie dort; Server, die mit einer Verbindung gestartet wurden, werden automatisch mit dieser beendet.

Beachten Sie, dass in der Übersicht nur Server aufgelistet sind, die von expecco gestartet und verwaltet werden. Mögliche andere Appium-Server, die auf andere Art gestartet wurden, werden nicht erkannt.

== Recorder ==
Besteht im GUI-Browser eine Verbindung zu einem Gerät, kann der integrierte Recorder verwendet werden, um mit diesem Gerät einen Testabschnitt aufzunehmen. Sie starten den Recorder, indem Sie im GUI-Browser die entsprechende Verbindung auswählen und dann auf den Aufnahme-Knopf klicken. Für den Recorder öffnet sich ein neues Fenster. Die aufgezeichneten Aktionen werden im Arbeitsbereich des GUI-Browsers angelegt. Daher ist es möglich, das Aufgenommene parallel zu editieren.

[[Datei:MobileTestingRecorder.png|caption|]]

;Komponenten des Recorderfensters
#'''Aktualisieren''': Holt das aktuelle Bild und den aktuellen Elementbaum vom Gerät. Dies wird nötig, wenn das Gerät zur Ausführung einer Aktion länger braucht oder sich etwas ohne das Anstoßen durch den Recorder ändert.
#'''Follow-Mouse''': Das Element unter dem Mauszeiger wird im GUI-Browser ausgewählt.
#'''Element-Highlighting''': Das Elements unter dem Mauszeiger wird rot umrandet.
#'''Elemente einzeichnen''': Die Rahmen aller Elemente der Ansicht werden angezeigt.
#'''Werkzeuge''': Auswahl, mit welchem Werkzeug aufgenommen werden soll. Die gewählte Aktion wird bei einem Klick auf die Anzeige ausgelöst. Dabei stehen folgende Aktionen zur Verfügung:
#*Aktionen auf Elemente:
#**Klicken: Kurzer Klick auf das Element über dem der Cursor steht. Zur genaueren Bestimmung, welches Element verwendet wird, benutzen Sie die Funktion Follow-Mouse oder Highlight-Selected.
#**Element antippen: Ähnlich zum Klicken, nur dass zusätzlich die Dauer des Klicks aufgezeichnet wird. Dadurch sind auch längere Klicks möglich.
#**Text setzen: Ermöglicht das Setzen eines Textes in Eingabefelder.
#**Text löschen: Löscht den Text eines Eingabefelds.
#*Aktionen auf das Gerät:
#**Antippen: Löst einen Klick auf die Bildschirmposition aus, bei dem auch die Dauer berücksichtigt wird.
#**Wischen: Wischen in einer geraden Linie vom Punkt des Drückens des Mausknopfes bis zum Loslassen. Die Dauer wird ebenfalls aufgezeichnet.
#:Beachten Sie bei diesen Aktionen, dass das Ergebnis sich auf verschiedenen Geräten unterscheiden kann, bspw. bei verschiedenen Bildschirmauflösungen.
#*Erstellen von Testablauf-Bausteinen
#**Attribut prüfen: Vergleicht den Wert eines festgelegten Attributs des Elements mit einem vorgegebenen Wert. Das Ergebnis triggert den entsprechenden Ausgang.
#**Attribut zusichern: Vergleicht den Wert eines festgelegten Attributs des Elements mit einem vorgegebenen Wert. Bei Ungleichheit schlägt der Test fehl.
#*Auto
#:Ist das Auto-Werkzeug ausgewählt, können alle Aktionen durch spezifische Eingabeweise benutzt werden: ''Klicken'', ''Element antippen'' und ''Wischen'' funktionieren weiterhin durch Klicken, wobei sie anhand der Dauer und der Bewegung des Cursors unterschieden werden. Um ein ''Antippen'' auszulösen, halten Sie beim Klicken Strg gedrückt. Die übrigen Aktionen erhalten Sie durch einen Rechtsklick auf das Element in einem Kontextmenü.
#'''Softkeys''': Nur unter Android. Simuliert das Drücken der Knöpfe Zurück, Home, Fensterliste und Power.
#'''Home-Button''': Nur unter iOS ab expecco 2.11. Ermöglicht das Drücken des Home-Buttons. Funktioniert nur, wenn AssistiveTouch aktiviert ist und sich das Menü in der Mitte des oberen Bildschirmrands befindet.
#'''Anzeige''': Zeigt einen Screenshot des Geräts. Aktionen werden mit der Maus je nach Werkzeug ausgelöst. Wenn eine neue Aktion eingegeben werden kann, hat das Fenster einen grünen Rahmen, sonst ist er rot.
#'''Fenster an Bild anpassen''': Ändert die Größe des Fensters so, dass der Screenshot vollständig angezeigt werden kann.
#'''Bild an Fenster anpassen''': Skaliert den Screenshot auf eine Größe, mit der er die volle Größe des Fensters ausnutzt.
#'''Ausrichtung anpassen''': Korrigiert das Bild, falls dieses auf dem Kopf stehen sollte. Über den Pfeil rechts daneben kann das Bild auch um 90° gedreht werden, falls dies einmal nötig sein sollte. Die Ausrichtung des Bildes ist für die Funktion des Recorders unerheblich, dieser arbeitet ausschließlich auf den erhaltenen Elementen.
#'''Skalierung''': Ändert die Skalierung des Screenshots. Kann auch über den Schieberegler rechts daneben angepasst werden.
#'''Kontrollleuchte''': Zeigt den Zustand des Recorders an
#:''grün'': Der Recorder ist bereit
#:''rot'': Der Recorder ist blockiert, weil die Anzeige und die Elementliste aktualisiert werden
#:''grau'': Der Recorder kann nicht mehr verwendet werden, da die Verbindung zum Gerät verloren gegangen ist

;Verwendung
Mit jedem Klick im Fenster wird eine Aktion ausgelöst und im Arbeitsbereich des GUI-Browsers aufgezeichnet. Dort können Sie das Aufgenommene abspielen, editieren oder daraus einen neuen Baustein erstellen. Zur Verwendung des Recorders lesen Sie auch Schritt 2 im Tutorial ([[#Schritt_2:_Einen_Baustein_mit_dem_Recorder_erstellen|Android]] bzw. [[#Schritt_2:_Einen_Baustein_mit_dem_Recorder_erstellen_2|iOS]]).

== AVD Manager und SDK Manager ==
AVD Manager und SDK Manager sind beides Anwendungen von Android. Im Menü des Mobile Testing Plugins bietet expecco die Möglichkeit, diese zu starten. Ansonsten finden Sie diese Programme bei Ihrer Android-Installation. Mit dem AVD Manager können Sie AVDs, also Konfigurationen für Emulatoren, erstellen, bearbeiten und starten. Mit dem SDK Manager erhalten Sie einen Überblick über Ihre Android-Installation und können diese bei Bedarf erweitern.


=<span id="Customizing XPath using the GUI Browsers"><!-- name before 01.10.2020--></span>Customizing XPath using the GUI Browser=
= XPath anpassen mithilfe des GUI-Browsers =
Bausteine, die auf einem Gerät fehlerfrei funktionieren, tun dies auf anderen Geräten möglicherweise nicht. Auch können kleine Änderungen der App dazu führen, dass ein Baustein nicht mehr den gewünschten Effekt hat. Man sollte einen Baustein daher so robust formulieren, dass er für eine Vielzahl von Geräten verwendet werden kann und kleine Anpassungen an der App verkraftet. Dazu muss man das grundlegende Funktionsprinzip der Adressierung verstehen. Dies wird im Folgenden am Beispiel der App aus dem Tutorial erläutert.
Bausteine, die auf einem Gerät fehlerfrei funktionieren, tun dies auf anderen Geräten möglicherweise nicht. Auch können kleine Änderungen der App dazu führen, dass ein Baustein nicht mehr den gewünschten Effekt hat. Man sollte einen Baustein daher so robust formulieren, dass er für eine Vielzahl von Geräten verwendet werden kann und kleine Anpassungen an der App verkraftet. Dazu muss man das grundlegende Funktionsprinzip der Adressierung verstehen. Dies wird im Folgenden am Beispiel der App aus dem Tutorial erläutert.


Zeile 759: Zeile 692:
Wenn Sie in der unteren Liste eine Eigenschaft auswählen, wechselt die Anzeige der Bausteine zu ''Eigenschaften'', wo Sie die eigenschaftsbezogenen Bausteine finden. Wie bei den Aktionen können Sie auch hier einen Baustein auswählen, der dann rechts in Test mit dem Pfad des Elements und der ausgewählten Eigenschaft eingetragen wird, sodass Sie ihn direkt ausführen können.
Wenn Sie in der unteren Liste eine Eigenschaft auswählen, wechselt die Anzeige der Bausteine zu ''Eigenschaften'', wo Sie die eigenschaftsbezogenen Bausteine finden. Wie bei den Aktionen können Sie auch hier einen Baustein auswählen, der dann rechts in Test mit dem Pfad des Elements und der ausgewählten Eigenschaft eingetragen wird, sodass Sie ihn direkt ausführen können.


=<span id="troubleshooting"><!-- Referenced by error dialog on connection error --></span>Probleme und Lösungen=
=<span id="troubleshooting"><!-- Referenced by error dialog on connection error --></span>Problems and Solutions=
== Locators depend on the version or are variable ==
==Allgemeine Hinweise==
In this case consider to either store the locators (xPath) in a variable or to define a locator mapping inside a screenplay attachment. It is also possible to store just parts of an locator (e.g. locator path of a parent or attribute value) in a variable and add them in the freeze value of the locator pin by "''$(varName)''".
*Wenn ein über USB angeschlossenes Android-Gerät nicht im Verbindungsdialog auftaucht, versuchen Sie, den USB-Verbindungstyp zu ändern. In der Regel sollten MTP oder PTP funktionieren. Siehe auch [[#Android-Ger.C3.A4t_vorbereiten|Android-Gerät vorbereiten]].
*In manchen Fällen erscheint beim Verbinden eines iOS-Geräts über USB der Hinweis, das verwendete Kabel sei nicht zertifiziert. In diesem Fall hilft es nur, das entsprechende Kabel auszutauschen.
*Beachten Sie, dass im [[#Recorder|Recorder]] auch Elemente berücksichtigt werden, die Sie auf dem Bildschirm nicht sehen. Schalten Sie daher das Element-Highlighting an oder nutzen Sie Follow-Mouse-Funktion und den Elementbaum im GUI-Browser, um festzustellen, ob das richtige Element verwendet wird.
*Stellen Sie sicher, dass beim Verbindungsaufbau mit einem iOS-Gerät keine Alerts geöffnet sind. Der Aufbau schlägt sonst fehl, da die App nicht in den Vordergrund kommen kann. Siehe auch [[#iOS-Ger.C3.A4t_und_App_vorbereiten|iOS-Gerät und App vorbereiten]].
*Um einen iOS-Simulator zu verwenden müssen Sie keine udid angeben. In Xcode erhalten Sie die Namen der verfügbaren Simulatoren. Starten Sie dazu Xcode und wählen Sie in der Menüleiste am oberen Bildschirmrand im Menü ''Window'' den Eintrag ''Devices''. Hier sind neben den angeschlossenen Geräten auch die verfügbaren Simulatoren aufgelistet. Beachten Sie dabei, dass auf Simulatoren keine ''.ipa''-Dateien sondern nur ''.app''-Dateien installiert werden können.
*Bei Android-Geräten, die Softkeys automatisch ein- und ausblenden, kann es vorkommen, dass der Recorder im unteren Bereich Elemente abschneidet, die durch die Softkeys verdeckt würden, auch wenn sie zu diesem Zeitpunkt gar nicht angezeigt werden. In diesem Fall hift es, die Softkeys so einzustellen, dass sie permanent angezeigt werden.


== Invisible UI Elements ==
==Verbindungsaufbau schlägt fehl==
Note that the [[#Recorder|Recorder]] also considers items that you cannot see on the screen. Therefore, turn on element highlighting or use the follow mouse function and the element tree in the GUI browser to determine if the correct element is used. It can happen, that invisible elements are in front of other elements and cover them, so that the desired element cannot be selected in the recorder. See section [[#Hide_elements|Hide elements]] for a solution to this.
Schlägt der Verbindungsaufbau mit dem Appium-Server fehl, erhalten Sie in expecco eine Fehlermeldung ähnlicher der unten abgebildeten.


== iOS: Cable not certified ==
Falls der Fehler nicht durch eine der unten gelisteten Ursachen bedingt ist,
In some cases, when connecting an iOS device via USB, a message appears indicating that the cable used is not certified. In this case, replacing the respective cable is the only solution.
kann es sein, daß die auf dem Gerät befindliche UI-Automator Anwendung nicht mehr richtig funktioniert
(Anm. dies tritt auf einigen Geräten sporadisch auf - die Ursache dafür ist uns z.Z. noch nicht bekannt).
Hier hilft es, die UI-Automator Anwendungen im Mobilgerät zu deinstallieren.
Expecco wird diese dann mit dem nächsten Verbindungsaufbau selbst wieder installieren.


== iOS: Alerts when connecting ==
Zur Deinstallation navigieren Sie auf dem Gerät zu: "''Einstellungen''" - "''Anwendungen''",
Make sure that no alerts are open when connecting to an iOS device. Otherwise the connection will fail because the app cannot be brought to the foreground. See also [[#Preparing_an_iOS-Device_and_App|Preparing an iOS-Device and App]].
und suchen in der Liste nach folgenden Einträgen:
Appium Settings
io.appium.uiautomator2.server
io.appium.uiautomator2.server.test
klicken Sie auf die jeweilige Anwendung und dann auf "''Deinstallieren''".


== iOS: .ipa cannot be installed ==
Falls die nicht hilft, kann eventuell der Appium-Server log weiter helfen (diesen erreichen Sie über das "''Erweiterungen''" - "''Mobile Testing''" Menü von expecco)
Note that on iOS simulators no ''.ipa'' files can be installed but only ''.app'' files.


==iOS: First Connect is not working==
[[Datei:MobileTestingVerbindungsfehler.png]]
If there is not already a signed build of the WebDriverAgent on your Mac, it has to be created during the first connect. Usually, this can take a little longer than one minute. Per default Appium uses a timeout of 60000&nbsp;ms to wait for the WebDriverAgent to start on the device, so the connect will be canceled in that case. You can set this timeout with the capability ''wdaLaunchTimeout'', e.g. to ''120000''.


Moreover, the signing settings have to be correct. In our experience, the most reliable solution is to set automatic signing in the WebDriverAgent Xcode project an selecting the team there. See the explanation in section [[#Signing_WebDriverAgent|Signing WebDriverAgent]] for that. In this case you should '''not''' use the capabilities ''xcodeConfigFile'' resp. ''xcodeOrgId'' and ''xcodeSigningId'', as they could cause a conflict. Caution: If you have set a Team ID in the Mobile Testing settings, expecco will automatically set this as ''xcodeOrgId''!
Hier sehen Sie die Art des aufgetretenen Fehlers. Klicken Sie auf ''Details'' um nähere Informationen zu erhalten. Mögliche Fehler sind:

Pay attention to your device during the first connect. You might have to agree to the installation by entering your password. On the Mac you might need to enter the password to allow access to the key chain for signing, often several times.

== Android: Device not visible in the connect editor ==
If an Android device connected via USB does not appear in the connection editor, try changing the USB connection type. Usually MTP or PTP should work. Check again, if "USB Debugging" is enabled in the developer options on the device (these options are disabled on some devices and have to be enabled first using a trick.) See also [[#Prepare_Android_Device|Prepare Android Device]].

== Android: Truncated Elements at Bottom ==
For Android devices that automatically show and hide the navigation bar/softkeys, the recorder may cut off elements in the lower area that would be hidden by the softkeys, even if they are not displayed at this time. In this case it is advisable to set the softkeys so that they are permanently displayed.

For newer Android versions there usually is no such option. Even if the controls are visible all the time, they don't have their own space, but are on top of the content of the app. Therefore, there is an area on the lower part of the screen, which cannot be automated, because it is not counted to the active area of the app. Appium will then truncate the elements there. This area can even be larger then the needed by the controls. This is a known issue for Samsung devices with Android 11. Since the information about the size of the app area is already provided on Android level, we cannot offer a solution for this, but can only hope that the problem will be fixed by the manufacturer. You may try to get better results by setting the control to gestures, but this bears the same issue.

==<span id="waitForIdleTimeout"><!-- Referenced by expecco--></span> Android: Test Hangs While Finding an Element==
The block ''Find Element by XPath'' and all element blocks wait until an element is present for the given path. The timeout for this can be set either directly at the block or in the environment variables. However, if the element should already be present, but the test doesn't continue anyway, the reason could be in the UIAutomator/UIAutomator2. It waits for the app to go to the idle state before it even starts to search for the element. This may take longer, if the app e.g. runs an animation in the background or executes other kinds of actions. Fetching the page source, e.g. when updating in the GUI browser or in the recorder, can also take longer for this reason. There is a default timeout of 10 seconds after which it no longer waits for the idle state. This timeout can be set in Appium (waitForIdleTimeout). If you want to change the value of this timeout, you can do this since expecco 21.2 by executing the Smalltalk code <code>AppiumTestRunner::TestRunConnection waitForIdleTimeout:2000</code> before the test. The timeout is given in milliseconds, so the example sets it to 2 seconds.

==<span id="startChromedriverTimeout/>Android: Updating the Tree or Switching to Webview Context takes too long==
Especially with older devices it can happen that newer Chromedriver cannot be initialized. This makes it impossible to switch to the webview context. However, this is only detected over a timeout by Appium, which is 4 minutes by default. Since expecco also tries to switch to the webview context when building the tree in the GUI browser, this can lead to very long loading times. Since there is no way to decrease this timeout in Appium, we have added a corresponding capability to the version we provide in the MobileTestingSupplement. Starting with version 1.13.1.0 of the [[#Windows|MobileTestingSupplement]], ''chromedriverStartTimeout'' can be used to set the timeout in milliseconds. The switch still doesn't work then, but expecco doesn't take as long to update the tree and the context switch module fails faster. The connection dialog adds this capability automatically starting with expecco 22.1.

== No Action on Click ==
The block to click on an element is successful, but no action was performed on the device.
:This can happen if the element is hidden by another element and therefore clicking on the element is not possible. In this case, Appium does not throw an error, but simply nothing happens. If you would like to make a click at the position of the element anyways, even if it is hidden, use the block ''Tap'' instead and pass the location of the element to it (''Get Location''). If instead you want to check before a click whether the element is hidden at this moment, try whether the properties ''Is Displayed'' or ''Is Enabled'' might help you.

== No Update After Action ==
An action was triggered on the recorder and a block has been recorded, but the recorder still shows the old image.
:The recorder doesn't show a live image of the device, but only a snapshot. After an action has been executed, the recorder will update automatically. However, it can happen, that the image has already been updated before the effects of the action are fully completed on the device. In this case you should update the recorder by hand using the icon with the blue arrows. Since expecco 20.2 you can also enable automatic updates for this case. See also the description for the [[#Recorder|recorder]].

== Attribute "clickable" is wrong ==
An element has for the attribute/property "''clickable''" the value "''false''", but is actually clickable.
:The attribute "''clickable''" has to be set explicitly by the app developer and does not affect the behavior of the app. You should generally disregard this attribute in your tests. Unfortunately, many apps exist where the programmer was "lazy" about this.

==Connecting Fails==
If the connection to the Appium server fails, you will receive an error message in expecco similar to the one shown below.

[[File:MobileTestingVerbindungsfehler.png]]

Here you can see the type of error that has occurred. Click on "''Details''" to get more information. Possible errors are:
*''org.openqa.selenium.remote.UnreachableBrowserException''
*''org.openqa.selenium.remote.UnreachableBrowserException''
:The specified server is not running or is not reachable. Check the server address.
:Der angegebene Server läuft nicht oder ist nicht erreichbar. Überprüfen Sie die Serveradresse.
*''org.openqa.selenium.WebDriverException''
*''org.openqa.selenium.WebDriverException''
:Read the message after ''Original Error'' in the first line of the details:
:Lesen Sie in den Details in der ersten Zeile die Meldung hinter ''Original Error'':
:*''Unknown device or simulator UDID''
:*''Unknown device or simulator UDID''
::Either the device is not connected properly or the udid is not correct.
::Entweder ist das Gerät nicht richtig angeschlossen oder die udid stimmt nicht.
:*''Unable to launch WebDriverAgent because of xcodebuild failure: xcodebuild failed with code 65''
:*''Unable to launch WebDriverAgent because of xcodebuild failure: xcodebuild failed with code 65''
::This error can have various causes. Either the WebDriverAgent could actually not be built because the signing settings are wrong or the appropriate provisioning profile is missing. Please read the section about [[#Signing|Signing]]. It is also possible that the WebDriverAgent cannot be started on the device, for example because an alert is in the foreground or you did not trust the developer.
::Dieser Fehler kann verschiedene Ursachen haben. Entweder konnte tatsächlich der WebDriverAgent nicht gebaut werden, weil die Signierungseinstellungen falsch sind oder das passende Provisioning Profile fehlt. Lesen Sie dazu den Abschnitt zur Verbereitung unter [[#expecco_2.11|Mac OS mit expecco 2.11]]. Es kann auch sein, dass der WebDriverAgent auf dem Gerät nicht gestartet werden kann, weil sich beispielsweise ein Alert im Vordergrund befindet oder Sie dem Entwickler nicht vertraut haben.
:*''Could not install app: 'Command 'ios-deploy [...] exited with code 253'''
:*''Could not install app: 'Command 'ios-deploy [...] exited with code 253'''
::The specified app cannot be installed on the iOS device because it is not entered in the app's Provisioning Profile.
::Die angegebene App kann nicht auf dem iOS-Gerät installiert werden, weil es nicht im Provisioning Profile der App eingetragen ist.
:*''Bad app: [...] App paths need to be absolute, or relative to the appium server install dir, or a URL to compressed file, or a special app name.'''
:*''Bad app: [...] App paths need to be absolute, or relative to the appium server install dir, or a URL to compressed file, or a special app name.''
::Der Pfad zur App ist falsch. Stellen Sie sicher, dass sich die Datei unter dem angegebenen Pfad auf dem Mac befindet.
::The path to the app is wrong. Make sure that the file is located in the specified path on your Mac.
:*''packageAndLaunchActivityFromManifest failed.''
:*''packageAndLaunchActivityFromManifest failed.''
::Die angegebene ''apk''-Datei ist vermutlich kaputt.
::The specified ''apk'' file is probably broken.
:*''Could not find app apk at [...]''
:*''Could not find app apk at [...]''
::The path to the app is wrong. Make sure that the ''apk'' file is located in the specified path.
::Der Pfad zur App ist falsch. Stellen Sie sicher, dass sich die ''apk''-Datei m angegebenen Pfad befindet.


If the error is not due to one of the causes listed above, the automation applications on the device may no longer function properly. In this case it helps to uninstall them from the mobile device. They are then automatically reinstalled the next time a connection is established.

*For iOS devices, this is the WebDriverAgent, which you can simply uninstall from the home screen. This usually solves problems caused by changing the used Mac or the Xcode version.

*For Android devices, it is the UIAutomator2; here, a problem occurs sporadically on some devices, the cause is currently unknown to us. To uninstall, on the device, navigate to "''Settings''" > "''Applications''"<sup>*</sup> and search the list for the following entries:
Appium Settings
io.appium.uiautomator2.server
io.appium.uiautomator2.server.test
:Click on the respective application and then on "''Uninstall''".
<sup>*</sup>''The corresponding entry may have a slightly different name on some devices.''


If this doesn't help, check the output of the Appium server. For a server started by expecco, you can find the log in the list of [[#Running_Appium_Servers|Running Appium Servers]].

==I do not have a Mac==
Maybe this site will help you: [https://www.howtogeek.com/289594/how-to-install-macos-sierra-in-virtualbox-on-windows-10 https://www.howtogeek.com/289594/how-to-install-macos-sierra-in-virtualbox-on-windows-10]

Aktuelle Version vom 22. Dezember 2023, 10:42 Uhr

Deutsche Version | English Version

Inhaltsverzeichnis

Introduction[Bearbeiten]

With the Mobile Testing Plugin applications can be tested on Android and iOS devices. This includes both real and emulated devices. It does not matter whether real mobile devices or emulated devices are used. The plugin can (and usually is) used in conjunction with the GUI-Browser, which supports the creation of tests. It can also be used to record test procedures.

Appium is used to connect to the devices. Appium is a free open source framework for testing and automating mobile applications.

We recommend to go through the Tutorial to familiarize yourself with the Mobile Plugin. This tutorial leads step by step through the creation of a test case using an example and explains the necessary basics.

Installation and Setup[Bearbeiten]

To use the Mobile Testing Plugin, you must have installed expecco together with the corresponding plugin, and you need the appropriate licenses. expecco communicates with the mobile devices via an Appium server, which either runs on the same computer as expecco, or on a second computer. This must be accessible for expecco.

Installation Overview[Bearbeiten]

Computer running expecco:

  • Java JDK version 8, 9, 10 or 11

Computer connected to Android devices :

  • Appium Server, you can install it via the Mobile Testing Supplement (see below), of which we regularly provide a new version
  • Android SDK, you can also get it with the Mobile Testing Supplement
  • Java JDK version 8, 9, 10 or 11

Computer connected to iOS devices*:

  • Appium Server, you can install it via the Mobile Testing Supplement for MacOS (see below), of which we regularly provide a new version
  • Xcode in a version that supports the iOS version used, available from the Apple App Store
  • Java JDK version 8, 9, 10 or 11
  • Apple Developer Certificate incl. matching private key (to sign the WebDriverAgent)
  • Provisioning Profile for the mobile devices to be used

* Please note that due to the requirements (no connection to non-Apple devices available) iOS devices can only be controlled from a Mac.

Depending on the setup, the above-mentioned computers can also be the same device. expecco can either connect to a remote Appium Server and mobile devices connected to it via the network, or start an Appium Server locally itself and use it with local mobile devices. However, some of expecco's functions that make it easier to create test cases are only available if the mobile devices are connected to the same computer on which expecco is running. A possible setup may therefore look like the following figure:

MobileTestingAufbau.png

The following explains how to install Appium and other necessary applications for Windows and Mac OS.

Windows[Bearbeiten]

The easiest way is to install everything from our Mobile Testing Supplement. However, newer versions do not contain a JDK anymore due to a change in Oracle's license terms, so you have to install it additionally. Of course, you are free to install Appium directly to use the version you want. However, to then be able to start an Appium server with expecco, a suitable batch file must be available and specified in the settings. However, connections can also be established to other running Appium servers.

Same versions as in the predecessor, but with updated chromedriver versions
Same versions as in the predecessor, but the installer now allows to add Appium to the Autostart.
Appium 1.22.3*
Node 14.17.5
adb 1.0.41 from platform-tools 33.0.2
* We added the capability startChromedriverTimeout to Appium, to get a timeout earlier, if Chromedriver cannot be initialized. (see Problems and Solutions)
Contains Appium version 1.22.0, Node still is version 12.13.1.
Only minor changes compared to the previous version.
Compared to the previous version, Appium was updated to version 1.16.0-rc.1 and node 12 is used.
This installs Appium in the version 1.12.0 and now additionally contains build-tools in the version 28.0.3 in the android-sdk. Apart from this, it is the same as the previous version.
This installs Appium in the version 1.8.1. In addition, an installation of Android Debug Bridge and Google USB Driver (adb-setup-1.4.3) is offered. This covers drivers for a broad range of Android devices, and you won't have to install an individual driver for each device. A JDK is not contained anymore (due to a change in Oracle's license terms), you have to download it on your own, e.g. from Oracle.
This installs a Java JDK Version 8, android-sdk and Appium Version 1.6.4. The supplement also offers a universal adb driver (ClockworkMod). This driver supports a wide range of Android Devise, and avoids the need to search for individual device-specific drivers.
It installs a Java JDK version 8, android-sdk and Appium version 1.4.16. During the installation the graphical user interface of Appium is started, you can close this window immediately. The supplement also offers a universal adb driver (ClockworkMod). This combines drivers for a wide range of Android devices so that you do not have to search for and install a separate driver for each device.

If expecco has to use mobile devices that are connected to another computer, you have to start an Appium server there. You can do this by using the file appium_standalone.cmd. The server is then started on default port 4723. If you want to use a different port number, start the server with

appium_standalone.cmd -p <portnummer>

The server is ready, as soon as the line

Appium REST http interface listener started on 0.0.0.0:4723

is displayed, where you can read the used port number at the end.

If your Android device is connected to a remote machine, you may want to see the live screen locally using a tool like scrcpy.


When Appium is started for the first time – either standalone or by expecco – it may happen that the Windows firewall blocks access to the node server. Allow the access or Appium cannot be started.

Mac OS[Bearbeiten]

Note: the following can be ignored if you do not plan to test iOS (iPhone) devices. The Mac setup is not needed for Android devices.

Xcode[Bearbeiten]

Automation with iOS devices needs Xcode. You can install it from the App Store. Please make sure that the version matches the tested iOS versions.

iOS   Xcode macOS
10.x 8.x 10.12 (Sierra)
11.x 9.x 10.13 (High Sierra)
12.x 10.x 10.14 (Mojave)
13.x 11.x 10.15 (Catalina)
14.x 12.x 11.0 (Big Sur)
15.x 13.x 12.0 (Monterey)
16.x 14.x 12.5 (Monterey)

This table is only a simplified overview, better see Xcode releases or Xcode versions for the exact versions. For new iOS minor versions, there is usually also a new release of Xcode, e.g. for iOS 10.2 you need at least Xcode 8.2, for iOS 10.3 at least Xcode 8.3, etc. So if you are upgrading to a newer iOS version, you will usually need a newer Xcode version as well. Newer versions of Xcode may not run on older operating systems, which in turn may require an operating system upgrade. If you also want to test older iOS versions, it can be useful to install the corresponding Xcode versions in parallel.

Appium[Bearbeiten]

You can install Appium either as command-line tool or use it with Appium Desktop, which provides a GUI to start the server. Meanwhile there is also Appium 2.0, which is not tested with expecco yet and therefore not recommended to use.

Appium Desktop[Bearbeiten]

Download the newest version of Appium Desktop. For the Mac, it is best to take the dmg file and install it to the applications. When starting Appium Server GUI you will probably get the error message, that it is not possible for security reasons. In this case, open the context menu of the app file (right click or Ctrl + click) and choose Open there. Then confirm that you really want to open the application. From now on you can open the application normally.

OpenAppiumServerGUI1.png OpenAppiumServerGUI2.png

Since Xcode 14 there are problems with signing the WebDriverAgent, which Appium loads on the device for the automation. This means that no connection is possible with version 1.22.3-4 of Appium Desktop. In newer versions of WebDriverAgent, this problem is solved, but currently there is no version of Appium Desktop using such a new version (as of November 2022). However, you can manually download a new version (e.g. 4.10.2) and replace the files in Appium. To do this, download one of the two archive files (zip or tar.gz) containing the source code from the WebDriverAgent download page. Then open and extract this file. Copy the contents of the folder WebDriverAgent-4.10.2' to

/Applications/Appium\ Server\ GUI.app/Contents/Resources/app/node_modules/appium/node_modules/appium-webdriveragent/

If you navigate there by Finder, make a context click (right click or Ctrl + click) on the application and choose Show Package Contents from the menu. Replace all files that are already present with the same name.

Install Appium using npm[Bearbeiten]

You can install Appium using npm (Node Package Manager) as well. To do this, you have to install node/npm first. This can be done using nvm (Node Version Manager), which you can get on Github. If the following installation instructions should not work for you, you will find detailed information in the Readme there.

Open a Terminal window. Then clone the Github repository of nvm

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.2/install.sh | bash

and load it

export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")" [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm

Then execute

command -v nvm

to see if it works. It should print nvm. If there is no response, execute

touch ~/.zshrc

and try again.

Now you can install node with the following command.

nvm install 16.15.1

As there are problems installing Appium using the newest version of node, we recommend this version.

After node is installed, you can use it to install Appium:

npm install -g appium

The Appium server now simply can be started with the command

appium

The output will then be written directly to the terminal.

This version also has problems with signing the WebDriverAgent, like explained in Appium Desktop. Therefore download a newer version of WebDriverAgent in this case as well and replace the old files. You will find them at

/Users/<user>/.nvm/versions/16.15.1/lib/appium/node_modules/appium-webdriveragent/

Mobile Testing Supplement[Bearbeiten]

We provide older versions of Appium via the Mobile Testing Supplement for Mac OS, with which you can easily install it:

Contains Appium version 1.18.3 and uses node 14.
Only a few changes compared to the previous version.
Appium is updated to version 1.16.0-rc.1 and node 12 is used.
This version contains Appium 1.12.0.
This version contains Appium 1.8.0.
This version contains Appium 1.6.4.
Diese Version entält Appium 1.4.16.

After you have downloaded the supplement, you can move it to a directory of your choice (e.g. your home directory) and unpack it there. A suitable command in a shell could look like this, adjust the version number accordingly:

tar -xvpf Mobile_Testing_Supplement_for_Mac_OS_1.1.98.tar.bz2

If your default Xcode installation is the one you want to use, you can start Appium directly from the file in the bin directory with the appropriate version number:

Mobile_Testing_Supplement/bin/start-appium-1.16.0-rc.1

If you want to use another Xcode than the one configured as default, you have to tell Appium the corresponding path by using the environment variable DEVELOPER_DIR. For example, if you have installed Xcode in /Applications/Xcode-11.3.app, you can start Appium this way:

DEVELOPER_DIR="/Applications/Xcode-11.3.app/Contents/Developer" Mobile_Testing_Supplement/bin/start-appium-1.16.0-rc.1

To find out what is set as the default Xcode installation on your system, use this command:

xcode-select -p

If Appium cannot find your Xcode installation, a message like this appears:

org.openqa.selenium.SessionNotCreatedException - A new session could not be created. (Original error: Could not find path to Xcode, environment variable DEVELOPER_DIR set to: /Applications/Xcode.app but no Xcode found)

In such a case, restart Appium by specifying a valid DEVELOPER_DIR.

Signing WebDriverAgent[Bearbeiten]

For automation, Appium installs an App called WebDriverAgent on the device and therefore has to be able to sign it. You need an Apple account and a respective certificate for this. For evaluation you can use a free account. This has the disadvantage that created profiles are only valid for one week and must be recreated afterwards. Also be careful when sharing the account, as certificates may be revoked or invalidated by automatic generation. As a result, apps that have already been signed can no longer be used.

If you already have a respective certificate and its associated private key in your keychain on the Mac, you can have the WebDriverAgent automatically signed. If not, it is recommended to set and manage the signing using Xcode.

First, connect the device you want to use to your Mac via USB. Make sure both the Mac and the device are in the same network or there will be problems when connection with Appium. Start Xcode and open Preferences. Go to the Accounts page and create an entry with your account. You can then click on Manage Certificates... to see the certificates that belong to that account. To run tests, you need an iOS Development Certificate and the associated private key. If you do not already have one, create one. If you already have one, but it is not in your keychain (indicated by "Not in Keychain"), you can import it. You can do that by the keychain access on your Mac, if you have exported it previously from the keychain, where it is stored. The certificate with the associated key should be in the keychain Login. It can be exported from there as PKCS#12 file (typical ending .p12). To import a certificate into your keychain, select the option Import objects from the File menu. If you don't know where the certificate is stored, you can also revoke it in Xcode and recreate it in your keychain. However, only do this if you know that the old certificate is no longer in use because it can no longer be used afterwards. Now the keychain should contain an iOS development certificate.

Now open the WebDriverAgent project in Xcode. If you have installed the Mobile Testing Supplement, you will find it in this directory at

Mobile_Testing_Supplement/lib/node_modules/appium-1.16.0-rc.1/node_modules/appium-xcuitest-driver/WebDriverAgent/WebDriverAgent.xcodeproj

If you have installed Appium Desktop, you will find it at

/Applications/Appium\ Server\ GUI.app/Contents/Resources/app/node_modules/appium/node_modules/appium-webdriveragent/WebDriverAgent.xcodeproj

You can use the Finder to navigate to the Xcode project file and open it by double clicking. Note, that you have to perform a context click (right click or Ctrl + click) on the Appium Server GUI app and select Show Package Contents in the menu, to get to its subdirectory.

MobileTestingWebDriverAgentXcode.png

Select WebDriverAgentLib and the page Signing & Capabilities. In the section Signing set the option Automatically manage signing and then select a team. Now switch to WebDriverAgentRunner and do the same there. By setting the team, the errors showing up for WebDriverAgentRunner should disappear. If Xcode should not be able to create a Provisioning Profile matching the Bundle ID com.facebook.WebDriverAgentRunner, you can edit the latter so that it fits your certificate. After that you can quit Xcode or you can, like explained further below, directly start the build in Xcode, so the project will be already built when Appium wants to use it.

If you now connect to your device from expecco, the WebDriverAgent will be installed and started on it and then switch to the app to be tested. You may still have to trust the execution of the WebDriverAgent on the device. It maybe a sign that you have to do this, if the app WebDriverAgent first appears on the device and tries to start, but then is uninstalled again. To trust the execution, open the settings during the connection setup on the device and then the entry Device management under General. This entry is only visible if a developer app is installed on the device. You may therefore have to wait until the WebDriverAgent is installed before the entry appears. Select the entry of your Apple account and trust it. Since the WebDriverAgent will be uninstalled again if the start did not work, you have to do this during the connection setup. If this is too hectic for you, you can also execute the following code:

xcodebuild -project Mobile_Testing_Supplement/lib/node_modules/appium-1.16.0-rc.1/node_modules/appium-xcuitest-driver/WebDriverAgent/WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination 'id=<udid>' test

or

xcodebuild -project /Applications/Appium\ Server\ GUI.app/Contents/Resources/app/node_modules/appium/node_modules/appium-webdriveragent/WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination 'id=<udid>' test

This installs the WebDriverAgent on the device without deleting it again.

If there are problems while installing the WebDriverAgent, you can also try and start the build in Xcode. Make sure the right target WebDriverAgent is selected. Error messages in Xcode might indicate easier what the problem is about. Sometimes it even helps to try for a second time, if it took too long for the first time and got aborted. It may occur, that you are asked several times during the build to enter the password for the keychain.

WebDriverAgentCodesign.png

Read also the documentation of Appium on Setting up tests with iOS devices. Refer to the Apple documentation for details on installing and trusting of apps.

Once the WebDriverAgent is installed on the device, it will be reused for later connections und connecting should work faster. The signed version is then already on your Mac as well and doesn't have to be built again. This should speed up the connect with other devices as well. If you know, that the connect has to build and sign the WebDriverAgent first, it is advisable to set the capability wdaLaunchTimeout. This timeout specifies how long Appium waits for the WebDriverAgents to start up on the device and is per default set to 60000 ms. Building often takes a little longer than one minute, so the connect attempt will be canceled. A value of 120000 will be more reliable here.

Plugin Configuration[Bearbeiten]

Before you start, please check the settings of the Mobile Testing Plugin and adjust them if necessary. Select the menu item "Extras" → "Settings" → "Extensions" → "Mobile Testing" (see fig.). By default, these paths are found automatically (1). To adjust a path manually, deactivate the corresponding check mark at the right. You'll see a drop-down list with some paths to choose from. If an entered path is wrong or cannot be found, the field is marked red and a message appears. Make sure that all paths are specified correctly.

Plugin Configuration
  • appium: Enter the path to the executable file with which Appium can be started in the command line. Under Windows this file will usually be called "appium.cmd". This path is used when expecco starts an Appium server.
  • node: Enter the path to the executable that starts Node (also called (also called "Node.js"). This path is passed to Appium when a server is started so that Appium can find it independently of the PATH variable. Under Windows this file is usually called "node.exe".
  • JAVA_HOME: Enter the path to a JDK (Java Development Kit)here. This path is passed to each Appium server. Leave the field blank to use the value from the environment variable. To specify which Java should be used by expecco, set this path in the Java Bridge settings.
  • ANDROID_HOME: Enter the path to an Android SDK here. This path is passed to each Appium server. Leave the field blank to use the value from the environment variable.
  • adb: The path to the adb command. Under Windows the file is called "adb.exe". This file is used by expecco, for example, to get the list of connected devices. This path should be selected automatically, if the command is found in the ANDROID_HOME directory. This is also used by Appium. If expecco and Appium use different versions of adb, conflicts may occur.
  • android.bat: This file is only needed to start the AVD and the SDK Manager, which deal with phone emulators. The file in the ANDROID_HOME directory will be selected automatically, if present there.
  • aapt: The path to the "aapt" command here. Under Windows this file is called "aapt.exe". expecco uses "aapt" only in the connection editor to read the package and activities of an "apk" file. The file in the ANDROID_HOME directory will be selected automatically, if present there.
JDK Configuration

Starting with expecco 2.11, there is an additional field called Team ID. If you run iOS tests, enter the Team ID of your certificate here. This is used for every iOS connection, unless you change the value in the connection settings in individual cases. For information on how to obtain the team ID, please refer to the section on signing for installations on Mac OS. With expecco 2.10 and older, you can only enter the Team ID as capability for each connection setting separately. However, you must use the extended view to do this. Enter the capability xcodeOrgId here and set the Team ID of the certificate as value.

The server address setting at the bottom of the page refers to the behavior of the connection editor. It checks at the end whether the server address ends in /wd/hub as this is the usual form. If not, a dialog asks how to react. The defined behavior can be viewed and changed here.

Also switch to the entry Java Bridge (see figure). Here you have to specify the path to your Java installation, which is used by expecco. Enter a JDK here. If you want to use the one from the Mobile Testing Supplement under Windows, the path is

C:\Program Files (x86)\exept\Mobile Testing Supplement\jdk

You can also use the system settings.

Prepare Android Device[Bearbeiten]

If you connect an Android device under Windows, you may still need an adb driver for the device. You can usually find a suitable driver on the manufacturer's website. If you have installed the universal driver from the Mobile Testing Supplement, everything should already work for most devices. In some cases, Windows will automatically try to install a driver when you connect the device for the first time.
Attention: Before you can control a mobile device with the Appium plugin, you have to allow this debugging!

For Android devices, you can find this option in the settings under Developer Options called USB-Debugging. If the developer options are not displayed, you can unlock them by tapping Build Number seven times in About the Phone.

Also enable the Stay awake feature to prevent the device from turning off the screen during test creation or execution.

For security reasons, USB debugging must be allowed for each computer individually. When connecting the device to the PC via USB, you must agree to the connection on the device. If you haven't done this for your computer yet, but no corresponding dialog appears on the device, it may help to unplug and reconnect the device. This can happen especially if you have installed the ADB driver while the device was already connected via USB. If this doesn't help either, open the notifications by dragging them from the top of the screen. There you will find the USB connection and you can open the options. Select another type of connection; usually MTP or PTP should work.

You can also test on an emulator. It does not need to be prepared separately, as it is already designed for USB debugging. It is even possible to start an emulator at the beginning of the test.

To check if a device you have connected to your computer can be used, open the connection editor. The device should be displayed there.

Connection via WLAN[Bearbeiten]

It is possible to connect to Android devices via Wireless LAN. For devices using Android 11 or newer, this can be done wirelessly, else you have to connect initially via USB. Since expecco 22.1, WiFi connections can be established using the Connection Editor. It is also possible to do this using a command window.

Wireless Connect (Android 11)[Bearbeiten]

In the developer options of your device, enable wireless debugging and open its options. You initially have to pair your machine with the device. To do this, choose "Pair device with pairing code" to get a pairing code and an IP address with port. Then open a command window (terminal window) on your machine and enter:

adb pair <Device IP Address>:<Pairing Port>

where <Device IP Address>:<Pairing Port> is the IP address and port as shown on the device. After that, you will be asked for the pairing code. If everything went right, the popup on the device should have closed and your machine is added to the list of paired devices. Then enter at the command window:

adb connect <Device IP Address>:<Debugging Port>

The IP address is the same as for pairing, but the port is different. Both are shown as IP address & Port on the device. The device should now be connected via WLAN and can be used in the same way as with a USB connection. You can check this by entering adb devices -l or open the connection dialog in expecco. In the list, the device appears with its IP address and port. Remember that the WLAN connection no longer exists when the ADB server or the device is restarted. Restarting the device often disables wireless debugging and the used port is changed. The pairing, however, is permanent and has not to be done again the next time you connect.

Start via USB[Bearbeiten]

First, connect your device via USB. Then open a command window (terminal window) and enter:

adb tcpip 5555

The device listens for a TCP/IP connection on port 5555. If you have several devices connected or emulators running, you have to specify which device you mean. Enter in this case:

adb devices -l

to get a list of all devices, where the first column gives the device's ID. Then, enter:

adb -s <deviceID> tcpip 5555

with the device identification of the desired device. You can now disconnect the USB connection.
Now you have to find out the IP address of your device. You can usually find it somewhere in the device's settings, for example in the Status or WLAN settings of the phone. Then type in:

adb connect <IP address of device>

The device should now be connected via WLAN and can be used in the same way as with a USB connection. You can check this by entering adb devices -l again or open the connection dialog in expecco. In the list, the device appears with its IP address and port. Remember that the WLAN connection no longer exists when the ADB server or the device is restarted.

Preparing an iOS-Device and App[Bearbeiten]

Control of iOS devices is only possible via a Mac. Please also read the section Installation under Mac OS.

Before you can control a mobile device with the Mobile Testing Plugin, you must allow debugging for iOS devices with iOS 8 or higher. Activate the option "Enable UI Automation" under the "Developer" menu in the device settings.
If you cannot find the "Developer" entry in the settings, proceed as follows: Connect the device to the Mac via USB. If necessary, you must still agree to the connection on the device. Start Xcode and then select "Devices" from the menu bar at the top of the screen in the "Window" menu. A window opens in which a list of the connected devices is displayed. Select your device there. Then the entry "Developer" should appear in the settings on the device. You may have to exit the settings and restart.

Alert unter iOS

It is not possible to establish a connection to the device as long as it shows certain alerts. Such an alert may appear if FaceTime is activated (by displaying a message about SMS charges as shown in the screenshot). Be sure to configure the device so that it does not show such alerts when idle.

expecco 2.11 and later[Bearbeiten]

You can test any app which is executable or already installed on the device used. If the app is available as a development build, the UDID of the device must be stored in the app. In any case, the WebDriverAgent must be signed for the device. Please read the section about signing under Mac OS.

If you want to use the Home button in a test, you must activate "AssistiveTouch" on the device. You will find this option in the settings under "General" > "Operating Help" > "AssistiveTouch". Then place the menu in the middle of the upper edge of the screen. You can then record pressing the Home button with the corresponding menu entry in the recorder or use the "Press Home Button" block directly.

expecco 2.10[Bearbeiten]

The app you want to use must be available as a development build. The UDID of the device must also be stored in the app.

Sign the development build[Bearbeiten]

A development build of an app is only allowed for a limited number of devices and cannot be started on other devices. However, it is possible to exchange the certificate and the usable devices in a development build.

  • Evaluation with demo app of eXept:
We will be happy to provide you with a demo app which is available as a development build and which we can sign for your device. Please send the UDID of your device to your eXept contact person. How to determine the UDID of your device is described in the following section.
  • Using your own app for your test device:
If you receive a development build (IPA file) from the app developers that is approved for your test device, you can use it directly. To do this, you must tell the developers the UDID of your device so they can enter it. You can use Xcode to read the UDID of a device. Start Xcode and select Devices from the menu bar at the top of the screen in the Window menu. A window opens in which a list of the connected devices is displayed. Select your device and search for the Identifier entry in Properties. The UDID is a 40-digit hexadecimal number.
  • Externally developed app for your test device:
You can also re-sign apps to make them run on other devices. However, this process is complicated and requires access to an Apple Developer account. A documentation on the procedure is currently in preparation.
For the evaluation we will gladly support you with the re-signing of your app..

For more information about using iOS devices, see also the Appium documentation.

Native iOS-Apps[Bearbeiten]

You can also use apps that are already natively present on the device. To do this, you must know their bundle ID and then enter it in the connection settings. Here is a small selection of common apps:

App Bundle-ID
App Store com.apple.AppStore
Calculator com.apple.calculator
Calendar com.apple.mobilecal
Camera com.apple.camera
Contacts com.apple.MobileAddressBook
iTunes Store com.apple.MobileStore
Mail com.apple.mobilemail
Maps com.apple.Maps
Messages com.apple.MobileSMS
Phone com.apple.mobilephone
Photos com.apple.mobileslideshow
Settings com.apple.Preferences

You can find further Bundle-IDs here.

Examples[Bearbeiten]

In the demo test suites for expecco you will also find examples for tests with the Mobile Testing Plugin. To do this, select the option "Example from File" on the start screen and open the folder named "mobile".

m01_MobileTestingDemo.ets[Bearbeiten]

The test suite contains two simple test plans: "Simple CalculatorTest" and "Complex Calculator and Messaging Test". Both tests use an Android emulator, which you must start before starting. The apps used in the test are part of the basic equipment of the emulator and therefore no longer need to be installed. Since the apps may differ under every Android version, it is important that your emulator runs under Android 6.0. In addition, the language must be set to English.

Simple CalculatorTest
This test connects to the calculator and enters the formula 2+3. The result of the calculator is compared with the expected value 5.
Complex Calculator and Messaging Test
This test connects to the calculator and then opens the message service. There it waits for an incoming message from the number 15555215556, in which a formula to be calculated is sent. The message is generated before via a socket at the emulator. When the message arrives, it is opened by the test and its contents are read. Then the calculator is opened again, the received formula is entered and the result is read. The test then switches back to the message service and sends the result as an answer.

m02_expeccoMobileDemo.ets und m03_expeccoMobileDemoIOS.ets[Bearbeiten]

These are part of the tutorial for the Mobile Testing Plugin. The included test case is incomplete and will be added during the tutorial. Please read the section Tutorial.

Tutorial[Bearbeiten]

There is a tutorial describing the basic procedure for creating tests with the Mobile Testing Plugin. It is based on a supplied example consisting of a simple app and an expecco test suite.

You find it on the page Mobile Testing Tutorial in two versions for Android and iOS devices.

Dialogs of the Mobile Testing Plugin[Bearbeiten]

Connection Editor[Bearbeiten]

You can use the Connection Editor to quickly define, change, or establish connections. Depending on the task, the dialog has small differences and is opened differently:

  • If you want to establish a connection, access the dialog in the GUI browser by clicking on Connect and then selecting Mobile Testing.
  • To change or copy an existing connection in the GUI browser, select it, right-click and select Edit Connection or Copy Connection from the context menu.
  • If you do not want to create connection settings for the GUI browser but for use in a test, choose Create Connection Settings from the Mobile Testing Plugin menu.... This only allows you to create the settings for a connection without creating a connection in the GUI browser.

The Connection Editor menu has several buttons, some of which are only visible when creating connection settings: MobileTestingVerbindungseditorMenu.png

  1. Delete Settings: Resets all entries. (Only visible when creating settings.)
  2. Load settings from file: Allows to open a saved settings file (*.csf). Its settings are transferred to the dialog. Entries already made without conflict are retained.
  3. Load settings from attachment: Allows you to open an attachment with connection settings from an open project. These settings are applied to the dialog. Entries already made without conflict are retained.
  4. Save settings to file and
  5. Save settings to attachment: Here you can save the entered settings to a file (*.csf) or create them as an attachment in an open project. Both options have a delayed menu in which you can choose to save only a certain part of the settings. (Only visible when creating settings.)
  6. Advanced View: Allows you to switch to the advanced view to make additional settings. Read more about this at the end of this chapter. (Only visible when creating settings.)
  7. Help: A help text for the respective step is shown or hidden on the right side.


The dialog is divided into three steps. In the first step you select the device you want to use, in the second step you select which App should be used and in the last step the settings for the Appium server are made.

Step 1: Select Device[Bearbeiten]

In the upper part you will see a list of all connected Appium devices that are detected. With the checkbox below you can hide devices that are detected but not ready. If you want to enter a device that is not connected, you can create it with the corresponding button Enter Android device or Enter iOS device. However, you need to know the required properties of your device. The device is then created in a second device list and can be selected there. If no list with connected elements can be displayed, various messages are displayed instead:

  • No devices found
    expecco could not find any Android devices.
    To automatically configure a connection to a device, make sure
    • it is connected
    • it is turned on
    • that it has an appropriate adb driver installed
    • it is enabled for debugging (see below).
  • No available devices found
    expecco could not find any available Android devices. But not available ones were found, e.g. with the status "unauthorized".
    To configure a connection to a device automatically, make sure that
    • it is connected
    • it is turned on
    • that it has an appropriate adb driver installed
    • it is enabled for debugging (see below).
    To view unavailable devices, enable this option below.
  • Connection lost
    expecco has lost the connection to the adb server. Try to re-establish the connection by clicking on the button.
  • Connection failed
    expecco could not connect to the adb server. Possibly it is not running or the specified path is not correct.
    Check the adb configuration in the settings and try to start the adb server and establish a connection by clicking on the button.
  • Connect ...
    expecco connects to the adb server. This may take a few seconds.
  • Start adb-Server ...
    expecco starts the adb-Server. This may take a few seconds.

With Next you get to the next step. If you enter settings for the GUI browser, this is only possible once a device has been selected.

Note on unlocking: In newer Android versions the developer options are no longer offered in the settings at first. If your Android device does not show an entry for "Developer options" in the settings, first select the entry "Phone info", then "SoftwareVersionsInfo" and click on the entry "BuildVersion" several times.

Manage Chromedrivers[Bearbeiten]

If the App you want to automate uses WebViews with Chrome, Appium needs to have access to an appropriate Chromedriver. If you have selected a device in the list, you can use "Manage Chromedrivers" to see, which Chrome versions are installed on the device and which Chromedriver versions are provided by expecco. With this dialog you can also download required Chromedriver versions. Beware that there may be several Chrome versions on the device. An App doesn't have to use the version of the installed Chrome browser for its WebViews. The Chromedriver you use should fit your app for everything to work properly. You can also change the path to the Chromedriver in the capabilities generated at the end of the connection editor.

Connect WiFi Android Device[Bearbeiten]

You can connect to Android devices using WiFi as well. In this case, the device has to be connected to ADB first, see Connection via WLAN. Since expecco 22.1, the connection editor provides a dialog helping to set this up, which can be used instead of the command window. For devices using Android 11 or newer, you can pair the device with your machine here by specifying the appropriate parameters and then establish the connection by specifying the IP address and port. You can also use this to establish a wireless connection for devices that are connected via USB. When you select the corresponding device in the list, the required information is read out automatically.

Note that establishing a wireless connection is not part of the connection settings. If you want to establish a new connection with the generated settings, you must make sure that the device is connected to ADB with the specified IP address and port so that it can be found. The ADB connection will be lost if the ADB server or the device are restarted. The permission for wireless debugging is also often reset when the device is restarted and the debug port can then change. Therefore, a wireless connection must always be established manually.

Step 2: Select App[Bearbeiten]

Here you can enter information about the app to be tested. You can decide if you want to use an app that is already installed on the device or if you want to install an app for the test. Select the appropriate tab above. Depending on whether you selected an Android or an iOS device in the previous step, the required input will change.

  • Android
    • App on Device
      If you have selected a connected device in the first step, the packages of all installed apps are automatically retrieved and you can select from the drop-down lists. The installed apps are divided into third-party packages and system packages; select the appropriate package list. This selection does not belong to the settings, but only provides the corresponding package list. You can use the filter to further narrow down the list and then select the desired package. The activities of the selected package are also automatically retrieved and made available as a drop-down list. Select the activity you want to start. As a rule, an activity is automatically entered from the list. If you are not using a connected device, you must enter the package and the activity manually.
    • Install App
      Under App, enter the path to an app. The path must be valid for the Appium server being used. You can also specify a URL. If you are using a local Appium server, you can use the right button to navigate to the App installation file and enter this path. If possible, the corresponding package and the activity are also entered in the fields below. However, this entry is not necessary.
  • iOS
    • App on Device
      Specify the bundle ID of an installed app. You can find out the IDs of the installed apps using Xcode, for example. Start Xcode and select Devices from the menu bar at the top of the screen in the Window menu. A window will open displaying a list of connected devices. If you select your device, you will see a list of the apps you have installed in the overview.
    • Install App
      Under App, enter the path to an app. The path must be valid for the Appium server being used. You can also specify a URL. For the requirements of apps for real devices, please read the section Preparing an iOS-Device and App.

In the lower part you can specify whether the app should be reset or uninstalled when the connection is terminated, and whether it should be reset initially. Again, the corresponding capability is not set if you select (Default). With Next you get to the next step.

Step 3: Server Settings[Bearbeiten]

In the last step, a list of all the capabilities that result from your entries in the previous steps is first displayed in the upper part. If you are familiar with Appium and want to set additional capabilities that are not covered by the connection editor, you can click on Edit to open the extended view. See the section below for more information.

If you enter settings for the GUI browser, you can enter the Connection name with which the connection is displayed. This is also the name under which devices can use this connection when it is established. If you leave the field blank, a name will be generated. If the box "Managed by expecco" is checked, expecco will start a local Appium server on a free port, or use a free server that has already been started. To use your own server, turn this feature off and enter the appropriate address. You will get the local default address and already used addresses to choose from.

In older expecco versions the box is labeled "Start on demand". In this case, you must also enter an address if you want expecco to start the server. expecco then tries to start an Appium server at the given address when connecting, if none is running there yet. This server will then also be shut down when the connection is terminated. This only works for local addresses. Make sure that you only use port numbers that are free. It is best to only use odd port numbers from the standard port 4723. The following port number is also used when establishing a connection, which could otherwise lead to conflicts.

Depending on how you opened the dialog, there are now different buttons to close it. In any case you have the option to save. This opens a dialog where you can either select an open project to save the settings there as an attachment, or choose to save it to a file that you can then specify. Saving does not close the dialog, allowing you to select another option.

If you have opened the editor for establishing a connection, you can finally click on Connect or Start and connect server, depending on whether the check mark for server start is set. For changing or copying a connection in the GUI Browser, this option is called Apply, since in this case only the connection entry is changed or created, but the connection setup is not started. If necessary, you can do this afterwards via the context menu. If you have changed capabilities of an existing connection, a dialog then prompts you to decide whether these changes should be applied directly by closing the connection and establishing the new connection or not. In this case, the changes only take effect after you reestablish the connection.

To use the connection editor, also read the corresponding section in the respective tutorial in step 1. (Android: Run Demo, iOS: Run Demo).

Extended View[Bearbeiten]

The extended view of the connection editor can be obtained either by clicking on Edit in the third step or at any time via the corresponding menu item if you have started the editor via the plugin menu. This view displays a list of all configured Appium Capabilities. You can add, change or remove further entries to this list. To add a capability, select it from the drop-down list of the input field. In this list all known capabilities are sorted into the categories Common, Android and iOS. If you have selected a capability, a short information text is displayed. You can also enter a capability manually in the field. Then click on Add to add the capability to the list. There you can set the value in the right column. To delete an entry, select it and click on Remove. With Back you leave the extended view.

MobileTestingErweiterteAnsicht.png

Running Appium Servers[Bearbeiten]

In the menu of the Mobile Testing Plugin you will find the entry Appium-Server.... This opens a window with an overview of all Appium servers started by expecco and on which port they are running. By clicking on the icon in the column Show Log you can view the logfile of the corresponding server. This is deleted when the server is shut down. With the icons in the column Exit the corresponding server can be terminated. However, this is prevented if expecco still has an open connection via this server. The rightmost column shows for which connection the server is in use. If it reads <idle>, the server is currently not used by expecco.

MobileTestingAppiumServer.png

When opening the editor to start an Appium connection, an Appium server is started immediately to speed up the connection process. For this purpose, expecco always keeps one idle running Appium server. Additional running servers however, which are not in use anymore, will be terminated automatically after a while.

In the menu of the Mobile Testing Plugin you will also find the entry Close all Connections and Servers. This is intended for cases where connections or servers cannot be terminated in any other way. If possible, always terminate connections in the GUI browser or by executing a corresponding block. Servers that you have started in the server overview should be terminated there; servers that were started with a connection are automatically terminated with this connection.

Note that only servers started and managed by expecco are listed in the overview. Possible other Appium servers that were started in a different way are not recognized.

Recorder[Bearbeiten]

If the GUI browser is connected to a device, the integrated recorder can be used to record a test section with that device. To start the recorder, select the appropriate connection in the GUI browser and click the Record button. A new window opens for the recorder. The recorded actions are created in the GUI browser work area. It is therefore possible to edit the recorded data in parallel.

MobileTestingRecorder.png

Components of the Recorder Window[Bearbeiten]

  1. Continue/Pause Recording: You can pause the recording by clicking the right icon. You will then see a large pause sign in the view. All actions that you perform now in the recorder are executed, but no blocks are recorded. You can switch back to normal recording mode by clicking the left icon.
  2. Stop Recording: Stops the recording and closes the recorder window.
  3. Update: Gets the current image and element tree from the device. This is necessary if the device takes longer to execute an action or if something changes without being triggered by the recorder. Since expecco 21.2, there is an additional submenu here that can be used to enable automatic update by checking for changes in the background (see also Automatic Update further below).
  4. Follow Mouse: Select the element under the mouse pointer in the GUI browser.
  5. Element Highlighting: The element under the mouse is outlined in red.
  6. Show Elements: Show the borders of all elements in the view.
  7. Tools: Selection, which tool is used for recording. The selected action is triggered with each click on the view. The following actions are available:
    • Element Actions:
      • Click: Short click on the element under cursor. To determine more precisely which element is used, use the Follow Mouse or Element Highlighting function.
      • Tap with Duration (Element): Similar to click, except that the duration of the click will be recorded as well. This allows the recording of long clicks.
      • Tap with Position (Element): Similar to click, but additionally records the position inside the element. The position can be recorded relative to the element size or, when pressing Ctrl while clicking, as absolute position from the upper left corner of the element.
      • Set Text: Allows to set the text of an input field.
      • Clear Text: Clears the text of an input field.
    • Device Actions:
      • Tap (Screen): Triggers a click at the screen position.
      • Tap with Duration (Screen): Triggers a click at the screen position, which also considers the duration.
      • Swipe: Swipe in a straight line from the point where you press the mouse button until you release it. The duration is also recorded.
    Please note for this actions that the result may differ on different devices, e.g. with different screen resolutions.
    • Test Flow Blocks
      • Check Attribute: Compares the value of a specified attribute of the element with a predefined value. The result triggers the corresponding output.
      • Assert Attribut: Compares the value of a specified attribute of the element with a predefined value. If the values are not equal, the test fails.
      • Get Attribute: Gets the current value of a specified attribute of the element.
    • Auto
    If the Auto tool is selected, you can use all actions by specific input methods: Click, Tap Element and Swipe still work by clicking, but are distinguished by the duration and movement of the cursor. To trigger a Tap, hold down Ctrl while clicking. The remaining actions are available in a context menu by right-clicking on the element.
  8. Context Actions: Here you can record actions concerning contexts:
    • Switch to Context: Shows a list of all currently available contexts and you can select to which one you want to switch.
    • Get Current Context: Gets the handle of the current context.
    • Get Context Handles: Gets a list of all currently available contexts.
  9. Softkeys: Only for Android. Simulates pressing the buttons Back, Home, Menu and Power.
  10. Home Button: Only for iOS since expecco 2.11. Allows pressing the Home button.Prior to expecco 19.2, it only works if AssistiveTouch is activated and the menu is located in the middle of the upper screen border. From expecco 19.2 on, the function no longer uses AssistiveTouch.
  11. Help: Opens this online documentation on the general page about GUI Browser recorders.
  12. View: Shows a screenshot of the device. Actions are triggerd by mouse depending on the selected tool. If a new action can be recorded, the window has a green frame, else it is red.
  13. Resize Window to Image: Resizes the recorder window so that the screenshot can be displayed completely.
  14. Resize Image to Window: Scales the screenshot to a size that makes use of the full size of the window.
  15. Adjust Display: Opens a dialog to adjust the displayed image, if expecco does not show it right. You can correct the scaling or rotate the image by 90°.
  16. Correct Orientation: Corrects the image if it is upside down. Using the arrow to the right, the image can also be rotated by 90°, if this should ever be necessary. Since expecco 19.1 you find this functionality under Adjust Display. The orientation of the image is irrelevant for the functionality of the recorder, it only works on the elements it receives.
  17. Scaling: Changes the scaling of the screenshots.
  18. Messages: Shows the path of the current selected element or other messages. It has a context menu to show a list of previous messages.

Usage[Bearbeiten]

Each click in the window triggers an action and is recorded in the workspace of the GUI browser. There you can run, edit, or create a new block from what you have recorded. You find the actions to trigger softkeys directly in the menu bar (see above). To record actions on elements, either change the selection of the tool in the menu bar (see above) and then click on the element or select the corresponding action from the context menu by right-clicking on the corresponding element. For text input it is also possible to place the cursor over the element and enter the text. This opens the input dialog for this action. On how to use the recorder, see also step 2 in the tutorial (Android resp. iOS).

Hide elements[Bearbeiten]

Since expecco 21.2 it is also possible to hide the selected element in the recorder from the context menu. This means that this element cannot be selected from now on. This function is useful for ignoring elements that are in the foreground to be able to access elements below them. To undo this state, you have to find the corresponding element in the tree of the GUI browser, which also has such an entry in the context menu.

Automatic Update[Bearbeiten]

The recorder doesn't show a live image of the device, but only a snapshot. Therefore an update is needed after changes to match what is displayed on the device. The recorder updates automatically after executing an action. Since expecco 20.2 there are further automatic updates possible. You can enable the, in the menu "View".

One option is, to check after an action has been executed, if there are further changes after the first update. If so, a second update is triggered. This shall fix the problem, that the recorder is not up to date after an action, because the update has been done too early.

The second option is to enable a periodical update. After a set interval the recorder is automatically updated if there are changes. Thereby the recorder view is mostly up to date, but this causes an overhead regarding the communication to the device.

AVD Manager und SDK Manager[Bearbeiten]

AVD Manager und SDK Manager sind beides Anwendungen von Android. Im Menü des Mobile Testing Plugins bietet expecco die Möglichkeit, diese zu starten. Ansonsten finden Sie diese Programme bei Ihrer Android-Installation. Mit dem AVD Manager können Sie AVDs, also Konfigurationen für Emulatoren, erstellen, bearbeiten und starten. Mit dem SDK Manager erhalten Sie einen Überblick über Ihre Android-Installation und können diese bei Bedarf erweitern.

Hybrid Apps and WebViews[Bearbeiten]

!!! IMPORTANT NOTICE - If you have problems switching to the webview, please set the "Default Application - Browser App" in Android Settings to "Chrome" !!!

Hybrid apps contain platform native elements as well as other elements that are integrated in a WebView. These elements can also be used, but you first have to switch to the corresponding context. With the block Get Current Context you get the current context. Initially this is NATIVE_APP, i.e. the context of the native elements. With the block Get Context Handles you get a collection of all existing contexts. If there is a WebView context, it is called WEBVIEW_1 or WEBVIEW_<package> with the package of the WebView. Several WebView contexts are also possible. For each WebView context, there is a corresponding WebView element in the native context. You can use the Switch to Context block to switch to such a context and from now on only have access to the elements in this context.

In the GUI browser, the existing contexts are displayed at the top of the tree as well as the tree of a context is inserted below the corresponding WebView element.

Customizing XPath using the GUI Browser[Bearbeiten]

Bausteine, die auf einem Gerät fehlerfrei funktionieren, tun dies auf anderen Geräten möglicherweise nicht. Auch können kleine Änderungen der App dazu führen, dass ein Baustein nicht mehr den gewünschten Effekt hat. Man sollte einen Baustein daher so robust formulieren, dass er für eine Vielzahl von Geräten verwendet werden kann und kleine Anpassungen an der App verkraftet. Dazu muss man das grundlegende Funktionsprinzip der Adressierung verstehen. Dies wird im Folgenden am Beispiel der App aus dem Tutorial erläutert.

Die Ansicht der App setzt sich aus einzelnen Elementen zusammen. Dazu gehören die Schaltflächen GTIN-13 (EAN-13) und Verify, das Eingabefeld der Zahl 4006381333986 und das Ergebnisfeld, in dem OK erscheint, wie auch alle anderen auf der Anzeige sichtbaren Dinge. Diese sichtbaren Elemente sind in unsichtbare Strukturelemente eingebettet. Alle Elemente zusammen sind in einer zusammenhängenden Hierarchie, dem Elementbaum, organisiert.

Abb. 1: Funktionen des GUI-Browsers


Sie können sich diesen Baum im GUI-Browser ansehen. Wechseln Sie dazu in den GUI-Browser (Abb. 1) und starten Sie eine beliebige Verbindung. Sobald die Verbindung aufgebaut ist, können Sie den gesamten Baum aufklappen (1) (Klick bei gedrückter Strg-Taste). Er enthält alle Elemente der aktuellen Seite der App.

Ein Baustein, der nun ein bestimmtes Element verwendet, muss dieses eindeutig angeben, indem er dessen Position im Elementbaum mit einem Pfad im XPath-Format beschreibt. Dieses Format ist ein verbreiteter Web-Standard für XML-Dokumente und -Datenbanken, eignet sich aber genauso für Pfade im Elementbaum.

Wenn Sie ein Element im Baum auswählen, wird unten der von expecco automatisch generierte XPath (2) für das Element angezeigt, der auch beim Aufzeichnen verwendet wird. Oberhalb davon in der Mitte des Fensters befindet sich eine Liste der Eigenschaften (3) des ausgewählten Elements. Man nennt diese Eigenschaften auch Attribute. Sie beschreiben das Element näher wie beispielsweise seinen Typ, seinen Text oder andere Informationen zu seinem Zustand. Links unten können Sie zur besseren Orientierung im Baum die Vorschau (4) aktivieren, um sich den Bildausschnitt des Elements anzeigen zu lassen.

Der Elementbaum für gleiche Ansicht einer App kann sich je nach Gerät unterscheiden. Es sind diese Unterschiede, die verhindern, eine Aufnahme von einem Gerät unverändert auch auf allen anderen Geräten abzuspielen: Ein XPath, der im einen Elementbaum ein bestimmtes Element identifiziert, beschreibt nicht unbedingt das gleiche Element im Elementbaum auf einem anderen Gerät. Es kann stattdessen passieren, dass der XPath auf kein Element, auf ein falsches Element oder auf mehrere Elemente passt. Dann schlägt der Test fehl oder er verhält sich unerwartet.

Man könnte natürlich für jedes Gerät einen eigenen Testfall schreiben. Das brächte aber unverhältnismäßigen Aufwand bei Testerstellung und -wartung mit sich. Das Problem lässt sich auch anders lösen, da ein jeweiliges Element nicht nur durch genau einen XPath beschrieben wird. Vielmehr erlaubt der Standard mithilfe verschiedener Merkmale unterschiedliche Beschreibungen für ein und dasselbe Element zu formulieren. Das Ziel ist daher, einen Pfad zu finden, der auf allen für den Test verwendeten Geräten funktioniert und überall eindeutig zum richtigen Element führt.

Im Beispiel besteht die Verbindung zur Android-App aus dem Tutorial und der Eintrag des GTIN-13-Buttons ist ausgewählt (5). Dessen automatisch generierter XPath (2) kann beispielsweise so aussehen:

//hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.view.ViewGroup/android.widget.FrameLayout[@resource id='android:id/content']/android.widget.RelativeLayout/android.widget.Button[@resource-id='de.exept.expeccomobiledemo:id/gtin_13']

Er ist offensichtlich lang und unübersichtlich. Der sehr viel kürzere Pfad

//*[@text='GTIN-13 (EAN-13)']

führt zum selben Element.

Für die iOS-App lautet der automatisch generierte XPath für diesen Button beispielsweise

//AppiumAUT/XCUIElementTypeApplication/XCUIElementTypeWindow[1]/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeButton[2]

bzw.

//AppiumAUT/UIAApplication/UIAWindow[1]/UIAButton[2]

und kann kürzer als

//*[@name='GTIN-13 (EAN-13)']

geschrieben werden.

Sie können den Pfad entsprechend im GUI-Browser ändern und durch Pfad überprüfen (6) feststellen, ob er weiterhin auf das ausgewählte Element zeigt, was expecco mit Verify Path: OK (7) bestätigen sollte. Der erste, sehr viel längere Pfad, beschreibt den gesamten Weg vom obersten Element des Baumes bis hin zum gesuchten Button. Der zweite Pfad hingegen wählt mit * zunächst sämtliche Elemente des Baumes und schränkt die Auswahl dann auf genau die Elemente ein, die ein text- bzw. name-Attribut mit dem Wert GTIN-13 (EAN-13) besitzen, in unserem Fall also genau der eine Button, den wir suchen.

Im folgenden werden Android-ähnliche Pfade zur Veranschaulichung verwendet. Die Elemente in iOS-Apps heißen zwar anders, wodurch andere Pfade entstehen; das Prinzip ist jedoch das gleiche.

Abb. 2: Elementbaum einer fiktiven App

Sie können solche Pfade mit Hilfe weniger Regeln selbst formulieren. Sehen Sie sich den einfachen Baum einer fiktiven Android-App in Abb. 2 an: Die Einrückungen innerhalb des Baumes geben die Hierarchie der Elemente wieder. Ein Element ist ein Kind eines anderen Elementes, wenn jenes andere Element das nächsthöhere Element mit einem um eins geringeren Einzug ist. Jenes Element ist das Elternelement des Kindes. Sind mehrere untereinander stehende Elemente gleich eingerückt, so sind sie also alle Kinder desselben Elternelements.

Ein Pfad durch alle Ebenen der Hierarchie zum TextView-Element ist nun:

//hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.TextView

Die Elemente sind mit Schrägstrichen voneinander getrennt. Es fällt auf, dass der Name des ersten Elements nicht mit dem im Baum übereinstimmt. Das oberste Element in der Hierarchie heißt immer hierarchy (für iOS wäre es AppiumAUT), expecco zeigt im Baum stattdessen den Namen der Verbindung an, damit man mehrere Verbindungen voneinander unterscheiden kann. Die weiteren Elemente tragen jeweils das Präfix android.widget., das im Baum zur besseren Übersicht nicht angezeigt wird. Bei IOS gibt es kein Präfix, das durch einen Punkt abgetrennt wäre, expecco 2.11 blendet aber entsprechend XCUIElementType am Anfang aus. Mit jedem Schrägstrich führt der Pfad über eine Eltern-Kind-Beziehung in eine tiefere Hierarchie-Ebene, d. h. FrameLayout ist ein Kindelement von hierarchy, LinearLayout ist ein Kind von FrameLayout usw. Die in eckigen Klammern geschriebenen Wörter dienen nur als Orientierungshilfe im Baum. Sie gehören nicht zum Typ.

Ein Pfad muss nicht beim Element hierarchy beginnen. Man kann den Pfad beginnend mit einem beliebigen Element des Baumes bilden. Man kann also verkürzt auch

//android.widget.TextView

schreiben. Der Pfad führt zum selben TextView-Element, da es nur ein Element dieses Typs gibt. Anders verhält es sich bei dem Pfad

//android.widget.Button.

Da es zwei Elemente vom Typ Button gibt, passt dieser Pfad auf zwei Elemente, nämlich den Button, der mit "An" markiert ist, und den Button, der mit "Aus" markiert ist. Es würde an dieser Stelle aber auch nicht helfen den langen Pfad von hierarchy aus beginnend anzugeben. Um einen mehrdeutigen Pfad weiter zu differenzieren, kann man explizit ein Element aus einer Menge wählen, indem man den numerischen Index in eckigen Klammern dahinter schreibt. Der Pfad aus dem obigen Beispiel lässt sich damit so anpassen, dass er eindeutig auf den Button mit der Markierung "Aus" weist:

//android.widget.Button[1].

Ihnen fällt sicher auf, dass der Index eine 1 ist obwohl das zweite Element gemeint ist. Das kommt daher, dass die Zählung bei 0 beginnt. Der Button mit der Markierung "An" hat also die Nummer 0 und der Button mit der Markierung "Aus" hat die Nummer 1.

Dieser Ansatz, einen expliziten Index zu verwenden, hat zwei Nachteile: Zum einen lässt sich an dem Pfad nur schwer ablesen welches Element gemeint ist, zum andern ist der Pfad sehr empfindlich schon gegenüber kleinsten Änderungen, wie zum Beispiel dem Vertauschen der beiden Button-Elemente oder dem Einfügen eines weiteren Button-Elements in der App.

Es wäre daher wünschenswert, das gemeinte Element über eine ihm charakteristische Eigenschaft wie einen Attributwert, zu adressieren. Für Android-Apps eignet sich hierfür häufig das Attribut resource-id. Im Idealfall muss bei der Entwicklung der App darauf geachtet werden, dass jedes Element eine eindeutige Id erhält. Die resource-id hat den großen Vorteil, dass sie unabhängig vom Text des Elements oder der Spracheinstellung des Geräts ist. Für iOS-Apps kann entsprechend das Attribut name verwendet werden, wenn es von der App sinnvoll gesetzt wird. Der XPath-Standard erlaubt solche Auswahlbedingungen zu einem Element anzugeben. Angenommen, der Button mit der Markierung "Aus" hat die Eigenschaft resource-id mit dem Wert off und der Button mit der Markierung "An" hat als resource-id den Wert on, dann kann man als eindeutigen Pfad für den "Aus"-Button

//android.widget.Button[@resource-id='off']

formulieren. Wie an dem Beispiel zu sehen werden solche Bedingungen wie ein Index in eckigen Klammern an den Elementtyp angehängt. Der Name eines Attributes wird mit einem @ eingeleitet und der Wert mit einem = in Anführungszeichen angehängt. Ist der Attributwert global eindeutig, kann man den vorausgehenden Pfad sogar durch den globalen Platzhalter * ersetzen, der auf jedes Element passt. Das obige Beispiel mit dem GTIN-13-Button war ein solcher Fall.

Abb. 3: Elementbaum einer fiktiven App mit Erweiterungen

Abb. 3 zeigt eine Erweiterung des Beispiels aus Abb. 2. Die App hat nun ein weiteres, nahezu identisches LinearLayout bekommen. Die Buttons sind in ihren Attributen jeweils ununterscheidbar. Deshalb funktioniert der vorige Ansatz nicht, einen eindeutigen Pfad nur mithilfe eines Attributwerts zu formulieren. Offensichtlich unterscheiden sich aber ihre benachbarten TextViews. Es ist möglich die jeweilige TextView in den Pfad mit aufzunehmen, um einen Button dennoch eindeutig zu adressieren. Ein Pfad zum Button mit der Markierung "An" unterhalb der TextView mit der Markierung "Druckschalter" kann dabei wie folgt aussehen:

//android.widget.TextView[@resource-id='push']/../android.widget.Button[@resource-id='on']

Der erste Teil beschreibt den Pfad zu der TextView mit der Markierung "Druckschalter" und der resource-id mit dem Wert push. Danach folgt ein Schrägstrich gefolgt von zwei Punkten. Die zwei Punkte sind eine spezielle Elementbezeichnung, die nicht ein Kindelement benennt, sondern zum Elternelement wechselt, in diesem Fall also das LinearLayout, in dem die TextView eingebettet ist. Im Kontext dieses LinearLayout ist der restliche Pfad, nämlich der Button mit der resource-id mit dem Wert on, eindeutig.

Der XPath-Standard bietet noch sehr viel mehr Ausdrucksmittel. Mit der hier knapp vorgestellten Auswahl ist es aber bereits möglich für die meisten praktischen Testfälle gute Pfade zu formulieren. Eine vollständige Einführung in XPath ginge über den Umfang dieser Einführung weit hinaus. Sie finden zahlreiche weiterführende Dokumentationen im Web und in Büchern.

Eine universelle Strategie zum Erstellen guter XPaths gibt es nicht, da sie von den Testanforderungen abhängt. In der Regel ist es sinnvoll, den XPath kurz und dennoch eindeutig zu halten. Häufig lassen sich Elemente über Eigenschaften identifizieren wie beispielsweise ihren Text. Will man aber gerade den Text eines Elements auslesen, kann dieser natürlich nicht im Pfad verwendet werden, da er vorher nicht bekannt ist. Ebenso wird der Text variieren, wenn die App mit verschiedenen Sprachen gestartet wird.

Jeder Baustein, der auf einem Element arbeitet, hat einen Eingangspin für den XPath. Im GUI-Browser finden Sie in der Mitte oben eine Liste von Bausteinen mit Aktionen, die Sie auf das ausgewählte Element anwenden können. Suchen Sie den Baustein Click (8) im Ordner Elements und wählen Sie ihn aus (Abb. 1). Er wird im rechten Teil unter Test eingefügt, der Pin für den XPath ist mit dem automatisch generierten Pfad des Elements vorbelegt (9). Sie können den Baustein hier auch ausführen. Die Ansicht wechselt dann auf Lauf. Ändert sich durch die Aktion der Zustand Ihrer App, müssen Sie den Baum anschließend aktualisieren (10).

Wenn Sie in der unteren Liste eine Eigenschaft auswählen, wechselt die Anzeige der Bausteine zu Eigenschaften, wo Sie die eigenschaftsbezogenen Bausteine finden. Wie bei den Aktionen können Sie auch hier einen Baustein auswählen, der dann rechts in Test mit dem Pfad des Elements und der ausgewählten Eigenschaft eingetragen wird, sodass Sie ihn direkt ausführen können.

Problems and Solutions[Bearbeiten]

Locators depend on the version or are variable[Bearbeiten]

In this case consider to either store the locators (xPath) in a variable or to define a locator mapping inside a screenplay attachment. It is also possible to store just parts of an locator (e.g. locator path of a parent or attribute value) in a variable and add them in the freeze value of the locator pin by "$(varName)".

Invisible UI Elements[Bearbeiten]

Note that the Recorder also considers items that you cannot see on the screen. Therefore, turn on element highlighting or use the follow mouse function and the element tree in the GUI browser to determine if the correct element is used. It can happen, that invisible elements are in front of other elements and cover them, so that the desired element cannot be selected in the recorder. See section Hide elements for a solution to this.

iOS: Cable not certified[Bearbeiten]

In some cases, when connecting an iOS device via USB, a message appears indicating that the cable used is not certified. In this case, replacing the respective cable is the only solution.

iOS: Alerts when connecting[Bearbeiten]

Make sure that no alerts are open when connecting to an iOS device. Otherwise the connection will fail because the app cannot be brought to the foreground. See also Preparing an iOS-Device and App.

iOS: .ipa cannot be installed[Bearbeiten]

Note that on iOS simulators no .ipa files can be installed but only .app files.

iOS: First Connect is not working[Bearbeiten]

If there is not already a signed build of the WebDriverAgent on your Mac, it has to be created during the first connect. Usually, this can take a little longer than one minute. Per default Appium uses a timeout of 60000 ms to wait for the WebDriverAgent to start on the device, so the connect will be canceled in that case. You can set this timeout with the capability wdaLaunchTimeout, e.g. to 120000.

Moreover, the signing settings have to be correct. In our experience, the most reliable solution is to set automatic signing in the WebDriverAgent Xcode project an selecting the team there. See the explanation in section Signing WebDriverAgent for that. In this case you should not use the capabilities xcodeConfigFile resp. xcodeOrgId and xcodeSigningId, as they could cause a conflict. Caution: If you have set a Team ID in the Mobile Testing settings, expecco will automatically set this as xcodeOrgId!

Pay attention to your device during the first connect. You might have to agree to the installation by entering your password. On the Mac you might need to enter the password to allow access to the key chain for signing, often several times.

Android: Device not visible in the connect editor[Bearbeiten]

If an Android device connected via USB does not appear in the connection editor, try changing the USB connection type. Usually MTP or PTP should work. Check again, if "USB Debugging" is enabled in the developer options on the device (these options are disabled on some devices and have to be enabled first using a trick.) See also Prepare Android Device.

Android: Truncated Elements at Bottom[Bearbeiten]

For Android devices that automatically show and hide the navigation bar/softkeys, the recorder may cut off elements in the lower area that would be hidden by the softkeys, even if they are not displayed at this time. In this case it is advisable to set the softkeys so that they are permanently displayed.

For newer Android versions there usually is no such option. Even if the controls are visible all the time, they don't have their own space, but are on top of the content of the app. Therefore, there is an area on the lower part of the screen, which cannot be automated, because it is not counted to the active area of the app. Appium will then truncate the elements there. This area can even be larger then the needed by the controls. This is a known issue for Samsung devices with Android 11. Since the information about the size of the app area is already provided on Android level, we cannot offer a solution for this, but can only hope that the problem will be fixed by the manufacturer. You may try to get better results by setting the control to gestures, but this bears the same issue.

Android: Test Hangs While Finding an Element[Bearbeiten]

The block Find Element by XPath and all element blocks wait until an element is present for the given path. The timeout for this can be set either directly at the block or in the environment variables. However, if the element should already be present, but the test doesn't continue anyway, the reason could be in the UIAutomator/UIAutomator2. It waits for the app to go to the idle state before it even starts to search for the element. This may take longer, if the app e.g. runs an animation in the background or executes other kinds of actions. Fetching the page source, e.g. when updating in the GUI browser or in the recorder, can also take longer for this reason. There is a default timeout of 10 seconds after which it no longer waits for the idle state. This timeout can be set in Appium (waitForIdleTimeout). If you want to change the value of this timeout, you can do this since expecco 21.2 by executing the Smalltalk code AppiumTestRunner::TestRunConnection waitForIdleTimeout:2000 before the test. The timeout is given in milliseconds, so the example sets it to 2 seconds.

Android: Updating the Tree or Switching to Webview Context takes too long[Bearbeiten]

Especially with older devices it can happen that newer Chromedriver cannot be initialized. This makes it impossible to switch to the webview context. However, this is only detected over a timeout by Appium, which is 4 minutes by default. Since expecco also tries to switch to the webview context when building the tree in the GUI browser, this can lead to very long loading times. Since there is no way to decrease this timeout in Appium, we have added a corresponding capability to the version we provide in the MobileTestingSupplement. Starting with version 1.13.1.0 of the MobileTestingSupplement, chromedriverStartTimeout can be used to set the timeout in milliseconds. The switch still doesn't work then, but expecco doesn't take as long to update the tree and the context switch module fails faster. The connection dialog adds this capability automatically starting with expecco 22.1.

No Action on Click[Bearbeiten]

The block to click on an element is successful, but no action was performed on the device.

This can happen if the element is hidden by another element and therefore clicking on the element is not possible. In this case, Appium does not throw an error, but simply nothing happens. If you would like to make a click at the position of the element anyways, even if it is hidden, use the block Tap instead and pass the location of the element to it (Get Location). If instead you want to check before a click whether the element is hidden at this moment, try whether the properties Is Displayed or Is Enabled might help you.

No Update After Action[Bearbeiten]

An action was triggered on the recorder and a block has been recorded, but the recorder still shows the old image.

The recorder doesn't show a live image of the device, but only a snapshot. After an action has been executed, the recorder will update automatically. However, it can happen, that the image has already been updated before the effects of the action are fully completed on the device. In this case you should update the recorder by hand using the icon with the blue arrows. Since expecco 20.2 you can also enable automatic updates for this case. See also the description for the recorder.

Attribute "clickable" is wrong[Bearbeiten]

An element has for the attribute/property "clickable" the value "false", but is actually clickable.

The attribute "clickable" has to be set explicitly by the app developer and does not affect the behavior of the app. You should generally disregard this attribute in your tests. Unfortunately, many apps exist where the programmer was "lazy" about this.

Connecting Fails[Bearbeiten]

If the connection to the Appium server fails, you will receive an error message in expecco similar to the one shown below.

MobileTestingVerbindungsfehler.png

Here you can see the type of error that has occurred. Click on "Details" to get more information. Possible errors are:

  • org.openqa.selenium.remote.UnreachableBrowserException
The specified server is not running or is not reachable. Check the server address.
  • org.openqa.selenium.WebDriverException
Read the message after Original Error in the first line of the details:
  • Unknown device or simulator UDID
Either the device is not connected properly or the udid is not correct.
  • Unable to launch WebDriverAgent because of xcodebuild failure: xcodebuild failed with code 65
This error can have various causes. Either the WebDriverAgent could actually not be built because the signing settings are wrong or the appropriate provisioning profile is missing. Please read the section about Signing. It is also possible that the WebDriverAgent cannot be started on the device, for example because an alert is in the foreground or you did not trust the developer.
  • Could not install app: 'Command 'ios-deploy [...] exited with code 253'
The specified app cannot be installed on the iOS device because it is not entered in the app's Provisioning Profile.
  • Bad app: [...] App paths need to be absolute, or relative to the appium server install dir, or a URL to compressed file, or a special app name.
The path to the app is wrong. Make sure that the file is located in the specified path on your Mac.
  • packageAndLaunchActivityFromManifest failed.
The specified apk file is probably broken.
  • Could not find app apk at [...]
The path to the app is wrong. Make sure that the apk file is located in the specified path.


If the error is not due to one of the causes listed above, the automation applications on the device may no longer function properly. In this case it helps to uninstall them from the mobile device. They are then automatically reinstalled the next time a connection is established.

  • For iOS devices, this is the WebDriverAgent, which you can simply uninstall from the home screen. This usually solves problems caused by changing the used Mac or the Xcode version.
  • For Android devices, it is the UIAutomator2; here, a problem occurs sporadically on some devices, the cause is currently unknown to us. To uninstall, on the device, navigate to "Settings" > "Applications"* and search the list for the following entries:
   Appium Settings
   io.appium.uiautomator2.server
   io.appium.uiautomator2.server.test
Click on the respective application and then on "Uninstall".

*The corresponding entry may have a slightly different name on some devices.


If this doesn't help, check the output of the Appium server. For a server started by expecco, you can find the log in the list of Running Appium Servers.

I do not have a Mac[Bearbeiten]

Maybe this site will help you: https://www.howtogeek.com/289594/how-to-install-macos-sierra-in-virtualbox-on-windows-10



Copyright © 2014-2024 eXept Software AG