Appium Plugin Reference en: Unterschied zwischen den Versionen
Ff (Diskussion | Beiträge) (Die Seite wurde neu angelegt: „= Introduction = Appium is a free open source framework for testing and automation of mobile applications. These tests can be performed either on real mobile …“) |
Ff (Diskussion | Beiträge) |
||
Zeile 52: | Zeile 52: | ||
In the top field, please select the device with which you want to connect. In the drop-down menu are all accessible devices. After that the packets on the device are retrieved, this may take a few moments. The packets are divided into external packages and system packages. Your installed applications are among the foreign packages. If havn't installed any application so far, you can choose the calculator for example, which is already on the device. To do so, select the system packages. In the box below, you can enter a filter to reduce the list of packages. Enter '' Calc '' as a filter and you will find the calculator easier. (Depending on the device, the package is named differently, but still includes 'calculator' ') and select the package, and then in the bottom drop-down menu Activity from this package (z. B.' '. Calculator ''). When you click OK, the capabilities are set according to your choice. |
In the top field, please select the device with which you want to connect. In the drop-down menu are all accessible devices. After that the packets on the device are retrieved, this may take a few moments. The packets are divided into external packages and system packages. Your installed applications are among the foreign packages. If havn't installed any application so far, you can choose the calculator for example, which is already on the device. To do so, select the system packages. In the box below, you can enter a filter to reduce the list of packages. Enter '' Calc '' as a filter and you will find the calculator easier. (Depending on the device, the package is named differently, but still includes 'calculator' ') and select the package, and then in the bottom drop-down menu Activity from this package (z. B.' '. Calculator ''). When you click OK, the capabilities are set according to your choice. |
||
Wählen Sie im obersten Feld das Gerät aus, mit dem Sie sich verbinden wollen. In der Liste des Dropdown-Menüs finden Sie alle erreichbaren Geräte. Daraufhin werden die auf dem Gerät vorhandenen Pakete abgerufen, dies kann einen Moment dauern. Die Pakete werden in Fremdpakete und Systempakete unterteilt. Von Ihnen installierte Anwendungen befinden sich unter den Fremdpaketen. Haben Sie noch keine Anwendung installiert, können Sie beispielsweise auch den Taschenrechner auswählen, der sich bereits auf dem Gerät befindet. Wählen Sie dazu die Systempakete aus. Im Eingabefeld darunter können Sie einen Filter eingeben, um die Liste der Pakete zu verkleinern. Geben Sie ''Calc'' als Filter ein und Sie finden Ihren Taschenrechner einfacher. (Das Paket heißt je nach Gerät verschieden, hat aber ''calculator'' im Namen.) Wählen Sie im Dropdown-Menü das gewünschte Paket aus und anschließend im untersten Dropdown-Menü eine Activity aus diesem Paket (z. B. ''.Calculator''). Durch Klicken auf OK werden die Capabilities entsprechend Ihrer Auswahl gesetzt. |
|||
[[Datei:AppiumSettingsWizard.png| 600px|]] |
[[Datei:AppiumSettingsWizard.png| 600px|]] |
||
If you prefer to enter the Capabilities manually, please select the desired capabilities from the bottom left of the dropdown box . To add them to the configuration, click '' Add ''. Then you can enter the appropriate values for each Capabilities in the list. Using '' Remove '' you can delete registered Capabilities from the list. |
|||
Um die Capabilities manuell einzutragen, wählen Sie links unten aus der Dropdownbox die gewünschten Capabilities aus. Um sie der Konfiguration hinzuzufügen, klicken Sie auf ''Hinzufügen''. Danach können Sie in der Liste im Dialog die entsprechenden Werte für die einzelnen Capabilities eingeben. Mit ''Entfernen'' können Sie eingetragene Capabilities wieder aus der Liste löschen. |
|||
he following capabilities are necessary for a connection setup: |
|||
Die folgenden Capabilities sind für einen Verbindungsaufbau notwendig: |
|||
* |
* PlatformName: Select if you want to automate an Android or an iOS app. |
||
* |
* UDID: Select here on which device you want to automate the app, for example, '' emulator-5554 '' |
||
For Android apps the following capabilities are additionally required: |
|||
Für Android-Apps sind folgende Capabilities zusätzlich notwendig: |
|||
* |
* AppPackage: Please enter the package of the app to be automated, e.g. '' com.apple.calculator '' |
||
* |
* AppActivity: Please enter the Activity within the package, e.g. '' .Calculator '' |
||
For iOS apps the following capabilities are additionally required: |
|||
Für iOS-Apps sind folgende Capabilities zusätzlich notwendig: |
|||
* |
* BundleId: Please enter the bundle ID of the app to be automated, e.g. ''com.apple.calculator '' |
||
You will find more information on available capabilities here: |
|||
Weitere Informationen zu verfügbaren Capabilities finden Sie unter: |
|||
http://appium.io/slate/en/master/?java#appium-server-capabilities |
http://appium.io/slate/en/master/?java#appium-server-capabilities |
||
After you have added all the capabilities, you can '' Save '' your settings to a file. Next time, you may import them via '' Load from file '' or use them in your tests. |
|||
Nachdem Sie alle gewünschten Capabilities hinzugefügt haben, können Sie mit ''Speichern'' Ihre Einstellungen in einer Datei speichern. Diese können Sie dann beim nächsten Mal über ''Laden aus Datei'' einlesen oder auch in den Tests verwenden. |
|||
By clicking on '' Connect '' you start to connect with the specified settings. |
|||
Mit einem Klick auf ''Verbinden'' starten Sie den Verbindungsaufbau mit den angegebenen Einstellungen. |
|||
== |
== Create tests with the Appium recorder == |
||
Once you have setup a connection with a device, you can start the Appium recorder using the recording icon in the GUI browser. |
|||
Nachdem Sie die Verbindung zu einem Gerät hergestellt haben, können Sie im GUI-Browser den Appium-Recorder über das Aufnahme-Symbol starten. |
|||
[[Datei:AppiumRecorder.png|1000px|]] |
[[Datei:AppiumRecorder.png|1000px|]] |
||
In the menu bar, you can click on '' action '' to select the action you want to execute. The default value is '' touch '', which triggers a clicking on the selected item. You can now perform an action using the mouse by clicking on the display of the recorder, for example, on a figure of the calculator. You can see that the action on the device is running and the recorder is reloading the current screen contents of the device. In addition, a corresponding block is created in the work space of the GUI browser . |
|||
In der Menüleiste können Sie bei ''Aktion'' auswählen, welche Aktion Sie ausführen wollen. Voreingestellt ist ''Berühren'', was ein Anklicken des ausgewählten Elements erzeugt. Sie können nun mit der Maus eine Aktion auslösen, indem Sie in der Anzeige des Recorders beispielsweise auf eine Ziffer des Taschenrechners klicken. Sie sehen, dass die Aktion auf dem Gerät ausgeführt wird und der Recorder den aktuellen Bildschirminhalt des Geräts nachlädt. Außerdem wird im Arbeitsbereich des GUI-Browsers ein entsprechender Baustein erzeugt. |
|||
You can choose from the following actions: |
|||
Sie können aus folgenden Aktionen wählen: |
|||
* Actions |
|||
* Aktionen |
|||
** '' Swipe '': Swipe across the screen from the position where you press the mouse up to the position where you release it. The duration is also considered. |
|||
** ''Wischen'': Wischen über den Bildschirm von der Position, an der Sie die Maus drücken, bis zu der Position, an der Sie sie wieder loslassen. Die Dauer wird ebenfalls berücksichtigt |
|||
** '' |
** '' Tapping ': Tapping the screen at the cursor position with the same duration as your mouse is pressed (helpful for Long-click). |
||
** '' Touch element '': similar to tapping, but for the item at the cursor position. |
|||
** ''Element antippen'': wie Antippen, aber für das Element an der Cursorposition |
|||
** '' Touch '': short touch of the element at the cursor position (click). |
|||
** ''Berühren'': kurzes Berühren des Elements an der Cursorposition (Click) |
|||
** ''Zoom'': |
** '' Zoom '': not implemented yet. |
||
** '' Set text '': after clicking on an item you can enter the text which is to be filled in; this only works for input fields. |
|||
** ''Text setzen'': nach dem Klicken auf ein Element können Sie den Text eingeben, mit dem dieses befüllt werden soll; funktioniert nur für Eingabefelder |
|||
* Test & Verify |
* Test & Verify |
||
** '' Compare attribute '': After clicking on an item, you can select one of its attributes. This will create a branch block, which compares the value of the attribute at the time of the tests with the specified value. |
|||
** ''Attribut vergleichen'': Nach dem Klicken auf ein Element können Sie eines seiner Attribute auswählen. Es wird ein Verzweigungsbaustein erstellt, der den Wert des Attributs zum Zeitpunkt des Tests mit dem angegebenen Wert vergleicht. |
|||
** '' Verify attribute '': After clicking on an item, you can select one of its attributes. This will create a block that fails when the value of the attribute does not comply with the specified value at the time of the test. |
|||
** ''Attribut verifizieren'': Nach dem Klicken auf ein Element können Sie eines seiner Attribute auswählen. Es wird ein Baustein erstellt, der fehlschlägt, wenn der Wert des Attributs zum Zeitpunkt des Tests mit dem angegebenen Wert nicht übereinstimmt. |
|||
You can also use the four icons on the right-hand side to trigger the keys '' Home '', '' Previous '' '' menu '' and '' Power ''. |
|||
When recording the actions the blocks in the workspace are created linearly. You can also simply change the flow there, for example by using branching blocks or adding additional modules. Using the icon in the upper right corner, you can create the workspace as a new module in your test suite. |
|||
Beim Aufnehmen der Aktionen werden die Bausteine im Arbeitsbereich lediglich linear angelegt. Sie können den Ablauf dort aber auch einfach ändern, zum Beispiel wenn Sie Verzweigungsbausteine verwenden oder zusätzliche Bausteine einfügen wollen. Über das Icon in der rechten oberen Ecke können Sie den Arbeitsbereich als neuen Baustein in Ihrer Testsuite anlegen. |
|||
To run tests with these devices later on, you need to implement the '' Connect '' block from the Appium library at the beginning of the test - and at the end a '' Disconnect '' block accordingly. If you want to generate the Capabilities for the '' Connect '' - module you can use the module '' Read from File Capabilities, which is able to read a file created in the connection dialog. |
|||
== Disconnection == |
|||
In order to terminate an existing connection, perform a right-click on the connection entry in the GUI browser and select '' Remove connection '' or '' Disconnect and remove entry ''. In this way, the connection from Appium to the device under test is terminated. Only then, disconnect the device from the PC. You can stop the Appium server by closing the console window. |
|||
= Developer Guide = |
|||
== Verbindungsabbau == |
|||
Um eine bestehende Verbindung abzubauen, führen Sie einen Rechtsklick auf den Verbindungseintrag im GUI-Browser aus und wählen Sie ''Verbindung abbauen'' oder ''Verbindung abbauen und Eintrag entfernen'' aus. Dadurch wird die Verbindung von Appium zum Testgerät abgebaut. Trennen Sie erst anschließend das Gerät vom PC. Den Appium-Server können Sie stoppen, indem Sie das Konsolenfenster schließen. |
|||
= Entwicklerguide = |
|||
== |
== Architecture and Technologies == |
||
The connection to the Appium test framework was implemented via the 'Appium Driver', an advanced version of Selenium WebDriver. This interface is based on HTML and JavaScript and was functionally enhanced so that it can be used as an interface to the Appium server and thus the services can be used for testing mobile applications. These two components communicate via the JSON Wire Protocol. |
|||
Currently, Appium supports testing on iOS and Android systems. Basically, the tests can be written in any programming language. However, when you create the tests you need to define the system on which the application under test is located. The server corresponds with this definition, selects the actions to be executed and sends these commands in a comprehensible form to the devices on the target system. As middleware for Android systems, the Android Debug Bridge is used. For iOS systems, Instruments is used. |
|||
Die Anbindung an das Appium Testframework wurde über den 'Appium Driver', einer Weiterentwicklung des Selenium WebDriver, umgesetzt. Das auf HTML und JavaScript basierende Interface wurde funktional so erweitert, dass es als Schnittstelle zum Appium Server verwendet werden kann und dadurch dessen Dienste zum Testen von mobilen Anwendungen genutzt werden können. Diese beiden Komponenten kommunizieren über das JSON Wire Protokoll miteinander. |
|||
Zur Zeit unterstützt Appium das Testen auf iOS und Android Systemen. Grundsätzlich können die Test in diversen Programmiersprachen geschrieben werden. Jedoch muss beim Erstellen der Tests definiert werden, auf welchem System sich die zu testende Anwendung befindet. An dieser Definition orientiert sich der Server, sucht sich die auszuführenden Aktionen heraus und sendet diese Befehle in einer dem Zielsystem verständlichen Form an die Endgeräte. Als Middleware für Android-Systeme wird die Android Debug Bridge genutzt. Für iOS-Systeme hingegen wird Instruments verwendet. |
|||
[[Datei:appium_architekturskizze_mit_konsolenfenster.png | 650px|]] |
[[Datei:appium_architekturskizze_mit_konsolenfenster.png | 650px|]] |
Version vom 1. April 2016, 08:48 Uhr
Inhaltsverzeichnis
Introduction[Bearbeiten]
Appium is a free open source framework for testing and automation of mobile applications. These tests can be performed either on real mobile devices or on emulated devices. Regarding expecco, both Android and iOS devices are supported. With its Appium plugin expecco offers an interface for executing tests using the Appium framework. The first chapter of this document describes the use of the Appium bundle, the Android SDK and the JDK customized by eXept Software. With this compilation you can quickly implement the first tests. The first section of the chapter explains how to install the bundle on your operating system. If you have already installed the bundle, you can skip this section. Following describes how you can start the individual components of the bundle. To get a quick impression of our Appium implementation, at the end of the chapter a short tutorial describes how you can perform initial tests using the bundles. The second chapter is based on an exemplary test setup the Appium plugin and its interaction with the Appium server, and explains testing of mobile applications. The focus is placed on the technologies employed to allow developers a starting point for independent development of modules or to expand the existing function library.
Setup[Bearbeiten]
Installation of the Bundle[Bearbeiten]
To quickly perform your first steps with mobile testing in expecco you can download the Appium Bundle here: https://download.exept.de/transfer/h-expecco-2.8.0/appiumBundleSetup-1.2.exe. The download consists of a single installation file. After the download you can start the installation by double-clicking on the file. Then follow the instructions on the screen and choose where to install the bundle. During the installation process the Appium app might start. You may close it as for the test the Appium server will be launched directly.
The PATH environment variable must be extended by the directory in which the adb.exe is located. In order to do this, please search the system control for the environment variables. Double-click on the variable named PATH in order to modify it. If no variable exists with this name, please generate a new one and specify the path of the directory that contains adb.exe, or attach it (separated by a semicolon)to the existing value of the variable. The path usually has the form of C: \ Program Files (x86) \ exept \ Appium Bundle \ android-sdk \ platform-tools'.
Launching the Appium Server[Bearbeiten]
The bundle includes an Appium server that enables communication between expecco and the tester. You can start directly from shortcut on your desktop that was created during installation. Alternatively, you can also start the batch file "start_appium.bat" in the installation directory of the bundle. A window with a console on which the server is running and its log messages are output is openend . The server is ready, when the first log messages appear.
Connecting a mobile device[Bearbeiten]
Before you can control a mobile device with the Appium plugin, you must allow for USB debugging. For Android devices, please see the settings under Developer options (see https://www.droidwiki.de/USB-Debugging). When a device is connected to the PC via USB, you may have to accept the setup of the connection to the device.
Connection via the Appium connection dialog[Bearbeiten]
After lauching the Appium server and a device is connected via USB, you can setup a connection to a mobile application in expecco. Switch to expecco in the GUI browser where you can select 'Connect' and then select ' 'Appium' ' from the appearing drop-down menu.
Thereupon the Appium connection dialog opens (see screenshot), in which you configure the desired parameters for the connection.
First, enter the address of the Appium server in the input box. By default, the Appium server on port 4723 is started. So enter the following:
http://<IP des Appium Hostrechners>:4723/wd/hub
As a next step you need to specify the configuration for the connection. For that, the Appium server requires so-called Capabilities.
For tests on Android, it is advisable to use the Android Wizard. The Android Assistant allows you to automatically fill capabilities for any USB-attached devices.
By clicking on Android Wizard ' the configuration wizard opens (see screenshot). Using this wizard, you can make the standing on available configurations via drop-down menus.
In the top field, please select the device with which you want to connect. In the drop-down menu are all accessible devices. After that the packets on the device are retrieved, this may take a few moments. The packets are divided into external packages and system packages. Your installed applications are among the foreign packages. If havn't installed any application so far, you can choose the calculator for example, which is already on the device. To do so, select the system packages. In the box below, you can enter a filter to reduce the list of packages. Enter Calc as a filter and you will find the calculator easier. (Depending on the device, the package is named differently, but still includes 'calculator' ') and select the package, and then in the bottom drop-down menu Activity from this package (z. B.' '. Calculator ). When you click OK, the capabilities are set according to your choice.
If you prefer to enter the Capabilities manually, please select the desired capabilities from the bottom left of the dropdown box . To add them to the configuration, click Add . Then you can enter the appropriate values for each Capabilities in the list. Using Remove you can delete registered Capabilities from the list.
he following capabilities are necessary for a connection setup:
- PlatformName: Select if you want to automate an Android or an iOS app.
- UDID: Select here on which device you want to automate the app, for example, emulator-5554
For Android apps the following capabilities are additionally required:
- AppPackage: Please enter the package of the app to be automated, e.g. com.apple.calculator
- AppActivity: Please enter the Activity within the package, e.g. .Calculator
For iOS apps the following capabilities are additionally required:
- BundleId: Please enter the bundle ID of the app to be automated, e.g. com.apple.calculator
You will find more information on available capabilities here:
http://appium.io/slate/en/master/?java#appium-server-capabilities
After you have added all the capabilities, you can Save your settings to a file. Next time, you may import them via Load from file or use them in your tests.
By clicking on Connect you start to connect with the specified settings.
Create tests with the Appium recorder[Bearbeiten]
Once you have setup a connection with a device, you can start the Appium recorder using the recording icon in the GUI browser.
In the menu bar, you can click on action to select the action you want to execute. The default value is touch , which triggers a clicking on the selected item. You can now perform an action using the mouse by clicking on the display of the recorder, for example, on a figure of the calculator. You can see that the action on the device is running and the recorder is reloading the current screen contents of the device. In addition, a corresponding block is created in the work space of the GUI browser .
You can choose from the following actions:
- Actions
- Swipe : Swipe across the screen from the position where you press the mouse up to the position where you release it. The duration is also considered.
- Tapping ': Tapping the screen at the cursor position with the same duration as your mouse is pressed (helpful for Long-click).
- Touch element : similar to tapping, but for the item at the cursor position.
- Touch : short touch of the element at the cursor position (click).
- Zoom : not implemented yet.
- Set text : after clicking on an item you can enter the text which is to be filled in; this only works for input fields.
- Test & Verify
- Compare attribute : After clicking on an item, you can select one of its attributes. This will create a branch block, which compares the value of the attribute at the time of the tests with the specified value.
- Verify attribute : After clicking on an item, you can select one of its attributes. This will create a block that fails when the value of the attribute does not comply with the specified value at the time of the test.
You can also use the four icons on the right-hand side to trigger the keys Home , Previous menu and Power .
When recording the actions the blocks in the workspace are created linearly. You can also simply change the flow there, for example by using branching blocks or adding additional modules. Using the icon in the upper right corner, you can create the workspace as a new module in your test suite.
To run tests with these devices later on, you need to implement the Connect block from the Appium library at the beginning of the test - and at the end a Disconnect block accordingly. If you want to generate the Capabilities for the Connect - module you can use the module Read from File Capabilities, which is able to read a file created in the connection dialog.
Disconnection[Bearbeiten]
In order to terminate an existing connection, perform a right-click on the connection entry in the GUI browser and select Remove connection or Disconnect and remove entry . In this way, the connection from Appium to the device under test is terminated. Only then, disconnect the device from the PC. You can stop the Appium server by closing the console window.
Developer Guide[Bearbeiten]
Architecture and Technologies[Bearbeiten]
The connection to the Appium test framework was implemented via the 'Appium Driver', an advanced version of Selenium WebDriver. This interface is based on HTML and JavaScript and was functionally enhanced so that it can be used as an interface to the Appium server and thus the services can be used for testing mobile applications. These two components communicate via the JSON Wire Protocol. Currently, Appium supports testing on iOS and Android systems. Basically, the tests can be written in any programming language. However, when you create the tests you need to define the system on which the application under test is located. The server corresponds with this definition, selects the actions to be executed and sends these commands in a comprehensible form to the devices on the target system. As middleware for Android systems, the Android Debug Bridge is used. For iOS systems, Instruments is used.