Android studio&Gradle&Autotest

  • View
    110

  • Download
    0

Embed Size (px)

Transcript

AdMob

FantasyAndroid Studio &Gradle & Autotest

Demo multi apk Show moudleShow demo full debug release

Android unit test

1Android Studio is a new Android development environment based on IntelliJ IDEA.It provides new features and improvements over Eclipse ADT and will be the official Android IDE once it's ready.

Android Studio

Project and module

http://developer.android.com/sdk/installing/studio-build.html2Flexible Gradle-based build system.Build variants and multiple APK generation.Advanced Android code completion and refactoring.Expanded template support for Google Services and various device types.Support rich layout editor, Lint tools, ProGuard.Android Studio advantage ProjectPackagesAndroidAndroid Studio file scope

Project Package Android

4One project contain modules. JAR AAR(Android ARchive)Android Studio-project scope

Similar with EclipseAndroid Studio-package scope

New flattened structureFile groupManifestSourceResource GradleAndroid Studio-android scope

Gradle is build automation evolved.Gradle combines the power and flexibility of Ant with the dependency management and conventions of Maven into a more effective way to build.Powered by a Groovy DSL and packed with innovation, Gradle provides a declarative way to describe all kinds of builds through sensible defaults.Gradle

Gradle groovyhttp://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Running-tests

http://androiddevcorner.blogspot.co.uk/2014/10/building-multiple-apks-inside-android.html8Build configuration:Build variantsBuild type : Debug or ReleaseProduct falvor: Full or DemoDependenciesManifest entriesSigningProGuardTesting

Building multiple APKsBuild conigurationhttp://developer.android.com/sdk/installing/studio-build.htmlBuild type:Debug Release

Product flavor FullDemo

9

Gradle-build type

Gradle-product flavorGeneral classificationSmall(unit): preferably millisecondsMedium(Integration): preferably few secondsLarge(System): preferably minutes or hours Android classification:Activity TestingService TestingContent Provider TestingAccessibility TestingUI Testing

Autotest

http://autotestcentral.com/small-medium-and-large-test-sizes/275https://mike-bland.com/2011/11/01/small-medium-large.html12Android Testing Fundaments

http://developer.android.com/tools/testing/testing_android.html13Monkeyadb shell tool MonkeyrunnerUses Jython, a implementation of Python that uses Java programming language.UiAutomatorviewerA GUI tool to scan and analyze the UI components of an Android application.UiAutomatorA Java library containing APIs to customized functional UI tests.

Android UI testingBasic syntax:

Limit in target APP :

Monkey

http://developer.android.com/tools/help/monkey.html15Imports the monkeyrunner modules

Connects to the current device

Install the Android package

Run the component

Monkeyrunner

http://developer.android.com/tools/help/monkeyrunner_concepts.html16Presses the Back button

Pauses the current program

Simulates a drag gesture

Touches the screen

Takes a screenshot

Monkeyrunner

UiAutomatorviewer

Use python uiautomator libraryInstallation

Grammar is similar with Monkeyrunner.Controls UI component directly !

UiAutomator

Uianmator test casehttp://developer.android.com/tools/testing/what_to_test.htmlhttps://github.com/xiaocong/uiautomator19TestdroidCompatibility Testing

http://testdroid.com/20