Przyszłość ma na imię Mobile – testowanie i automatyzacja testów aplikacji mobilnych...

42
Przyszłość ma imię mobile Testowanie i automatyzacja aplikacji mobilnych (Android) Piotr Wicherski | TestWarez 2015

Transcript of Przyszłość ma na imię Mobile – testowanie i automatyzacja testów aplikacji mobilnych...

Przyszłość ma imię mobile

Testowanie i automatyzacjaaplikacji mobilnych (Android)

Piotr Wicherski | TestWarez 2015

Agenda

Narzędzia

Automatyzacja

2

3

Demo

Mobile Device Lab

4

5

1 Testowanie mobilne

Agenda

2

3

4

5

1 Testowanie mobilne

Narzędzia

Automatyzacja

Demo

Mobile Device Lab

Testowanie mobilne | Sieć

http://www.clker.com/cliparts/s/s/I/5/6/b/wireless-router-hi.png

● Real user conditions as important as real devices

● Network performance,battery consumption,memory usage are leading causes of poor performance

Testowanie mobilne | Sieć

https://www.youtube.com/watch?v=nOFel7yNAsE

Testowanie mobilne | Sieć

http://techvidhya.in/ http://learnabouttelecom.blogspot.com/2012/06/gsm-core-network-base-station-subsystem.html

Testowanie mobilne | Symulator

https://github.com/Polidea/Cellular-Data-Network-Simulator

Cellular Data Network SimulatorFeatures

● Easy to use web and mobile interface

● Simulate: bandwidth, delay, loss, corruption,

occasional loss of signal

● Can capture the traffic and send it to CloudShark

● Apply limits per-device

● Works well in environment with multiple devices and

multiple testers

● Works well as virtual machine bridged with separate

wireless network

Requirements

● OpenWrt device running on Barrier

Breaker - can be router or virtual machine

● Two network interfaces - one for WAN and

one for WIFI/LAN

Testowanie mobilne | Czujniki

http://developer.android.com/guide/topics/sensors/sensors_overview.html

Testowanie mobilne | Czujniki

http://opensignal.com/reports/2015/08/android-fragmentation/

Testowanie mobilne | Fragmentacja

http://developer.android.com

Any versions with less than 0.1% distribution are not shown.

Testowanie mobilne | Urządzenia

Xiaomi success inspires every man and his dog to make smartphones in china

http://www.reuters.com/article/2015/07/13/us-china-smartphones-idUSKCN0PN2HA20150713

Testowanie mobilne | Urządzenia

http://opensignal.com/reports/2015/08/android-fragmentation/

Testowanie mobilne | Custom ROMy

Testowanie mobilne | Werables

http://www.statista.com/chart/3762/wearable-device-shipments/

Testowanie mobilne | Werables

https://www.ifixit.com/Teardown/LG+G+Watch+Teardown/27037

Testowanie mobilne | Wearables

Chipset Qualcomm Snapdragon™ 400 MSM8026

Display 1.65-inch LCD IPS (280 x 280)

Memory 4GB eMMC / 512MB RAM

Battery 400mAh

CPU Quad-core 1.2 GHz

Connectivity Bluetooth 4.0

Sensors 9-Axis (Gyro / Accelerometer / Compass)

Others Dust and Water Resistant (IP67)

Agenda

2

3

4

5

1

Automatyzacja

Demo

Mobile Device Lab

Narzędzia

Testowanie mobilne

Narzędzia

Intellij IDEA | Android Studio

Charles | mitmproxy

dex2jar

Atom

Dash 3

Reeder 2 | Pocket

SourceTree

Vysor

Genymotion

Narzędzia

Monkey

Cellular data network simulator

TestLink

VNC remote server

Fabric Beta

Google Analytics

ADB

AndroidTool for mac

Agenda

2

3

4

5

1 Testowanie mobilne

Narzędzia

Automatyzacja

Demo

Mobile Device Lab

Automatyzacja testów mobilnych

Automatyzacja testów mobilnych

Automatyzacja testów mobilnych

Automatyzacja | Frameworki

Espresso

Robotium

Appium

Calabash

Imagrium

YSO Mobile Security Framework

https://mobilesecuritywiki.com/

Espresso | Cheat Sheet

https://goo.gl/ClhPzk

Espresso

ViewMatchers - allows you to locate a view in the current view hierarchy

ViewActions - allows you to interact with views

ViewAssertions - allows you to assert the state of a view

check something

find Something

do something

Espresso

@Test public void firstStep() { onView(withId(R.id.my_view))

.perform(click())

.check(matches(isDisplayed()));}

ViewAssertion

ViewMatcher

ViewAction

Espresso | app/build.gradle

apply plugin: 'com.android.application'

android { ... defaultConfig { … testInstrumentationRunner ‘android.support.test.runner.AndroidJUnitRunner’ }

}dependencies { androidTestCompile 'com.android.support.test:runner:0.2' androidTestCompile 'com.android.support.test:rules:0.2'

// Espresso dependencies androidTestCompile 'com.android.support.test.espresso:espresso-core:2.1'}

https://goo.gl/U2Qsi9

Espresso

@RunWith(AndroidJUnit4.class)@LargeTestpublic class ChangeTextBehaviorTest { ... @Rule public ActivityTestRule<MainActivity> mActivityRule = new ActivityTestRule<>( MainActivity.class);

@Test public void changeText_sameActivity() { onView(withId(R.id.editTextUserInput)) .perform(typeText(STRING_TO_BE_TYPED), closeSoftKeyboard()); onView(withId(R.id.changeTextBt)).perform(click());

onView(withId(R.id.textToBeChanged)).check(matches(withText(STRING_TO_BE_TYPED))); }}

https://goo.gl/U2Qsi9

Check that text was changed

Find EditText view

Start Activity under test

Type text, close keyboardthen press the button

Agenda

2

3

4

5

1 Testowanie mobilne

Narzędzia

Automatyzacja

Demo

Mobile Device Lab

Espresso

Spoon

Robotium Recorder

Agenda

2

3

4

5

1 Testowanie mobilne

Narzędzia

Automatyzacja

Demo

Mobile Device Lab

Mobile Device Lab

Mobile Device Lab

Mobile Device Lab

http://allegro.pl http://www.lapcabby.com/

http://openstf.io/

http://openstf.io/

Q/A?

Thank you!