SlideShare a Scribd company logo
1 of 24
Download to read offline
Copyright (c) 2014 Job and Esther Technologies, Inc. All Rights reserved.
1
Automated testing of mobile
applications on multiple
platforms
Markku Kero / Job and Esther Technologies
June 2014 / Softech.ph
Copyright (c) 2014 Job and Esther Technologies, Inc. All Rights reserved.
2
What is the
meaning of “Mobile
UI Automation”?
Copyright (c) 2014 Job and Esther Technologies, Inc. All Rights reserved.
3
Traditional QA procedure
… #100 … #1000 … hours and hours of testing … for each release …
Copyright (c) 2014 Job and Esther Technologies, Inc. All Rights reserved.
4
UI Automation
Copyright (c) 2014 Job and Esther Technologies, Inc. All Rights reserved.
5
import com.android.uiautomator.core.*;
import com.android.uiautomator.testrunner.*;
public class MyTestCase extends UiAutomatorTestCase
{
public void testnumberone() throws UiObjectNotFoundException,
android.os.RemoteException
{
getUiDevice().wakeUp();
getUiDevice().pressEnter();
UiObject textfield = new UiObject(new UiSelector().className("android.widget.EditText"));
textfield.clearTextField();
textfield.setText("This is really cool");
UiObject button = new UiObject(new UiSelector().className("android.widget.Button"));
button.click();
UiObject textview = new UiObject(new UiSelector().className("android.widget.TextView").index(1));
assertEquals("Text is incorrect", "This is really cool", textview.getText());
}
}
$ <apache-ant-dir>/bin/ant build
$ <adt-dir>/sdk/platform-tools adb push bin/MyTestProgram.jar /data/local/tmp
$ <adt-dir>/sdk/platform-tools/adb shell uiautomator runtest MyTestProgram.jar 
-c MyTestCase
1. Write the test program
2. Run the tests
3. Read the report
Copyright (c) 2014 Job and Esther Technologies, Inc. All Rights reserved.
6
With automation, full test of an
app will no longer take hours
but minutes
The tests are easily repeated
for every release
Copyright (c) 2014 Job and Esther Technologies, Inc. All Rights reserved.
7
Perfect, right?
Copyright (c) 2014 Job and Esther Technologies, Inc. All Rights reserved.
.. FOR EACH PLATFORM
BUT TEST PROGRAMS NEED TO BE WRITTEN ..
Copyright (c) 2014 Job and Esther Technologies, Inc. All Rights reserved.
MANY MOBILE PLATFORMS HAVE BUILT-IN CAPABILITIES
FOR USER INTERFACE AUTOMATION
UI Automation
JavaScript
UIAutomator
Java
Copyright (c) 2014 Job and Esther Technologies, Inc. All Rights reserved.
Copyright (c) 2014 Job and Esther Technologies, Inc. All Rights reserved.
Copyright (c) 2014 Job and Esther Technologies, Inc. All Rights reserved.
public class Main : LayerWidget, EventReceiver
{
TextInputWidget input;
LabelWidget label;
public void initialize() {
base.initialize();
var box = BoxWidget.vertical().set_spacing(px("1mm"))
.set_margin(px("1mm"));
box.add(input = TextInputWidget.instance());
input.set_widget_id("input");
box.add(label = LabelWidget.for_string("(enter text)")
.set_font(Font.instance("7mm")));
box.add(ButtonWidget.for_string("Click me").set_event("clickme")
.set_widget_id("clickme"));
add(CanvasWidget.for_color(Color.instance("#AAAAAA")));
add(box);
set_draw_color(Color.instance("black"));
}
public void cleanup() {
base.cleanup();
input = null;
label = null;
}
public void on_event(Object o) {
label.set_text(input.get_text());
}
}
Copyright (c) 2014 Job and Esther Technologies, Inc. All Rights reserved.
// standard iOS UI Automation framework initialization
var target = UIATarget.localTarget();
var app = target.frontMostApp();
var window = app.mainWindow();
// Set the contents of the text input field
// to string "Something"
window.textFields()["input"].setValue("Something");
// Click the "Click me" button
window.buttons()["clickme"].tap();
UI Automation test script for iOS
Copyright (c) 2014 Job and Esther Technologies, Inc. All Rights reserved.
Copyright (c) 2014 Job and Esther Technologies, Inc. All Rights reserved.
Copyright (c) 2014 Job and Esther Technologies, Inc. All Rights reserved.
import com.android.uiautomator.core.*;
import com.android.uiautomator.testrunner.*;
public class MyTestCase extends UiAutomatorTestCase
{
public void testSample() throws
UiObjectNotFoundException,
android.os.RemoteException
{
UiObject textfield = new UiObject(new UiSelector()
.description("input"));
textfield.clearTextField();
textfield.setText("Something");
UiObject button = new UiObject(new UiSelector()
.description("clickme"));
button.click();
}
}
UIAutomator test script for Android
Copyright (c) 2014 Job and Esther Technologies, Inc. All Rights reserved.
public class MyTestCase extends UiAutomatorTestCase
{
public void testSample() throws
UiObjectNotFoundException,
android.os.RemoteException
{
UiObject textfield = new UiObject(new UiSelector()
.description("input"));
textfield.clearTextField();
textfield.setText("Something");
UiObject button = new UiObject(new UiSelector()
.description("clickme"));
button.click();
}
}
var target = UIATarget.localTarget();
var app = target.frontMostApp();
var window = app.mainWindow();
window.textFields()["input"].setValue("Something");
window.buttons()["clickme"].tap();
SAME PROGRAM WRITTEN TWICE ..
.. SEEMS LIKE A WASTE OF EFFORT
Copyright (c) 2014 Job and Esther Technologies, Inc. All Rights reserved.
BUT TWICE WOULD
NOT BE ENOUGH
Copyright (c) 2014 Job and Esther Technologies, Inc. All Rights reserved.
19
Programming Language
Translator
Copyright (c) 2014 Job and Esther Technologies, Inc. All Rights reserved.
class MyTestCase : UIAutomatorTestCase
{
public void execute() {
get_text_field("input").set_text("Something");
get_button("clickme").click();
}
}
package sample;
public class MyTestCase extends com.eqela.libuiautomator.UIAutomatorTestCase
{
@Override public void execute() {
((com.eqela.libuiautomator.UIAutomatorTestCase)this).get_text_field(eq.api.St
ringStatic.eq_api_StringStatic_for_strptr("input")).set_text(eq.api.StringSta
tic.eq_api_StringStatic_for_strptr("Something"));
((com.eqela.libuiautomator.UIAutomatorTestCase)this).get_button(eq.api.String
Static.eq_api_StringStatic_for_strptr("clickme")).click();
}
}
sample.MyTestCase=function(){
com.eqela.libuiautomator.UIAutomatorTestCase.call(this);
};
// ...
P.execute=function(){
com.eqela.libuiautomator.UIAutomatorTestCase.prototype.get_text_field.call(t
his,eq.api.StringStatic.for_strptr("input")).set_text(eq.api.StringStatic.fo
r_strptr("Something"));
com.eqela.libuiautomator.UIAutomatorTestCase.prototype.get_button.call(this,
eq.api.StringStatic.for_strptr("clickme")).click();
}
Copyright (c) 2014 Job and Esther Technologies, Inc. All Rights reserved.
public class UIAutomatorTextFieldAndroid : UIAutomatorTextField
{
public static UIAutomatorTextFieldAndroid for_id(String id) {
return(new UIAutomatorTextFieldAndroid().initialize(id));
}
ptr field;
public UIAutomatorTextFieldAndroid initialize(String id) {
ptr ff;
var ip = id.to_strptr();
embed {{{
ff = new UiObject(new UiSelector().description(ip));
}}}
if(ff == null) {
return(null);
}
field = ff;
return(this);
}
public void set_text(String text) {
var ff = field;
var tp = text.to_strptr();
embed {{{
ff.clearTextField();
ff.setText(tp);
}}}
}
}
Copyright (c) 2014 Job and Esther Technologies, Inc. All Rights reserved.
public class UIAutomatorTextFieldIOS : UIAutomatorTextField
{
public static UIAutomatorTextFieldIOS for_id(String id) {
return(new UIAutomatorTextFieldIOS().initialize(id));
}
ptr field;
public UIAutomatorTextFieldIOS initialize(String id) {
ptr ff;
var ip = id.to_strptr();
embed {{{
ff = window.textfields()[ip];
}}}
if(ff == null) {
return(null);
}
field = ff;
return(this);
}
public void set_text(String text) {
var ff = field;
var tp = text.to_strptr();
embed {{{
ff.setValue(tp);
}}}
}
}
Copyright (c) 2014 Job and Esther Technologies, Inc. All Rights reserved.
public class MyTestCase extends UiAutomatorTestCase
{
public void testSample() throws
UiObjectNotFoundException,
android.os.RemoteException
{
UiObject textfield = new UiObject(new UiSelector()
.description("input"));
textfield.clearTextField();
textfield.setText("Something");
UiObject button = new UiObject(new UiSelector()
.description("clickme"));
button.click();
}
}
var target = UIATarget.localTarget();
var app = target.frontMostApp();
var window = app.mainWindow();
window.textFields()["input"].setValue("Something");
window.buttons()["clickme"].tap();
NO WASTED EFFORT. WRITE THE SCRIPT ONLY ONCE
class MyTestCase : UIAutomatorTestCase
{
public void execute() {
get_text_field("input").set_text("Something");
get_button("clickme").click();
}
}
Copyright (c) 2014 Job and Esther Technologies, Inc. All Rights reserved.
24
Ask for more information
markku.kero@jobandesther.com
www.jobandesther.com
www.eqela.com

More Related Content

Viewers also liked

Eqela Core API and Utilities
Eqela Core API and UtilitiesEqela Core API and Utilities
Eqela Core API and Utilities
jobandesther
 

Viewers also liked (6)

Optimized Cross Platform Development
Optimized Cross Platform DevelopmentOptimized Cross Platform Development
Optimized Cross Platform Development
 
Eqela Core API and Utilities
Eqela Core API and UtilitiesEqela Core API and Utilities
Eqela Core API and Utilities
 
Eqela Web Development with Database Connectivity
Eqela Web Development with Database ConnectivityEqela Web Development with Database Connectivity
Eqela Web Development with Database Connectivity
 
Mobile Game Development With Eqela (March 2014)
Mobile Game Development With Eqela (March 2014)Mobile Game Development With Eqela (March 2014)
Mobile Game Development With Eqela (March 2014)
 
Mobile Game Development Using Eqela
Mobile Game Development Using EqelaMobile Game Development Using Eqela
Mobile Game Development Using Eqela
 
Pengertian,kekurangan dan kelebihan,dan menginstallnya Prestashop,Opencart,SM...
Pengertian,kekurangan dan kelebihan,dan menginstallnya Prestashop,Opencart,SM...Pengertian,kekurangan dan kelebihan,dan menginstallnya Prestashop,Opencart,SM...
Pengertian,kekurangan dan kelebihan,dan menginstallnya Prestashop,Opencart,SM...
 

Similar to Automated testing of mobile applications on multiple platforms

2011 py con
2011 py con2011 py con
2011 py con
Eing Ong
 
Unit & Automation Testing in Android - Stanislav Gatsev, Melon
Unit & Automation Testing in Android - Stanislav Gatsev, MelonUnit & Automation Testing in Android - Stanislav Gatsev, Melon
Unit & Automation Testing in Android - Stanislav Gatsev, Melon
beITconference
 
Use Eclipse technologies to build a modern embedded IDE
Use Eclipse technologies to build a modern embedded IDEUse Eclipse technologies to build a modern embedded IDE
Use Eclipse technologies to build a modern embedded IDE
Benjamin Cabé
 

Similar to Automated testing of mobile applications on multiple platforms (20)

Google Web Toolkit
Google Web ToolkitGoogle Web Toolkit
Google Web Toolkit
 
What do you mean it needs to be Java based? How jython saved the day.
What do you mean it needs to be Java based? How jython saved the day.What do you mean it needs to be Java based? How jython saved the day.
What do you mean it needs to be Java based? How jython saved the day.
 
mobl
moblmobl
mobl
 
2011 py con
2011 py con2011 py con
2011 py con
 
Imagine a world without mocks
Imagine a world without mocksImagine a world without mocks
Imagine a world without mocks
 
Unit & Automation Testing in Android - Stanislav Gatsev, Melon
Unit & Automation Testing in Android - Stanislav Gatsev, MelonUnit & Automation Testing in Android - Stanislav Gatsev, Melon
Unit & Automation Testing in Android - Stanislav Gatsev, Melon
 
Security Testing
Security TestingSecurity Testing
Security Testing
 
Vaadin 7 CN
Vaadin 7 CNVaadin 7 CN
Vaadin 7 CN
 
GDG GeorgeTown Devfest 2014 Presentation: Android Wear: A Developer's Perspec...
GDG GeorgeTown Devfest 2014 Presentation: Android Wear: A Developer's Perspec...GDG GeorgeTown Devfest 2014 Presentation: Android Wear: A Developer's Perspec...
GDG GeorgeTown Devfest 2014 Presentation: Android Wear: A Developer's Perspec...
 
100% Code Coverage - TDD mit Java EE
100% Code Coverage - TDD mit Java EE100% Code Coverage - TDD mit Java EE
100% Code Coverage - TDD mit Java EE
 
Android101 : Introduksjon til Android
Android101 : Introduksjon til AndroidAndroid101 : Introduksjon til Android
Android101 : Introduksjon til Android
 
2008 - TechDays PT: WCF, JSON and AJAX for performance and manageability
2008 - TechDays PT: WCF, JSON and AJAX for performance and manageability2008 - TechDays PT: WCF, JSON and AJAX for performance and manageability
2008 - TechDays PT: WCF, JSON and AJAX for performance and manageability
 
Mobile HTML, CSS, and JavaScript
Mobile HTML, CSS, and JavaScriptMobile HTML, CSS, and JavaScript
Mobile HTML, CSS, and JavaScript
 
2012 star west-t10
2012 star west-t102012 star west-t10
2012 star west-t10
 
Day 5
Day 5Day 5
Day 5
 
J2ME Lwuit, Storage & Connections (Ft Prasanjit Dey)
J2ME Lwuit, Storage & Connections (Ft   Prasanjit Dey)J2ME Lwuit, Storage & Connections (Ft   Prasanjit Dey)
J2ME Lwuit, Storage & Connections (Ft Prasanjit Dey)
 
How React Native, Appium and me made each other shine @Frontmania 16-11-2018
How React Native, Appium and me made each other shine @Frontmania 16-11-2018How React Native, Appium and me made each other shine @Frontmania 16-11-2018
How React Native, Appium and me made each other shine @Frontmania 16-11-2018
 
Testing with VS2010 - A Bugs Life
Testing with VS2010 - A Bugs LifeTesting with VS2010 - A Bugs Life
Testing with VS2010 - A Bugs Life
 
Use Eclipse technologies to build a modern embedded IDE
Use Eclipse technologies to build a modern embedded IDEUse Eclipse technologies to build a modern embedded IDE
Use Eclipse technologies to build a modern embedded IDE
 
Scala for Test Automation
Scala for Test AutomationScala for Test Automation
Scala for Test Automation
 

Recently uploaded

TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
mohitmore19
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
Health
 

Recently uploaded (20)

Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
BUS PASS MANGEMENT SYSTEM USING PHP.pptx
BUS PASS MANGEMENT SYSTEM USING PHP.pptxBUS PASS MANGEMENT SYSTEM USING PHP.pptx
BUS PASS MANGEMENT SYSTEM USING PHP.pptx
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdf
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 

Automated testing of mobile applications on multiple platforms

  • 1. Copyright (c) 2014 Job and Esther Technologies, Inc. All Rights reserved. 1 Automated testing of mobile applications on multiple platforms Markku Kero / Job and Esther Technologies June 2014 / Softech.ph
  • 2. Copyright (c) 2014 Job and Esther Technologies, Inc. All Rights reserved. 2 What is the meaning of “Mobile UI Automation”?
  • 3. Copyright (c) 2014 Job and Esther Technologies, Inc. All Rights reserved. 3 Traditional QA procedure … #100 … #1000 … hours and hours of testing … for each release …
  • 4. Copyright (c) 2014 Job and Esther Technologies, Inc. All Rights reserved. 4 UI Automation
  • 5. Copyright (c) 2014 Job and Esther Technologies, Inc. All Rights reserved. 5 import com.android.uiautomator.core.*; import com.android.uiautomator.testrunner.*; public class MyTestCase extends UiAutomatorTestCase { public void testnumberone() throws UiObjectNotFoundException, android.os.RemoteException { getUiDevice().wakeUp(); getUiDevice().pressEnter(); UiObject textfield = new UiObject(new UiSelector().className("android.widget.EditText")); textfield.clearTextField(); textfield.setText("This is really cool"); UiObject button = new UiObject(new UiSelector().className("android.widget.Button")); button.click(); UiObject textview = new UiObject(new UiSelector().className("android.widget.TextView").index(1)); assertEquals("Text is incorrect", "This is really cool", textview.getText()); } } $ <apache-ant-dir>/bin/ant build $ <adt-dir>/sdk/platform-tools adb push bin/MyTestProgram.jar /data/local/tmp $ <adt-dir>/sdk/platform-tools/adb shell uiautomator runtest MyTestProgram.jar -c MyTestCase 1. Write the test program 2. Run the tests 3. Read the report
  • 6. Copyright (c) 2014 Job and Esther Technologies, Inc. All Rights reserved. 6 With automation, full test of an app will no longer take hours but minutes The tests are easily repeated for every release
  • 7. Copyright (c) 2014 Job and Esther Technologies, Inc. All Rights reserved. 7 Perfect, right?
  • 8. Copyright (c) 2014 Job and Esther Technologies, Inc. All Rights reserved. .. FOR EACH PLATFORM BUT TEST PROGRAMS NEED TO BE WRITTEN ..
  • 9. Copyright (c) 2014 Job and Esther Technologies, Inc. All Rights reserved. MANY MOBILE PLATFORMS HAVE BUILT-IN CAPABILITIES FOR USER INTERFACE AUTOMATION UI Automation JavaScript UIAutomator Java
  • 10. Copyright (c) 2014 Job and Esther Technologies, Inc. All Rights reserved.
  • 11. Copyright (c) 2014 Job and Esther Technologies, Inc. All Rights reserved.
  • 12. Copyright (c) 2014 Job and Esther Technologies, Inc. All Rights reserved. public class Main : LayerWidget, EventReceiver { TextInputWidget input; LabelWidget label; public void initialize() { base.initialize(); var box = BoxWidget.vertical().set_spacing(px("1mm")) .set_margin(px("1mm")); box.add(input = TextInputWidget.instance()); input.set_widget_id("input"); box.add(label = LabelWidget.for_string("(enter text)") .set_font(Font.instance("7mm"))); box.add(ButtonWidget.for_string("Click me").set_event("clickme") .set_widget_id("clickme")); add(CanvasWidget.for_color(Color.instance("#AAAAAA"))); add(box); set_draw_color(Color.instance("black")); } public void cleanup() { base.cleanup(); input = null; label = null; } public void on_event(Object o) { label.set_text(input.get_text()); } }
  • 13. Copyright (c) 2014 Job and Esther Technologies, Inc. All Rights reserved. // standard iOS UI Automation framework initialization var target = UIATarget.localTarget(); var app = target.frontMostApp(); var window = app.mainWindow(); // Set the contents of the text input field // to string "Something" window.textFields()["input"].setValue("Something"); // Click the "Click me" button window.buttons()["clickme"].tap(); UI Automation test script for iOS
  • 14. Copyright (c) 2014 Job and Esther Technologies, Inc. All Rights reserved.
  • 15. Copyright (c) 2014 Job and Esther Technologies, Inc. All Rights reserved.
  • 16. Copyright (c) 2014 Job and Esther Technologies, Inc. All Rights reserved. import com.android.uiautomator.core.*; import com.android.uiautomator.testrunner.*; public class MyTestCase extends UiAutomatorTestCase { public void testSample() throws UiObjectNotFoundException, android.os.RemoteException { UiObject textfield = new UiObject(new UiSelector() .description("input")); textfield.clearTextField(); textfield.setText("Something"); UiObject button = new UiObject(new UiSelector() .description("clickme")); button.click(); } } UIAutomator test script for Android
  • 17. Copyright (c) 2014 Job and Esther Technologies, Inc. All Rights reserved. public class MyTestCase extends UiAutomatorTestCase { public void testSample() throws UiObjectNotFoundException, android.os.RemoteException { UiObject textfield = new UiObject(new UiSelector() .description("input")); textfield.clearTextField(); textfield.setText("Something"); UiObject button = new UiObject(new UiSelector() .description("clickme")); button.click(); } } var target = UIATarget.localTarget(); var app = target.frontMostApp(); var window = app.mainWindow(); window.textFields()["input"].setValue("Something"); window.buttons()["clickme"].tap(); SAME PROGRAM WRITTEN TWICE .. .. SEEMS LIKE A WASTE OF EFFORT
  • 18. Copyright (c) 2014 Job and Esther Technologies, Inc. All Rights reserved. BUT TWICE WOULD NOT BE ENOUGH
  • 19. Copyright (c) 2014 Job and Esther Technologies, Inc. All Rights reserved. 19 Programming Language Translator
  • 20. Copyright (c) 2014 Job and Esther Technologies, Inc. All Rights reserved. class MyTestCase : UIAutomatorTestCase { public void execute() { get_text_field("input").set_text("Something"); get_button("clickme").click(); } } package sample; public class MyTestCase extends com.eqela.libuiautomator.UIAutomatorTestCase { @Override public void execute() { ((com.eqela.libuiautomator.UIAutomatorTestCase)this).get_text_field(eq.api.St ringStatic.eq_api_StringStatic_for_strptr("input")).set_text(eq.api.StringSta tic.eq_api_StringStatic_for_strptr("Something")); ((com.eqela.libuiautomator.UIAutomatorTestCase)this).get_button(eq.api.String Static.eq_api_StringStatic_for_strptr("clickme")).click(); } } sample.MyTestCase=function(){ com.eqela.libuiautomator.UIAutomatorTestCase.call(this); }; // ... P.execute=function(){ com.eqela.libuiautomator.UIAutomatorTestCase.prototype.get_text_field.call(t his,eq.api.StringStatic.for_strptr("input")).set_text(eq.api.StringStatic.fo r_strptr("Something")); com.eqela.libuiautomator.UIAutomatorTestCase.prototype.get_button.call(this, eq.api.StringStatic.for_strptr("clickme")).click(); }
  • 21. Copyright (c) 2014 Job and Esther Technologies, Inc. All Rights reserved. public class UIAutomatorTextFieldAndroid : UIAutomatorTextField { public static UIAutomatorTextFieldAndroid for_id(String id) { return(new UIAutomatorTextFieldAndroid().initialize(id)); } ptr field; public UIAutomatorTextFieldAndroid initialize(String id) { ptr ff; var ip = id.to_strptr(); embed {{{ ff = new UiObject(new UiSelector().description(ip)); }}} if(ff == null) { return(null); } field = ff; return(this); } public void set_text(String text) { var ff = field; var tp = text.to_strptr(); embed {{{ ff.clearTextField(); ff.setText(tp); }}} } }
  • 22. Copyright (c) 2014 Job and Esther Technologies, Inc. All Rights reserved. public class UIAutomatorTextFieldIOS : UIAutomatorTextField { public static UIAutomatorTextFieldIOS for_id(String id) { return(new UIAutomatorTextFieldIOS().initialize(id)); } ptr field; public UIAutomatorTextFieldIOS initialize(String id) { ptr ff; var ip = id.to_strptr(); embed {{{ ff = window.textfields()[ip]; }}} if(ff == null) { return(null); } field = ff; return(this); } public void set_text(String text) { var ff = field; var tp = text.to_strptr(); embed {{{ ff.setValue(tp); }}} } }
  • 23. Copyright (c) 2014 Job and Esther Technologies, Inc. All Rights reserved. public class MyTestCase extends UiAutomatorTestCase { public void testSample() throws UiObjectNotFoundException, android.os.RemoteException { UiObject textfield = new UiObject(new UiSelector() .description("input")); textfield.clearTextField(); textfield.setText("Something"); UiObject button = new UiObject(new UiSelector() .description("clickme")); button.click(); } } var target = UIATarget.localTarget(); var app = target.frontMostApp(); var window = app.mainWindow(); window.textFields()["input"].setValue("Something"); window.buttons()["clickme"].tap(); NO WASTED EFFORT. WRITE THE SCRIPT ONLY ONCE class MyTestCase : UIAutomatorTestCase { public void execute() { get_text_field("input").set_text("Something"); get_button("clickme").click(); } }
  • 24. Copyright (c) 2014 Job and Esther Technologies, Inc. All Rights reserved. 24 Ask for more information markku.kero@jobandesther.com www.jobandesther.com www.eqela.com