aformatik Training & Consulting GmbH & Co. KG 1
Eine Einführung in das automatisierte Testen
mit dem Robot-Framework
Thomas Gauss
aformatik Training & Consulting GmbH & Co. KG
aformatik Training & Consulting GmbH & Co. KG 2
Fahrplan – Agenda
aformatik Training & Consulting GmbH & Co. KG 3
Vorstellung des Robot-Frameworks
Framework zur (automatischen) Durchführung von Akzeptanztests
Keyword-Driven Testing
generisch, modular und erweiterbar
in aktiver Entwicklung (seit 2005)
frei verfügbar
umfangreich dokumentiert
aformatik Training & Consulting GmbH & Co. KG 4
Einsatzzweck
Unit-
test
Integrations-
test
System-
test
Akzeptanz-
test
aformatik Training & Consulting GmbH & Co. KG 5
Einsatzzweck
Unit-
test
Integrations-
test
System-
test
Akzeptanz-
test
aformatik Training & Consulting GmbH & Co. KG 6
Test-Framework - Typen
System under Test
Framework
Linear
Daten und Ablauf
System under Test
Framework
System under Test
Framework
Data-driven
Ablauf
Daten
Keyword-driven
AblaufDaten
aformatik Training & Consulting GmbH & Co. KG 7
Test-Framework - Typen
System under Test
Framework
Linear
Daten und Ablauf
System under Test
Framework
Data-driven
Ablauf
Daten
Keyword-driven
AblaufDaten
System under Test
Framework
aformatik Training & Consulting GmbH & Co. KG 8
Keyword-Driven Testing
Beschreibung eines Tests durch verständliche Anweisungen („Keywords“)
Tatsächliche (technische) Durchführung des Tests wird vom Framework übernommen
Beispiel:
Launch Application de.aformatik.jsf2015.SampleAppStarter
Select Main WindowPush Button Ändere TitelSelect Dialog Titel-EingabeInsert Into TextField OptionPane.textField Herzlich willkommen beim...Push Button OK
Select Main WindowPush Button Wähle BildChoose From File Chooser jfslogo.jpg
aformatik Training & Consulting GmbH & Co. KG 9
Testablauf
Robotframework
Daten
&
Ablauf
„Input“
aformatik Training & Consulting GmbH & Co. KG 10
Testablauf
Robotframework
Daten
&
Ablauf
„Input“
aformatik Training & Consulting GmbH & Co. KG 11
Testablauf
Robotframework
Daten
&
Ablauf
„Input“
Protokoll
„Output“
aformatik Training & Consulting GmbH & Co. KG 12
Test-Protokoll
aformatik Training & Consulting GmbH & Co. KG 13
Test-Protokoll
aformatik Training & Consulting GmbH & Co. KG 14
Framework-Stack
Robotframework
Daten
&
Ablauf
Protokoll
aformatik Training & Consulting GmbH & Co. KG 15
Framework-Stack
Robotframework
Daten
&
Ablauf
Protokoll
Keyword-Bibliotheken
aformatik Training & Consulting GmbH & Co. KG 16
Framework-Stack
Robotframework
Daten
&
Ablauf
Protokoll
Keyword-Bibliotheken
Python
(C)Python
aformatik Training & Consulting GmbH & Co. KG 17
Framework-Stack
Robotframework
Daten
&
Ablauf
Protokoll
Keyword-Bibliotheken
Python
(C)Python PyPy
aformatik Training & Consulting GmbH & Co. KG 18
Framework-Stack
Robotframework
Daten
&
Ablauf
Protokoll
Keyword-Bibliotheken
Python
(C)Python PyPy Jython
Java
aformatik Training & Consulting GmbH & Co. KG 19
Framework-Stack
Robotframework
Daten
&
Ablauf
Protokoll
Keyword-Bibliotheken
Python
(C)Python PyPy Jython
Java
JVM
aformatik Training & Consulting GmbH & Co. KG 20
Framework-Stack
Robotframework
Daten
&
Ablauf
Protokoll
Keyword-Bibliotheken
Python
(C)Python PyPy Jython
Java
JVM
aformatik Training & Consulting GmbH & Co. KG 21
„Generisch, modular und erweiterbar“
Framework kommuniziert über „Benutzerschnittstelle“ mit dem zu testenden Programm
(SUT – „System under Test“)
Trennung von Test-Beschreibung, -Implementierung und -Daten
Ergebnisausgabe auch als xml (für automat. Weiterverarbeitung)
Eigene Bibliotheken einbindbar
Framework ist freie Software
aformatik Training & Consulting GmbH & Co. KG 22
Entwicklung
seit 2005, Master-Arbeit von Pekka Klärck (geb. Laukkanen)
Entwicklung wird unterstützt durch Nokia (Siemens) Networks
Freie Software (Apache 2.0 Lizenz)
Verteilt auf eigene Webseite, Github und (früher) Google Code
Teilprojekte teils ausgelagert, teils eingegliedert
Sprache: Python
Umfangreiche Dokumentation zum Framework
aformatik Training & Consulting GmbH & Co. KG 23
Dokumentation zu Keywords („Libdoc“)
Automatische Dokumentation der Keyword-Bibliotheken, ähnlich zu Javadoc
aformatik Training & Consulting GmbH & Co. KG 24
Fahrplan – Agenda
aformatik Training & Consulting GmbH & Co. KG 25
Testdaten-Aufbau
*** Test Cases ***Testfall Eins
Log Hallo Welt!Log Noch mehr Text...
Testfall ZweiLog Und noch mehr Text...Log und Schluss!
hello_world.robot
aformatik Training & Consulting GmbH & Co. KG 26
Testdaten-Aufbau
*** Test Cases ***Testfall Eins
Log Hallo Welt!Log Noch mehr Text...
Testfall ZweiLog Und noch mehr Text...Log und Schluss!
hello_world.robot
aformatik Training & Consulting GmbH & Co. KG 27
Testdaten-Aufbau
*** Test Cases ***Testfall Eins
Log Hallo Welt!Log Noch mehr Text...
Testfall ZweiLog Und noch mehr Text...Log und Schluss!
hello_world.robot
aformatik Training & Consulting GmbH & Co. KG 28
Testdaten-Aufbau
*** Test Cases ***Testfall Eins
Log Hallo Welt!Log Noch mehr Text...
Testfall ZweiLog Und noch mehr Text...Log und Schluss!
hello_world.robot
aformatik Training & Consulting GmbH & Co. KG 29
Testdaten-Aufbau
*** Test Cases ***Testfall Eins
Log Hallo Welt!Log Noch mehr Text...
Testfall ZweiLog Und noch mehr Text...Log und Schluss!
hello_world.robot
aformatik Training & Consulting GmbH & Co. KG 30
Testdaten-Aufbau
*** Test Cases ***Testfall Eins
Log Hallo Welt!Log Noch mehr Text...
Testfall ZweiLog Und noch mehr Text...Log und Schluss!
hello_world.robot
aformatik Training & Consulting GmbH & Co. KG 31
Testdaten-Aufbau
Testsuite
(Text-Cases-Datei)
*** Test Cases ***Testfall Eins
Log Hallo Welt!Log Noch mehr Text...
Testfall ZweiLog Und noch mehr Text...Log und Schluss!
hello_world.robot
aformatik Training & Consulting GmbH & Co. KG 32
Testdaten-Aufbau
Testsuite
(Text-Cases-Datei)
*** Test Cases ***Testfall Eins
Log Hallo Welt!Log Noch mehr Text...
Testfall ZweiLog Und noch mehr Text...Log und Schluss!
hello_world.robot
*** Test Cases ***Noch ein Testfall
Log Hallo Welt!...
hello2.robot
aformatik Training & Consulting GmbH & Co. KG 33
Testsuite
(Text-Cases-Datei)
*** Test Cases ***Testfall Eins
Log Hallo Welt!Log Noch mehr Text...
Testfall ZweiLog Und noch mehr Text...Log und Schluss!
hello_world.robot
*** Test Cases ***Noch ein Testfall
Log Hallo Welt!...
hello2.robot
*** Test Cases ***Noch ein Testfall
Log Hallo Welt!...
hello3.robot
Testdaten-Aufbau
aformatik Training & Consulting GmbH & Co. KG 34
Testdaten-Aufbau
Testsuite
(Text-Cases-Datei)
*** Test Cases ***Testfall Eins
Log Hallo Welt!Log Noch mehr Text...
Testfall ZweiLog Und noch mehr Text...Log und Schluss!
hello_world.robot
*** Test Cases ***Noch ein Testfall
Log Hallo Welt!...
hello2.robot
*** Test Cases ***Noch ein Testfall
Log Hallo Welt!...
hello3.robot
Testsuite
aformatik Training & Consulting GmbH & Co. KG 35
Eingabeformat
„Tabellenartig“
Verschiedene Eingabeformate:
HTML
tab-separated values (TSV)
plain text (mit Doppel-Leerzeichen oder Pipe); .robot, .txt
reStructuredText (reST)
Testfall Eins
Log Hallo Welt!
aformatik Training & Consulting GmbH & Co. KG 36
Eingabeformat
„Tabellenartig“
Verschiedene Eingabeformate:
HTML
tab-separated values (TSV)
plain text (mit Doppel-Leerzeichen oder Pipe); .robot, .txt
reStructuredText (reST)
Testfall Eins
Log Hallo Welt!
Testfall EinsLog Hallo Welt!
aformatik Training & Consulting GmbH & Co. KG 37
Eingabeformat
„Tabellenartig“
Verschiedene Eingabeformate:
HTML
tab-separated values (TSV)
plain text (mit Doppel-Leerzeichen oder Pipe); .robot, .txt
reStructuredText (reST)
Testfall Eins
Log Hallo Welt!
Testfall EinsLog Hallo Welt!
aformatik Training & Consulting GmbH & Co. KG 38
Eingabeformat
„Tabellenartig“
Verschiedene Eingabeformate:
HTML
tab-separated values (TSV)
plain text (mit Doppel-Leerzeichen oder Pipe); .robot, .txt
reStructuredText (reST)
Testfall Eins
Log Hallo Welt!
Testfall EinsLog Hallo Welt!
aformatik Training & Consulting GmbH & Co. KG 39
Eingabeformat
„Tabellenartig“
Verschiedene Eingabeformate:
HTML
tab-separated values (TSV)
plain text (mit Doppel-Leerzeichen oder Pipe); .robot, .txt
reStructuredText (reST)
Testfall Eins
Log Hallo Welt!
Testfall EinsLog Hallo Welt!
}Einfache und
laxe Syntax
(„semicolon free“)
aformatik Training & Consulting GmbH & Co. KG 40
Keywords
Framework stellt grundlegende Keywords bereit
(z.B. „Log“, „Should Be Equal“, …)
Framework liefert zudem Keyword-Bibliotheken, z.B. für
Swing, Selenium(2) (Browserschnittstelle für Webanwendungen)
Datenbank-Zugriff
Telnet, HTTP, SSH,…
Screenshots, Betriebssystemzugriff, Benutzereingaben
Android, IOS
Zusammenfassung von Keywords zu einem neuen Keyword
selbstdefinierte Keywords (mit Python oder Java)
Keyword wirft Exception, falls Test fehlschlägt
aformatik Training & Consulting GmbH & Co. KG 41
Beispiel (1)
*** Settings ***Library SwingLibraryLibrary Screenshot
*** Test Cases ***JFS-Demo-Test
Launch Application de.aformatik.jsf2015.SampleAppStarterSleep 3 seconds
Select Main WindowPush Button Ändere TitelSleep 3 seconds
Select Dialog Titel-EingabeInsert Into TextField OptionPane.textField Herzlich willkommen beim...Sleep 3 seconds
Take Screenshotwelcome-jfs.robot
…
aformatik Training & Consulting GmbH & Co. KG 42
Beispiel (1)
*** Settings ***Library SwingLibraryLibrary Screenshot
*** Test Cases ***JFS-Demo-Test
Launch Application de.aformatik.jsf2015.SampleAppStarterSleep 3 seconds
Select Main WindowPush Button Ändere TitelSleep 3 seconds
Select Dialog Titel-EingabeInsert Into TextField OptionPane.textField Herzlich willkommen beim...Sleep 3 seconds
Take Screenshotwelcome-jfs.robot
…
aformatik Training & Consulting GmbH & Co. KG 43
Beispiel (2)
*** Settings ***
*** Test Cases ***
*** Keywords ***Wähle Titel
[Arguments] ${titel} [Documentation] Wählt einen Titel aus.Push Button Ändere TitelSleep 3 seconds
Select Dialog Titel-EingabeInsert Into TextField OptionPane.textField ${titel}Sleep 3 seconds
Push Button OKSleep 3 seconds
welcome-jfs.robot
……
aformatik Training & Consulting GmbH & Co. KG 44
Beispiel (2)
*** Settings ***
*** Test Cases ***
*** Keywords ***Wähle Titel
[Arguments] ${titel}[Documentation] Wählt einen Titel aus.Push Button Ändere TitelSleep 3 seconds
Select Dialog Titel-EingabeInsert Into TextField OptionPane.textField ${titel}Sleep 3 seconds
Push Button OKSleep 3 seconds
welcome-jfs.robot
……
aformatik Training & Consulting GmbH & Co. KG 45
Beispiel (2)
*** Settings ***
*** Test Cases ***
*** Keywords ***Wähle Titel
Wähle Bild[Arguments] ${dateiname}Push Button Wähle BildSleep 3 secondsChoose From File Chooser ${dateiname}
welcome-jfs.robot
……
…
aformatik Training & Consulting GmbH & Co. KG 46
Beispiel (2)
*** Settings ***Library SwingLibraryLibrary Screenshot
*** Test Cases ***JFS-Demo-Test
Launch Application de.aformatik.jsf2015.SampleAppStarterSleep 3 seconds
Select Main WindowWähle Titel Herzlich willkommen beim...
Select Main WindowWähle Bild jfslogo.jpg
Take Screenshot
welcome-jfs.robot
…
aformatik Training & Consulting GmbH & Co. KG 47
Beispiel (3)
*** Keywords ***Wähle Titel
[Arguments] ${titel}[Documentation] Wählt einen Titel aus.Push Button Ändere Titel
Titel muss "${titel}" sein[Documentation] Überprüft den Titel.${actual_title}= Get Selected Window TitleShould Be Equal ${titel} ${actual_title}
welcome-jfs.robot
…
…
aformatik Training & Consulting GmbH & Co. KG 48
Beispiel (3)
*** Test Cases ***JFS-Demo-Test
Launch Application de.aformatik.jsf2015.SampleAppStarterSleep 3 seconds
Select Main WindowWähle Titel Herzlich willkommen beim...
Select Main WindowTitel muss "Herzlich willkommen beim..." sein
Select Main WindowWähle Bild jfslogo.jpg
Take Screenshot…
…
welcome-jfs.robot
aformatik Training & Consulting GmbH & Co. KG 49
Beispiel (4)
*** Settings ***Library SwingLibraryLibrary Screenshot
*** Variables ***${DELAY}= 3 seconds
*** Test Cases ***JFS-Demo-Test
Launch Application de.aformatik.jsf2015.SampleAppStarterSleep 3 seconds
Select Main Window
welcome-jfs.robot
…
aformatik Training & Consulting GmbH & Co. KG 50
Beispiel (4)
*** Settings ***Library SwingLibraryLibrary Screenshot
*** Variables ***${DELAY}= 3 seconds
*** Test Cases ***JFS-Demo-Test
Launch Application de.aformatik.jsf2015.SampleAppStarterSleep ${DELAY}
Select Main Window
welcome-jfs.robot
…
aformatik Training & Consulting GmbH & Co. KG 51
Fahrplan – Agenda
aformatik Training & Consulting GmbH & Co. KG 52
Aufbau einer Test-Cases-Datei
*** Settings ***
*** Variables ***
*** Test Cases ***
*** Keywords ***
welcome-jfs.robot
……
……
aformatik Training & Consulting GmbH & Co. KG 53
Testdaten-Aufbau - Revisited
*** Test Cases ***Testfall Eins
Log Hallo Welt!Log Noch mehr Text...
Testfall ZweiLog Und noch mehr Text...Log und Schluss!
hello_world.robot
*** Test Cases ***Noch ein Testfall
Log Hallo Welt!...
hello2.robot
*** Test Cases ***Noch ein Testfall
Log Hallo Welt!...
hello3.robot
Testsuite
aformatik Training & Consulting GmbH & Co. KG 54
Testdaten-Aufbau - Revisited
*** Test Cases ***Testfall Eins
Log Hallo Welt!Log Noch mehr Text...
Testfall ZweiLog Und noch mehr Text...Log und Schluss!
01__hello_world.robot
*** Test Cases ***Noch ein Testfall
Log Hallo Welt!...
02__hello2.robot
*** Test Cases ***Noch ein Testfall
Log Hallo Welt!...
03__hello3.robot
Testsuite
aformatik Training & Consulting GmbH & Co. KG 55
Testdaten-Aufbau - Revisited
*** Test Cases ***Testfall Eins
Log Hallo Welt!Log Noch mehr Text...
Testfall ZweiLog Und noch mehr Text...Log und Schluss!
01__hello_world.robot
*** Test Cases ***Noch ein Testfall
Log Hallo Welt!...
02__hello2.robot
*** Test Cases ***Noch ein Testfall
Log Hallo Welt!...
03__hello3.robot
Testsuite
*** Settings ***Suite Setup …Suite Teardown …
__init__.robot
aformatik Training & Consulting GmbH & Co. KG 56
Syntax-Besonderheiten
Keywords (und Variablen, etc.) sind case-insensitive und
(einzelne) Spaces and Underscores werden ignoriert:
Beim Aufruf eines Keywords können „Given”, „When“, „Then“, „And“ und „But“
hinzugefügt werden (ohne Auswirkung).
(Ermöglicht „Behavior Driven Development“-Stil)
Mehr als 2 Leerzeichen werden wie zwei Leerzeichen behandelt
Zeilenumbruch:
Wähle Titel Herzlich willkommen beim...
wäH le_ti_tel Herzlich willkommen beim...
Wähle Titel... Herzlich willkommen beim...
aformatik Training & Consulting GmbH & Co. KG 57
SwingLibrary
Es muß zuerst ein Kontext festgelegt werden:
z.B. ,
In diesem Kontextes werden Komponenten identifiziert durch
ihren Index im Container (nicht zu empfehlen),
ihren Namen,
ihre Beschriftung (falls vorhanden, z.B. bei Buttons).
Hilfsmittel:
JSpy
Ctrl+Shift+F1 (Swing)
Als Kontext dürfen leider nur bestimmte Container dienen:
Select Dialog Titel-EingabeSelect Main Window
List Components in Context
aformatik Training & Consulting GmbH & Co. KG 58
Entwicklungsumgebung
RIDE („Robot-IDE“)
Plugin/Syntax-Highlighting für
Eclipse,
Notepad++, Vim, Emacs, …
aformatik Training & Consulting GmbH & Co. KG 59
Fahrplan – Agenda
aformatik Training & Consulting GmbH & Co. KG 60
Beispiel (1)
*** Settings ***Library de.aformatik.robotlib.MyRobotLibrary
welcome-jfs.robot
aformatik Training & Consulting GmbH & Co. KG 61
Beispiel (1)
*** Settings ***Library de.aformatik.robotlib.MyRobotLibrary
welcome-jfs.robot
public class MyRobotLibrary extends AnnotationLibrary {public MyRobotLibrary() {super(Arrays.asList("de/aformatik/robotlib/kw/*"));
}}
MyRobotLibrary.java
aformatik Training & Consulting GmbH & Co. KG 62
Beispiel (1)
*** Settings ***Library de.aformatik.robotlib.MyRobotLibrary
welcome-jfs.robot
public class MyRobotLibrary extends AnnotationLibrary {public MyRobotLibrary() {super(Arrays.asList("de/aformatik/robotlib/kw/*"));
}}
MyRobotLibrary.java
@RobotKeywordspublic class TreeTableKeywords {
@RobotKeyword("Expands a node in my tree table.")@ArgumentNames({ "nodeIdentifier" })public void expandMyTreeTableNode(String nodeIdentifier) throws Exception {
…de/aformatik/robotlib/kw/TreeTableKeywords.java
aformatik Training & Consulting GmbH & Co. KG 63
@RobotKeywordspublic class TreeTableKeywords {
@RobotKeyword("Expands a node in my tree table.")@ArgumentNames({ "nodeIdentifier" })public void expandMyTreeTableNode(String nodeIdentifier) throws Exception {
Beispiel (1)
…de/aformatik/robotlib/kw/TreeTableKeywords.java
aformatik Training & Consulting GmbH & Co. KG 64
@RobotKeywordspublic class TreeTableKeywords {
@RobotKeyword("Expands a node in my tree table.")@ArgumentNames({ "nodeIdentifier" })public void expandMyTreeTableNode(String nodeIdentifier) throws Exception {
Beispiel (1)
…de/aformatik/robotlib/kw/TreeTableKeywords.java
*** Test Cases ***JFS-Demo-Test
Expand My TreeTable Node Historie|Herzlich willkommen beim...
welcome-jfs.robot
…
…
aformatik Training & Consulting GmbH & Co. KG 65
@RobotKeywordspublic class TreeTableKeywords {
@RobotKeyword("Expands a node in my tree table.")@ArgumentNames({ "nodeIdentifier" })public void expandMyTreeTableNode(String nodeIdentifier) throws Exception {
System.out.println("*INFO* " + "expandMyTreeTableNode: " + nodeIdentifier);
ContainerOperator mainframe = (ContainerOperator) Context.getContext();
JRootPane rootPane = (JRootPane) mainframe.getComponent(0);JLayeredPane layeredPane = (JLayeredPane) rootPane.getComponent(1);JPanel contentPane = (JPanel) layeredPane.getComponent(0);JScrollPane scrollPane = (JScrollPane) contentPane.getComponent(0);JViewport viewport = (JViewport) scrollPane.getComponent(0);JXTreeTable treetable = (JXTreeTable) viewport.getComponent(0);JTree theTree = (JTree) treetable.getCellRenderer(0, 0);
Beispiel (1)
…de/aformatik/robotlib/kw/TreeTableKeywords.java
aformatik Training & Consulting GmbH & Co. KG 66
@RobotKeywordspublic class TreeTableKeywords {
@RobotKeyword("Expands a node in my tree table.")@ArgumentNames({ "nodeIdentifier" })public void expandMyTreeTableNode(String nodeIdentifier) throws Exception {
System.out.println("*INFO* " + "expandMyTreeTableNode: " + nodeIdentifier);
ContainerOperator mainframe = (ContainerOperator) Context.getContext();
JTree theTree = (JTree) treetable.getCellRenderer(0, 0);
JTreeOperator jemmyOperator = new JTreeOperator(theTree);TreeOperator robotOperator = new TreeOperator(jemmyOperator);
robotOperator.expand(nodeIdentifier);}
Beispiel (1)
…
de/aformatik/robotlib/kw/TreeTableKeywords.java
aformatik Training & Consulting GmbH & Co. KG 67
@RobotKeywordspublic class TreeTableKeywords {
@RobotKeyword("Expands a node in my tree table.")@ArgumentNames({ "nodeIdentifier" })public void expandMyTreeTableNode(String nodeIdentifier) throws Exception {
System.out.println("*INFO* " + "expandMyTreeTableNode: " + nodeIdentifier);
ContainerOperator mainframe = (ContainerOperator) Context.getContext();
JTree theTree = (JTree) treetable.getCellRenderer(0, 0);
JTreeOperator jemmyOperator = new JTreeOperator(theTree);TreeOperator robotOperator = new TreeOperator(jemmyOperator);
robotOperator.expand(nodeIdentifier);}
Beispiel (1)
…
de/aformatik/robotlib/kw/TreeTableKeywords.java
aformatik Training & Consulting GmbH & Co. KG 68
API / Kommunikation mit dem Framework
Expand My TreeTable Node Historie|Herzlich willkommen beim...
${actual_title}= Get Selected Window Title
welcome-jfs.robot
public void expandMyTreeTableNode(String nodeIdentifier) throws Exception {
System.out.println("*INFO* " + "expandMyTreeTableNode: " + nodeIdentifier);
ContainerOperator mainframe = (ContainerOperator) Context.getContext();
TreeTableKeywords.java
…
aformatik Training & Consulting GmbH & Co. KG 69
API / Kommunikation mit dem Framework
Expand My TreeTable Node Historie|Herzlich willkommen beim...
${actual_title}= Get Selected Window Titlewelcome-jfs.robot
…
public void expandMyTreeTableNode(String nodeIdentifier) throws Exception {
System.out.println("*INFO* " + "expandMyTreeTableNode: " + nodeIdentifier);
ContainerOperator mainframe = (ContainerOperator) Context.getContext();
…TreeTableKeywords.java
aformatik Training & Consulting GmbH & Co. KG 70
public class TestData {private final String nodeIdentifier = "Historie|Herzlich willkommen beim...";
public String getNodeIdentifier() {return this.nodeIdentifier;
}}
API - Rückgabewerte
${testdata}= Create Test Data
Expand My TreeTable Node ${testdata.getNodeIdentifier()}
welcome-jfs.robot
@RobotKeyword("Creates a pojo!")public TestData createTestData() {return new TestData();
}PojoExampleKeywords.java
TestData.java
aformatik Training & Consulting GmbH & Co. KG 71
public class TestData {private final String nodeIdentifier = "Historie|Herzlich willkommen beim...";
public String getNodeIdentifier() {return this.nodeIdentifier;
}}
API - Rückgabewerte
${testdata}= Create Test Data
Expand My TreeTable Node ${testdata.getNodeIdentifier()}
welcome-jfs.robot
@RobotKeyword("Creates a pojo!")public TestData createTestData() {return new TestData();
}PojoExampleKeywords.java
TestData.java
aformatik Training & Consulting GmbH & Co. KG 72
public class MyRobotLibrary extends AnnotationLibrary {public static final String ROBOT_LIBRARY_SCOPE = "GLOBAL"; public MyRobotLibrary() {super(Arrays.asList("de/aformatik/robotlib/kw/*"));
}}
API - Klassenkonstanten
MyRobotLibrary.java
aformatik Training & Consulting GmbH & Co. KG 73
public class MyRobotLibrary extends AnnotationLibrary {public static final String ROBOT_LIBRARY_SCOPE = "GLOBAL"; public MyRobotLibrary() {super(Arrays.asList("de/aformatik/robotlib/kw/*"));
}}
JavalibCore
MyRobotLibrary.java
@Autowiredprivate TreeTableKeywords treeTableKeywords;
@RobotKeyword("Processes a pojo!")@ArgumentNames({ "testData" })public void processTestData(TestData testData) throws Exception { new TreeTableKeywords().expandMyTreeTableNode(testData.getNodeIdentifier());
}
de/aformatik/robotlib/kw/TreeTableKeywords.java
aformatik Training & Consulting GmbH & Co. KG 74
public class MyRobotLibrary extends AnnotationLibrary {public static final String ROBOT_LIBRARY_SCOPE = "GLOBAL"; public MyRobotLibrary() {super(Arrays.asList("de/aformatik/robotlib/kw/*"));
}}
JavalibCore
MyRobotLibrary.java
@Autowiredprivate TreeTableKeywords treeTableKeywords;
@RobotKeyword("Processes a pojo!")@ArgumentNames({ "testData" })public void processTestData(TestData testData) throws Exception {this.treeTableKeywords .expandMyTreeTableNode(testData.getNodeIdentifier());
}
de/aformatik/robotlib/kw/TreeTableKeywords.java
aformatik Training & Consulting GmbH & Co. KG 75
Fragen / Kontakt / Download
aformatik-Stand (Nr. 5) im Foyer vor dem Hegel Saal
Testsuite verfügbar unter:
http://www.aformatik.de/training/beispielprogramme.html
Homepage: http://www.aformatik.de
aformatik Training & Consulting GmbH & Co. KG 76
Quellen
http://robotframework.org
Pekka Laukkanen: Data-Driven and Keyword-Driven Test Automation Frameworks,
2006, Master Thesis, Helsinki University of Technology
http://www.heise.de/developer/artikel/Automatisierte-Tests-mit-dem-Robot-Framework-
1834917.html, 2013
Top Related