SlideShare a Scribd company logo
1 of 22
Download to read offline
Tobias Preuss – 26.03.2014 – GDG Android in Berlin – v.1.0.1 http://www.flickr.com/photos/johnhaydon/5161176888/
How to setup unit testing in Android Studio
Testing
Tobias Preuss – 26.03.2014 – GDG Android in Berlin – v.1.0.1
What changed at the slides
Changelog
v.1.0.1 Removed duplicate slide
v.1.0.0 Initial version
Tobias Preuss – 26.03.2014 – GDG Android in Berlin – v.1.0.1
A tiny piece of structure
The presentation
Part 1: General project setup
Part 2: IDE integration
Tobias Preuss – 26.03.2014 – GDG Android in Berlin – v.1.0.1
Part 1: General project setup
The easy part
Tobias Preuss – 26.03.2014 – GDG Android in Berlin – v.1.0.1
Expecting the default project structure of Android Studio / Gradle
Project structure
├── build.gradle
└── app
├── build.gradle
└── src
└── main
├── AndroidManifest.xml
├── java
└── res
Tobias Preuss – 26.03.2014 – GDG Android in Berlin – v.1.0.1
Robolectric and jUnit 4 to app/build.gradle
Dependencies
dependencies {
androidTestCompile 'org.robolectric:robolectric:2.+'
androidTestCompile 'junit:junit:4.+'
}
Tobias Preuss – 26.03.2014 – GDG Android in Berlin – v.1.0.1
Add novoda/robolectric-plugin to /build.gradle
Gradle plugin
buildscript {
repositories {
mavenCentral()
// Add this repository:
maven {
url 'https://oss.sonatype.org/content/repositories/snapshots'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:0.8.+'
// And this dependency:
classpath 'com.novoda.gradle:robolectric-plugin:0.0.1-SNAPSHOT'
}
}
allprojects {
repositories {
mavenCentral()
// And finally this repository again.
maven {
url 'https://oss.sonatype.org/content/repositories/snapshots'
}
}
}
Tobias Preuss – 26.03.2014 – GDG Android in Berlin – v.1.0.1
Apply the plugin to app/build.gradle
Gradle plugin
apply plugin: 'robolectric'
Now sync ...
Tobias Preuss – 26.03.2014 – GDG Android in Berlin – v.1.0.1
Create a test folder: app/src/test/java/com/example/app/test
Create a test
package com.example.app.test;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.RobolectricTestRunner;
import static org.junit.Assert.*;
@RunWith(RobolectricTestRunner.class)
public class RoboTest {
@Test
public void testTrueIsTrue() throws Exception {
assertEquals(true, true);
}
}
Tobias Preuss – 26.03.2014 – GDG Android in Berlin – v.1.0.1
Android Studio does not recognize app/src/test/java as source directory
Run the test (from the shell)
$ ./gradlew robolectric
Should look like this …
...
:app:assemble
:app:compileRobolectricJava
:app:processRobolectricResources UP-TO-DATE
:app:robolectricClasses
:app:robolectric
BUILD SUCCESSFUL
Tobias Preuss – 26.03.2014 – GDG Android in Berlin – v.1.0.1
The confusing part
Part 2: IDE integration
Tobias Preuss – 26.03.2014 – GDG Android in Berlin – v.1.0.1
Add a task to app/build.gradle
Register the test folder
task addTest {
description "Registers the test folder in the .iml file so Java tooling works."
def src = ['src/test/java']
def file = file("app.iml") // Must match module file name
doLast {
try {
def parsedXml = (new XmlParser()).parse(file)
def node = parsedXml.component[1].content[0]
src.each {
def path = 'file://$MODULE_DIR$/' + "${it}"
def set = node.find { it.@url == path }
if (set == null) {
new Node(node, 'sourceFolder',
['url': 'file://$MODULE_DIR$/' + "${it}", 'isTestSource': "true"])
def writer = new StringWriter()
new XmlNodePrinter(new PrintWriter(writer)).print(parsedXml)
file.text = writer.toString()
}
}
} catch (FileNotFoundException e) {
// nop, iml not found
}
}
}
// always do the addtest on prebuild
gradle.projectsEvaluated {
preBuild.dependsOn(addTest)
}
Tobias Preuss – 26.03.2014 – GDG Android in Berlin – v.1.0.1
The test folder is recognized by Android Studio
Register the test folder
Tobias Preuss – 26.03.2014 – GDG Android in Berlin – v.1.0.1
Pick it from the context menu ...
Run All Tests
Tobias Preuss – 26.03.2014 – GDG Android in Berlin – v.1.0.1
Test were not started
Failed to run tests
!!! JUnit version 3.8 or later expected:
java.lang.RuntimeException: Stub!
at junit.runner.BaseTestRunner.<init>(BaseTestRunner.java:5)
at junit.textui.TestRunner.<init>(TestRunner.java:54)
at junit.textui.TestRunner.<init>(TestRunner.java:48)
at junit.textui.TestRunner.<init>(TestRunner.java:41)
Process finished with exit code 253
Copy everything printed to the output!
Tobias Preuss – 26.03.2014 – GDG Android in Berlin – v.1.0.1
Before ...
Some text editor work
/usr/lib/jvm/jdk1.7.0/bin/java -ea -Didea.launcher.port=7532 -Didea.launcher.bin.path=/opt/android-studio/bin -Dfile.encoding=UTF-8 -classpath
/opt/android-studio/lib/idea_rt.jar:/opt/android-studio/plugins/junit/lib/junit-rt.jar:/media/data/SDKs/android-sdk-linux_x86/platforms/android-19/android.jar:/
media/data/SDKs/android-sdk-linux_x86/platforms/android-19/data/res:/media/data/SDKs/android-sdk-linux_x86/tools/support/annotations.jar:/media/data/Development
_Ubuntu/TestRobolectricHome/app/build/classes/debug:/home/tobias/.gradle/caches/modules-2/files-2.1/classworlds/classworlds/1.1-alpha-2/5adf2e681c57d7f48038b602
f3ca2254ee82d47/classworlds-1.1-alpha-2.jar:/home/tobias/.gradle/caches/modules-2/files-2.1/org.codehaus.plexus/plexus-utils/1.5.15/c689598ce1eb94c304817877ed15
911099972526/plexus-utils-1.5.15.jar:/home/tobias/.gradle/caches/modules-2/files-2.1/org.objenesis/objenesis/1.3/dc13ae4faca6df981fc7aeb5a522d9db446d5d50/objene
sis-1.3.jar:/home/tobias/.gradle/caches/modules-2/files-2.1/org.apache.maven/maven-artifact-manager/2.2.1/ec355b913c34d37080810f98e3f51abecbe1572b/maven-artifac
t-manager-2.2.1.jar:/home/tobias/.gradle/caches/modules-2/files-2.1/nekohtml/nekohtml/1.9.6.2/2d960be7b62ae6622dbbbe49ab4ffdc609f85c80/nekohtml-1.9.6.2.jar:/hom
e/tobias/.gradle/caches/modules-2/files-2.1/org.ow2.asm/asm-tree/4.1/51085abcc4cb6c6e1cb5551e6f999eb8e31c5b2d/asm-tree-4.1.jar:/home/tobias/.gradle/caches/modul
es-2/files-2.1/org.ow2.asm/asm/4.1/ad568238ee36a820bd6c6806807e8a14ea34684d/asm-4.1.jar:/home/tobias/.gradle/caches/modules-2/files-2.1/org.xerial/sqlite-jdbc/3
.7.2/7a3d67f00508d3881650579f7f228c61bfc1b196/sqlite-jdbc-3.7.2.jar:/home/tobias/.gradle/caches/modules-2/files-2.1/org.apache.ant/ant/1.8.0/7b456ca6b93900f96e5
8cc8371f03d90a9c1c8d1/ant-1.8.0.jar:/home/tobias/.gradle/caches/modules-2/files-2.1/org.apache.maven/maven-repository-metadata/2.2.1/98f0c07fcf1eeb213bef8d9316a
9935184084b06/maven-repository-metadata-2.2.1.jar:/home/tobias/.gradle/caches/modules-2/files-2.1/org.apache.maven/maven-ant-tasks/2.1.3/b09be554228d66d208e5fef
5266844aacf443abc/maven-ant-tasks-2.1.3.jar:/home/tobias/.gradle/caches/modules-2/files-2.1/org.apache.maven/maven-error-diagnostics/2.2.1/e81bb342d7d172f23d108
dc8fa979a1facdcde8e/maven-error-diagnostics-2.2.1.jar:/home/tobias/.gradle/caches/modules-2/files-2.1/org.apache.maven.wagon/wagon-http-lightweight/1.0-beta-6/b
3815078570c3b1f0667e123d59717c6b726c6c2/wagon-http-lightweight-1.0-beta-6.jar:/home/tobias/.gradle/caches/modules-2/files-2.1/commons-codec/commons-codec/1.3/fd
32786786e2adb664d5ecc965da47629dca14ba/commons-codec-1.3.jar:/home/tobias/.gradle/caches/modules-2/files-2.1/org.apache.maven.wagon/wagon-http-shared/1.0-beta-6
/ccd70d7e0d8c085e648a83f072da06ca9a53be94/wagon-http-shared-1.0-beta-6.jar:/media/data/Development_Ubuntu/TestRobolectricHome/app/build/exploded-aar/com.android
.support/appcompat-v7/19.0.1/res:/media/data/Development_Ubuntu/TestRobolectricHome/app/build/exploded-aar/com.android.support/appcompat-v7/19.0.1/classes.jar:/
home/tobias/.gradle/caches/modules-2/files-2.1/org.robolectric/robolectric/2.2/af902024b55e3b41732a7d9f41c32f90c065be2f/robolectric-2.2.jar:/home/tobias/.gradle
/caches/modules-2/files-2.1/org.codehaus.plexus/plexus-container-default/1.0-alpha-9-stable-1/94aea3010e250a334d9dab7f591114cd6c767458/plexus-container-default-
1.0-alpha-9-stable-1.jar:/home/tobias/.gradle/caches/modules-2/files-2.1/backport-util-concurrent/backport-util-concurrent/3.1/682f7ac17fed79e92f8e87d8455192b63
376347b/backport-util-concurrent-3.1.jar:/home/tobias/.gradle/caches/modules-2/files-2.1/org.apache.maven/maven-plugin-registry/2.2.1/72a24b7775649af78f3986b5aa
7eb354b9674cfd/maven-plugin-registry-2.2.1.jar:/home/tobias/.gradle/caches/modules-2/files-2.1/org.apache.maven/maven-settings/2.2.1/2236ffe71fa5f78ce42b0f5fc22
c54ed45f14294/maven-settings-2.2.1.jar:/home/tobias/.gradle/caches/modules-2/files-2.1/org.apache.maven.wagon/wagon-file/1.0-beta-6/6c53633505460caf49d2660de1e2
4744d915afb9/wagon-file-1.0-beta-6.jar:/home/tobias/.gradle/caches/modules-2/files-2.1/com.ximpleware/vtd-xml/2.11/ee5bcf62c1acf76434ee9f1c67a840bafef72a6d/vtd-
xml-2.11.jar:/media/data/SDKs/android-sdk-linux_x86/extras/android/m2repository/com/android/support/support-v4/19.0.1/support-v4-19.0.1.jar:/home/tobias/.gradle
/caches/modules-2/files-2.1/org.ow2.asm/asm-commons/4.1/f8b86f4ee6e02082f63a658e00eb5506821253c6/asm-commons-4.1.jar:/home/tobias/.gradle/caches/modules-2/files
-2.1/org.hamcrest/hamcrest-core/1.3/42a25dc3219429f0e5d060061f71acb49bf010a0/hamcrest-core-1.3.jar:/home/tobias/.gradle/caches/modules-2/files-2.1/org.ow2.asm/a
sm-analysis/4.1/73401033069e4714f57b60aeae02f97210aaa64e/asm-analysis-4.1.jar:/home/tobias/.gradle/caches/modules-2/files-2.1/junit/junit/4.11/4e031bb61df09069a
eb2bffb4019e7a5034a4ee0/junit-4.11.jar:/home/tobias/.gradle/caches/modules-2/files-2.1/org.apache.maven/maven-artifact/2.2.1/23600f790d4dab2cb965419eaa982e3e84c
428f8/maven-artifact-2.2.1.jar:/home/tobias/.gradle/caches/modules-2/files-2.1/org.apache.maven/maven-profile/2.2.1/3950071587027e5086e9c395574a60650c432738/mav
en-profile-2.2.1.jar:/home/tobias/.gradle/caches/modules-2/files-2.1/com.google.android/support-v4/r7/24d0f6da34c3a2bfcf736ab42d51c91ac821ee22/support-v4-r7.jar
:/home/tobias/.gradle/caches/modules-2/files-2.1/org.ow2.asm/asm-util/4.1/6344065cb0f94e2b930a95e6656e040ebc11df08/asm-util-4.1.jar:/home/tobias/.gradle/caches/
modules-2/files-2.1/org.apache.maven/maven-model/2.2.1/c0a1c17436ec3ff5a56207c031d82277b4250a29/maven-model-2.2.1.jar:/home/tobias/.gradle/caches/modules-2/file
s-2.1/org.easytesting/fest-util/1.2.5/c4a8d7305b23b8d043be12c979813b096df11f44/fest-util-1.2.5.jar:/home/tobias/.gradle/caches/modules-2/files-2.1/org.apache.an
t/ant-launcher/1.8.0/8b53ba16fa62fb1034da8f1de200ddc407c8381/ant-launcher-1.8.0.jar:/home/tobias/.gradle/caches/modules-2/files-2.1/org.codehaus.plexus/plexus-i
nterpolation/1.11/ad9dddff6043194904ad1d2c00ff1d003c3915f7/plexus-interpolation-1.11.jar:/home/tobias/.gradle/caches/modules-2/files-2.1/org.easytesting/fest-re
flect/1.4.1/2b92d5275e92a49e16c7ce6bd7e46b9080db0530/fest-reflect-1.4.1.jar:/home/tobias/.gradle/caches/modules-2/files-2.1/org.apache.maven/maven-project/2.2.1
/8239e98c16f641d55a4ad0e0bab0aee3aff8933f/maven-project-2.2.1.jar:/home/tobias/.gradle/caches/modules-2/files-2.1/org.apache.maven.wagon/wagon-provider-api/1.0-
beta-6/3f952e0282ae77ae59851d96bb18015e520b6208/wagon-provider-api-1.0-beta-6.jar:/home/tobias/.gradle/caches/modules-2/files-2.1/nekohtml/xercesMinimal/1.9.6.2
/d1c5e063683a0e6f77cd5f051a9d4af48346fa6/xercesMinimal-1.9.6.2.jar ...
Remove everything before -classpath
Find juni part and prepend it
Tobias Preuss – 26.03.2014 – GDG Android in Berlin – v.1.0.1
After ...
Some text editor work
-classpath
/home/tobias/.gradle/caches/modules-2/files-2.1/junit/junit/4.11/4e031bb61df09069aeb2bffb4019e7a5034a4ee0/junit-4.11.jar:/opt/android-studio/lib/idea_rt.jar:/op
t/android-studio/plugins/junit/lib/junit-rt.jar:/media/data/SDKs/android-sdk-linux_x86/platforms/android-19/android.jar:/media/data/SDKs/android-sdk-linux_x86/p
latforms/android-19/data/res:/media/data/SDKs/android-sdk-linux_x86/tools/support/annotations.jar:/media/data/Development_Ubuntu/TestRobolectricHome/app/build/c
lasses/debug:/home/tobias/.gradle/caches/modules-2/files-2.1/classworlds/classworlds/1.1-alpha-2/5adf2e681c57d7f48038b602f3ca2254ee82d47/classworlds-1.1-alpha-2
.jar:/home/tobias/.gradle/caches/modules-2/files-2.1/org.codehaus.plexus/plexus-utils/1.5.15/c689598ce1eb94c304817877ed15911099972526/plexus-utils-1.5.15.jar:/h
ome/tobias/.gradle/caches/modules-2/files-2.1/org.objenesis/objenesis/1.3/dc13ae4faca6df981fc7aeb5a522d9db446d5d50/objenesis-1.3.jar:/home/tobias/.gradle/caches
/modules-2/files-2.1/org.apache.maven/maven-artifact-manager/2.2.1/ec355b913c34d37080810f98e3f51abecbe1572b/maven-artifact-manager-2.2.1.jar:/home/tobias/.gradl
e/caches/modules-2/files-2.1/nekohtml/nekohtml/1.9.6.2/2d960be7b62ae6622dbbbe49ab4ffdc609f85c80/nekohtml-1.9.6.2.jar:/home/tobias/.gradle/caches/modules-2/files
-2.1/org.ow2.asm/asm-tree/4.1/51085abcc4cb6c6e1cb5551e6f999eb8e31c5b2d/asm-tree-4.1.jar:/home/tobias/.gradle/caches/modules-2/files-2.1/org.ow2.asm/asm/4.1/ad56
8238ee36a820bd6c6806807e8a14ea34684d/asm-4.1.jar:/home/tobias/.gradle/caches/modules-2/files-2.1/org.xerial/sqlite-jdbc/3.7.2/7a3d67f00508d3881650579f7f228c61bf
c1b196/sqlite-jdbc-3.7.2.jar:/home/tobias/.gradle/caches/modules-2/files-2.1/org.apache.ant/ant/1.8.0/7b456ca6b93900f96e58cc8371f03d90a9c1c8d1/ant-1.8.0.jar:/ho
me/tobias/.gradle/caches/modules-2/files-2.1/org.apache.maven/maven-repository-metadata/2.2.1/98f0c07fcf1eeb213bef8d9316a9935184084b06/maven-repository-metadata
-2.2.1.jar:/home/tobias/.gradle/caches/modules-2/files-2.1/org.apache.maven/maven-ant-tasks/2.1.3/b09be554228d66d208e5fef5266844aacf443abc/maven-ant-tasks-2.1.3
.jar:/home/tobias/.gradle/caches/modules-2/files-2.1/org.apache.maven/maven-error-diagnostics/2.2.1/e81bb342d7d172f23d108dc8fa979a1facdcde8e/maven-error-diagnos
tics-2.2.1.jar:/home/tobias/.gradle/caches/modules-2/files-2.1/org.apache.maven.wagon/wagon-http-lightweight/1.0-beta-6/b3815078570c3b1f0667e123d59717c6b726c6c2
/wagon-http-lightweight-1.0-beta-6.jar:/home/tobias/.gradle/caches/modules-2/files-2.1/commons-codec/commons-codec/1.3/fd32786786e2adb664d5ecc965da47629dca14ba/
commons-codec-1.3.jar:/home/tobias/.gradle/caches/modules-2/files-2.1/org.apache.maven.wagon/wagon-http-shared/1.0-beta-6/ccd70d7e0d8c085e648a83f072da06ca9a53be
94/wagon-http-shared-1.0-beta-6.jar:/media/data/Development_Ubuntu/TestRobolectricHome/app/build/exploded-aar/com.android.support/appcompat-v7/19.0.1/res:/media
/data/Development_Ubuntu/TestRobolectricHome/app/build/exploded-aar/com.android.support/appcompat-v7/19.0.1/classes.jar:/home/tobias/.gradle/caches/modules-2/fi
les-2.1/org.robolectric/robolectric/2.2/af902024b55e3b41732a7d9f41c32f90c065be2f/robolectric-2.2.jar:/home/tobias/.gradle/caches/modules-2/files-2.1/org.codehau
s.plexus/plexus-container-default/1.0-alpha-9-stable-1/94aea3010e250a334d9dab7f591114cd6c767458/plexus-container-default-1.0-alpha-9-stable-1.jar:/home/tobias/.
gradle/caches/modules-2/files-2.1/backport-util-concurrent/backport-util-concurrent/3.1/682f7ac17fed79e92f8e87d8455192b63376347b/backport-util-concurrent-3.1.ja
r:/home/tobias/.gradle/caches/modules-2/files-2.1/org.apache.maven/maven-plugin-registry/2.2.1/72a24b7775649af78f3986b5aa7eb354b9674cfd/maven-plugin-registry-2.
2.1.jar:/home/tobias/.gradle/caches/modules-2/files-2.1/org.apache.maven/maven-settings/2.2.1/2236ffe71fa5f78ce42b0f5fc22c54ed45f14294/maven-settings-2.2.1.jar:
/home/tobias/.gradle/caches/modules-2/files-2.1/org.apache.maven.wagon/wagon-file/1.0-beta-6/6c53633505460caf49d2660de1e24744d915afb9/wagon-file-1.0-beta-6.jar:
/home/tobias/.gradle/caches/modules-2/files-2.1/com.ximpleware/vtd-xml/2.11/ee5bcf62c1acf76434ee9f1c67a840bafef72a6d/vtd-xml-2.11.jar:/media/data/SDKs/android-s
dk-linux_x86/extras/android/m2repository/com/android/support/support-v4/19.0.1/support-v4-19.0.1.jar:/home/tobias/.gradle/caches/modules-2/files-2.1/org.ow2.asm
/asm-commons/4.1/f8b86f4ee6e02082f63a658e00eb5506821253c6/asm-commons-4.1.jar:/home/tobias/.gradle/caches/modules-2/files-2.1/org.hamcrest/hamcrest-core/1.3/42a
25dc3219429f0e5d060061f71acb49bf010a0/hamcrest-core-1.3.jar:/home/tobias/.gradle/caches/modules-2/files-2.1/org.ow2.asm/asm-analysis/4.1/73401033069e4714f57b60a
eae02f97210aaa64e/asm-analysis-4.1.jar:/home/tobias/.gradle/caches/modules-2/files-2.1/org.apache.maven/maven-artifact/2.2.1/23600f790d4dab2cb965419eaa982e3e84c
428f8/maven-artifact-2.2.1.jar:/home/tobias/.gradle/caches/modules-2/files-2.1/org.apache.maven/maven-profile/2.2.1/3950071587027e5086e9c395574a60650c432738/mav
en-profile-2.2.1.jar:/home/tobias/.gradle/caches/modules-2/files-2.1/com.google.android/support-v4/r7/24d0f6da34c3a2bfcf736ab42d51c91ac821ee22/support-v4-r7.jar
:/home/tobias/.gradle/caches/modules-2/files-2.1/org.ow2.asm/asm-util/4.1/6344065cb0f94e2b930a95e6656e040ebc11df08/asm-util-4.1.jar:/home/tobias/.gradle/caches/
modules-2/files-2.1/org.apache.maven/maven-model/2.2.1/c0a1c17436ec3ff5a56207c031d82277b4250a29/maven-model-2.2.1.jar:/home/tobias/.gradle/caches/modules-2/file
s-2.1/org.easytesting/fest-util/1.2.5/c4a8d7305b23b8d043be12c979813b096df11f44/fest-util-1.2.5.jar:/home/tobias/.gradle/caches/modules-2/files-2.1/org.apache.an
t/ant-launcher/1.8.0/8b53ba16fa62fb1034da8f1de200ddc407c8381/ant-launcher-1.8.0.jar:/home/tobias/.gradle/caches/modules-2/files-2.1/org.codehaus.plexus/plexus-i
nterpolation/1.11/ad9dddff6043194904ad1d2c00ff1d003c3915f7/plexus-interpolation-1.11.jar:/home/tobias/.gradle/caches/modules-2/files-2.1/org.easytesting/fest-re
flect/1.4.1/2b92d5275e92a49e16c7ce6bd7e46b9080db0530/fest-reflect-1.4.1.jar:/home/tobias/.gradle/caches/modules-2/files-2.1/org.apache.maven/maven-project/2.2.1
/8239e98c16f641d55a4ad0e0bab0aee3aff8933f/maven-project-2.2.1.jar:/home/tobias/.gradle/caches/modules-2/files-2.1/org.apache.maven.wagon/wagon-provider-api/1.0-
beta-6/3f952e0282ae77ae59851d96bb18015e520b6208/wagon-provider-api-1.0-beta-6.jar:/home/tobias/.gradle/caches/modules-2/files-2.1/nekohtml/xercesMinimal/1.9.6.2
/d1c5e063683a0e6f77cd5f051a9d4af48346fa6/xercesMinimal-1.9.6.2.jar ...
The juni part is at the beginning now
Tobias Preuss – 26.03.2014 – GDG Android in Berlin – v.1.0.1
Classpath goes into VM options
Setup run configuration
Tobias Preuss – 26.03.2014 – GDG Android in Berlin – v.1.0.1
Create a Gradle task
Generate Robolectric classes
Tobias Preuss – 26.03.2014 – GDG Android in Berlin – v.1.0.1
Add to JUnit configuration, Before launch
Launch Robolectric configuration
Tobias Preuss – 26.03.2014 – GDG Android in Berlin – v.1.0.1
Big thanks to Ilkka Laukkanen
Credits
Further information:
http://blog.futurice.com/android_unit_testing_in_ides_and_ci_environments
Tobias Preuss – 26.03.2014 – GDG Android in Berlin – v.1.0.1 http://www.flickr.com/photos/dopey/123646856/
Questions

More Related Content

What's hot

Efficient JavaScript Unit Testing, JavaOne China 2013
Efficient JavaScript Unit Testing, JavaOne China 2013Efficient JavaScript Unit Testing, JavaOne China 2013
Efficient JavaScript Unit Testing, JavaOne China 2013Hazem Saleh
 
Efficient JavaScript Unit Testing, May 2012
Efficient JavaScript Unit Testing, May 2012Efficient JavaScript Unit Testing, May 2012
Efficient JavaScript Unit Testing, May 2012Hazem Saleh
 
[AnDevCon 2016] Mutation Testing for Android
[AnDevCon 2016] Mutation Testing for Android[AnDevCon 2016] Mutation Testing for Android
[AnDevCon 2016] Mutation Testing for AndroidHazem Saleh
 
Testing android apps with espresso
Testing android apps with espressoTesting android apps with espresso
Testing android apps with espressoÉdipo Souza
 
Effective Android Development. UA Mobile 2016.
Effective Android Development. UA Mobile 2016.Effective Android Development. UA Mobile 2016.
Effective Android Development. UA Mobile 2016.UA Mobile
 
Selenium-Browser-Based-Automated-Testing-for-Grails-Apps
Selenium-Browser-Based-Automated-Testing-for-Grails-AppsSelenium-Browser-Based-Automated-Testing-for-Grails-Apps
Selenium-Browser-Based-Automated-Testing-for-Grails-Appschrisb206 chrisb206
 
[EclipseCon NA 2014] Integration tests for RCP made easy with SWTBot and Tycho
[EclipseCon NA 2014] Integration tests for RCP made easy with SWTBot and Tycho[EclipseCon NA 2014] Integration tests for RCP made easy with SWTBot and Tycho
[EclipseCon NA 2014] Integration tests for RCP made easy with SWTBot and TychoMickael Istria
 
不只自動化而且更敏捷的Android開發工具 gradle
不只自動化而且更敏捷的Android開發工具 gradle不只自動化而且更敏捷的Android開發工具 gradle
不只自動化而且更敏捷的Android開發工具 gradlesam chiu
 
Testing for Android: When, Where, and How to Successfully Use Test Automation
Testing for Android: When, Where, and How to Successfully Use Test AutomationTesting for Android: When, Where, and How to Successfully Use Test Automation
Testing for Android: When, Where, and How to Successfully Use Test AutomationTrent Peterson
 
Apache Maven - eXo VN office presentation
Apache Maven - eXo VN office presentationApache Maven - eXo VN office presentation
Apache Maven - eXo VN office presentationArnaud Héritier
 
Android Testing: An Overview
Android Testing: An OverviewAndroid Testing: An Overview
Android Testing: An OverviewSmartLogic
 
ScalaUA - distage: Staged Dependency Injection
ScalaUA - distage: Staged Dependency InjectionScalaUA - distage: Staged Dependency Injection
ScalaUA - distage: Staged Dependency Injection7mind
 
Scala, Functional Programming and Team Productivity
Scala, Functional Programming and Team ProductivityScala, Functional Programming and Team Productivity
Scala, Functional Programming and Team Productivity7mind
 
Hyper-pragmatic Pure FP testing with distage-testkit
Hyper-pragmatic Pure FP testing with distage-testkitHyper-pragmatic Pure FP testing with distage-testkit
Hyper-pragmatic Pure FP testing with distage-testkit7mind
 
Implementing Quality on a Java Project
Implementing Quality on a Java ProjectImplementing Quality on a Java Project
Implementing Quality on a Java ProjectVincent Massol
 
[Ultracode Munich #4] Short introduction to the new Android build system incl...
[Ultracode Munich #4] Short introduction to the new Android build system incl...[Ultracode Munich #4] Short introduction to the new Android build system incl...
[Ultracode Munich #4] Short introduction to the new Android build system incl...BeMyApp
 
Vietnam qa meetup
Vietnam qa meetupVietnam qa meetup
Vietnam qa meetupSyam Sasi
 

What's hot (20)

Android studio
Android studioAndroid studio
Android studio
 
Efficient JavaScript Unit Testing, JavaOne China 2013
Efficient JavaScript Unit Testing, JavaOne China 2013Efficient JavaScript Unit Testing, JavaOne China 2013
Efficient JavaScript Unit Testing, JavaOne China 2013
 
Efficient JavaScript Unit Testing, May 2012
Efficient JavaScript Unit Testing, May 2012Efficient JavaScript Unit Testing, May 2012
Efficient JavaScript Unit Testing, May 2012
 
[AnDevCon 2016] Mutation Testing for Android
[AnDevCon 2016] Mutation Testing for Android[AnDevCon 2016] Mutation Testing for Android
[AnDevCon 2016] Mutation Testing for Android
 
Testing android apps with espresso
Testing android apps with espressoTesting android apps with espresso
Testing android apps with espresso
 
Effective Android Development. UA Mobile 2016.
Effective Android Development. UA Mobile 2016.Effective Android Development. UA Mobile 2016.
Effective Android Development. UA Mobile 2016.
 
Android testing part i
Android testing part iAndroid testing part i
Android testing part i
 
Selenium-Browser-Based-Automated-Testing-for-Grails-Apps
Selenium-Browser-Based-Automated-Testing-for-Grails-AppsSelenium-Browser-Based-Automated-Testing-for-Grails-Apps
Selenium-Browser-Based-Automated-Testing-for-Grails-Apps
 
[EclipseCon NA 2014] Integration tests for RCP made easy with SWTBot and Tycho
[EclipseCon NA 2014] Integration tests for RCP made easy with SWTBot and Tycho[EclipseCon NA 2014] Integration tests for RCP made easy with SWTBot and Tycho
[EclipseCon NA 2014] Integration tests for RCP made easy with SWTBot and Tycho
 
不只自動化而且更敏捷的Android開發工具 gradle
不只自動化而且更敏捷的Android開發工具 gradle不只自動化而且更敏捷的Android開發工具 gradle
不只自動化而且更敏捷的Android開發工具 gradle
 
Testing for Android: When, Where, and How to Successfully Use Test Automation
Testing for Android: When, Where, and How to Successfully Use Test AutomationTesting for Android: When, Where, and How to Successfully Use Test Automation
Testing for Android: When, Where, and How to Successfully Use Test Automation
 
WindowTester PRO
WindowTester PROWindowTester PRO
WindowTester PRO
 
Apache Maven - eXo VN office presentation
Apache Maven - eXo VN office presentationApache Maven - eXo VN office presentation
Apache Maven - eXo VN office presentation
 
Android Testing: An Overview
Android Testing: An OverviewAndroid Testing: An Overview
Android Testing: An Overview
 
ScalaUA - distage: Staged Dependency Injection
ScalaUA - distage: Staged Dependency InjectionScalaUA - distage: Staged Dependency Injection
ScalaUA - distage: Staged Dependency Injection
 
Scala, Functional Programming and Team Productivity
Scala, Functional Programming and Team ProductivityScala, Functional Programming and Team Productivity
Scala, Functional Programming and Team Productivity
 
Hyper-pragmatic Pure FP testing with distage-testkit
Hyper-pragmatic Pure FP testing with distage-testkitHyper-pragmatic Pure FP testing with distage-testkit
Hyper-pragmatic Pure FP testing with distage-testkit
 
Implementing Quality on a Java Project
Implementing Quality on a Java ProjectImplementing Quality on a Java Project
Implementing Quality on a Java Project
 
[Ultracode Munich #4] Short introduction to the new Android build system incl...
[Ultracode Munich #4] Short introduction to the new Android build system incl...[Ultracode Munich #4] Short introduction to the new Android build system incl...
[Ultracode Munich #4] Short introduction to the new Android build system incl...
 
Vietnam qa meetup
Vietnam qa meetupVietnam qa meetup
Vietnam qa meetup
 

Viewers also liked

Gradle talk, Javarsovia 2010
Gradle talk, Javarsovia 2010Gradle talk, Javarsovia 2010
Gradle talk, Javarsovia 2010Tomek Kaczanowski
 
Inside Android Testing
Inside Android TestingInside Android Testing
Inside Android TestingFernando Cejas
 
Testing Android
Testing AndroidTesting Android
Testing AndroidMarc Chung
 
Android Building, Testing and reversing
Android Building, Testing and reversingAndroid Building, Testing and reversing
Android Building, Testing and reversingEnrique López Mañas
 
Lecture 5: Storage: Saving Data Database, Files & Preferences
Lecture 5: Storage: Saving Data Database, Files & PreferencesLecture 5: Storage: Saving Data Database, Files & Preferences
Lecture 5: Storage: Saving Data Database, Files & PreferencesAhsanul Karim
 
Android Lesson 3 - Intent
Android Lesson 3 - IntentAndroid Lesson 3 - Intent
Android Lesson 3 - IntentDaniela Da Cruz
 
Creating the first app with android studio
Creating the first app with android studioCreating the first app with android studio
Creating the first app with android studioParinita03
 
My Project Report Documentation with Abstract & Snapshots
My Project Report Documentation with Abstract & SnapshotsMy Project Report Documentation with Abstract & Snapshots
My Project Report Documentation with Abstract & SnapshotsUsman Sait
 
Android Development - Process & Tools
Android Development - Process & ToolsAndroid Development - Process & Tools
Android Development - Process & ToolsLope Emano
 
Gradle 和 Android Studio --- Jason Ko
Gradle 和 Android Studio --- Jason KoGradle 和 Android Studio --- Jason Ko
Gradle 和 Android Studio --- Jason Ko力中 柯
 
Android app fundamentals
Android app fundamentalsAndroid app fundamentals
Android app fundamentalsAmr Salman
 
Android Fundamentals - Day 2
Android Fundamentals - Day 2Android Fundamentals - Day 2
Android Fundamentals - Day 2Mohammad Tarek
 

Viewers also liked (20)

Gradle talk, Javarsovia 2010
Gradle talk, Javarsovia 2010Gradle talk, Javarsovia 2010
Gradle talk, Javarsovia 2010
 
Introduction to android testing
Introduction to android testingIntroduction to android testing
Introduction to android testing
 
Inside Android Testing
Inside Android TestingInside Android Testing
Inside Android Testing
 
Testing Android
Testing AndroidTesting Android
Testing Android
 
Android testing
Android testingAndroid testing
Android testing
 
Android Building, Testing and reversing
Android Building, Testing and reversingAndroid Building, Testing and reversing
Android Building, Testing and reversing
 
Testing on Android
Testing on AndroidTesting on Android
Testing on Android
 
Lecture 5: Storage: Saving Data Database, Files & Preferences
Lecture 5: Storage: Saving Data Database, Files & PreferencesLecture 5: Storage: Saving Data Database, Files & Preferences
Lecture 5: Storage: Saving Data Database, Files & Preferences
 
Android Lesson 3 - Intent
Android Lesson 3 - IntentAndroid Lesson 3 - Intent
Android Lesson 3 - Intent
 
Creating the first app with android studio
Creating the first app with android studioCreating the first app with android studio
Creating the first app with android studio
 
Android seminar ppt
Android seminar pptAndroid seminar ppt
Android seminar ppt
 
My Project Report Documentation with Abstract & Snapshots
My Project Report Documentation with Abstract & SnapshotsMy Project Report Documentation with Abstract & Snapshots
My Project Report Documentation with Abstract & Snapshots
 
Android ppt
Android ppt Android ppt
Android ppt
 
Mobile app works
Mobile app worksMobile app works
Mobile app works
 
Unit test
Unit testUnit test
Unit test
 
Android Development - Process & Tools
Android Development - Process & ToolsAndroid Development - Process & Tools
Android Development - Process & Tools
 
Gradle 和 Android Studio --- Jason Ko
Gradle 和 Android Studio --- Jason KoGradle 和 Android Studio --- Jason Ko
Gradle 和 Android Studio --- Jason Ko
 
Android app fundamentals
Android app fundamentalsAndroid app fundamentals
Android app fundamentals
 
Android Fundamentals
Android FundamentalsAndroid Fundamentals
Android Fundamentals
 
Android Fundamentals - Day 2
Android Fundamentals - Day 2Android Fundamentals - Day 2
Android Fundamentals - Day 2
 

Similar to How to setup unit testing in Android Studio

Mastering the NDK with Android Studio 2.0 and the gradle-experimental plugin
Mastering the NDK with Android Studio 2.0 and the gradle-experimental pluginMastering the NDK with Android Studio 2.0 and the gradle-experimental plugin
Mastering the NDK with Android Studio 2.0 and the gradle-experimental pluginXavier Hallade
 
Gradle plugin, take control of the build
Gradle plugin, take control of the buildGradle plugin, take control of the build
Gradle plugin, take control of the buildEyal Lezmy
 
Hacking the Codename One Source Code - Part IV - Transcript.pdf
Hacking the Codename One Source Code - Part IV - Transcript.pdfHacking the Codename One Source Code - Part IV - Transcript.pdf
Hacking the Codename One Source Code - Part IV - Transcript.pdfShaiAlmog1
 
Codefresh + Cloud 66 webinar: Testing Strategies for Docker Driven Development
Codefresh + Cloud 66 webinar: Testing Strategies for Docker Driven DevelopmentCodefresh + Cloud 66 webinar: Testing Strategies for Docker Driven Development
Codefresh + Cloud 66 webinar: Testing Strategies for Docker Driven DevelopmentCodefresh
 
Idiomatic Gradle Plugin Writing - GradleSummit 2016
Idiomatic Gradle Plugin Writing - GradleSummit 2016Idiomatic Gradle Plugin Writing - GradleSummit 2016
Idiomatic Gradle Plugin Writing - GradleSummit 2016Schalk Cronjé
 
Getting started with building your own standalone Gradle plugin
Getting started with building your own standalone Gradle pluginGetting started with building your own standalone Gradle plugin
Getting started with building your own standalone Gradle plugintobiaspreuss
 
Hello, Android Studio 3.2 & Android App Bundle @ I/O Extended Bangkok 2018
Hello, Android Studio 3.2 & Android App Bundle @ I/O Extended Bangkok 2018Hello, Android Studio 3.2 & Android App Bundle @ I/O Extended Bangkok 2018
Hello, Android Studio 3.2 & Android App Bundle @ I/O Extended Bangkok 2018Somkiat Khitwongwattana
 
Idiomatic gradle plugin writing
Idiomatic gradle plugin writingIdiomatic gradle plugin writing
Idiomatic gradle plugin writingSchalk Cronjé
 
"How to Use Bazel to Manage Monorepos: The Grammarly Front-End Team’s Experie...
"How to Use Bazel to Manage Monorepos: The Grammarly Front-End Team’s Experie..."How to Use Bazel to Manage Monorepos: The Grammarly Front-End Team’s Experie...
"How to Use Bazel to Manage Monorepos: The Grammarly Front-End Team’s Experie...Fwdays
 
Javaone - Gradle: Harder, Better, Stronger, Faster
Javaone - Gradle: Harder, Better, Stronger, Faster Javaone - Gradle: Harder, Better, Stronger, Faster
Javaone - Gradle: Harder, Better, Stronger, Faster Andres Almiray
 
Implementation of SAST for Android Application
Implementation of SAST for Android ApplicationImplementation of SAST for Android Application
Implementation of SAST for Android Applicationsanjeevakumar methre
 
Making the Most of Your Gradle Build
Making the Most of Your Gradle BuildMaking the Most of Your Gradle Build
Making the Most of Your Gradle BuildAndres Almiray
 
Creating, debugging and deploying extension packages for Microsoft Visual Stu...
Creating, debugging and deploying extension packages for Microsoft Visual Stu...Creating, debugging and deploying extension packages for Microsoft Visual Stu...
Creating, debugging and deploying extension packages for Microsoft Visual Stu...PVS-Studio
 
Infinum Android Talks #17 - Testing your Android applications by Ivan Kust
Infinum Android Talks #17 - Testing your Android applications by Ivan KustInfinum Android Talks #17 - Testing your Android applications by Ivan Kust
Infinum Android Talks #17 - Testing your Android applications by Ivan KustInfinum
 
Android build tools - Nimble
Android build tools - NimbleAndroid build tools - Nimble
Android build tools - NimbleNimble
 
BMO - Intelligent Projects with Maven
BMO - Intelligent Projects with MavenBMO - Intelligent Projects with Maven
BMO - Intelligent Projects with MavenMert Çalışkan
 
Rene Groeschke
Rene GroeschkeRene Groeschke
Rene GroeschkeCodeFest
 

Similar to How to setup unit testing in Android Studio (20)

Mastering the NDK with Android Studio 2.0 and the gradle-experimental plugin
Mastering the NDK with Android Studio 2.0 and the gradle-experimental pluginMastering the NDK with Android Studio 2.0 and the gradle-experimental plugin
Mastering the NDK with Android Studio 2.0 and the gradle-experimental plugin
 
Gradle plugin, take control of the build
Gradle plugin, take control of the buildGradle plugin, take control of the build
Gradle plugin, take control of the build
 
Hacking the Codename One Source Code - Part IV - Transcript.pdf
Hacking the Codename One Source Code - Part IV - Transcript.pdfHacking the Codename One Source Code - Part IV - Transcript.pdf
Hacking the Codename One Source Code - Part IV - Transcript.pdf
 
Android Studio vs. ADT
Android Studio vs. ADTAndroid Studio vs. ADT
Android Studio vs. ADT
 
Codefresh + Cloud 66 webinar: Testing Strategies for Docker Driven Development
Codefresh + Cloud 66 webinar: Testing Strategies for Docker Driven DevelopmentCodefresh + Cloud 66 webinar: Testing Strategies for Docker Driven Development
Codefresh + Cloud 66 webinar: Testing Strategies for Docker Driven Development
 
Idiomatic Gradle Plugin Writing - GradleSummit 2016
Idiomatic Gradle Plugin Writing - GradleSummit 2016Idiomatic Gradle Plugin Writing - GradleSummit 2016
Idiomatic Gradle Plugin Writing - GradleSummit 2016
 
Getting started with building your own standalone Gradle plugin
Getting started with building your own standalone Gradle pluginGetting started with building your own standalone Gradle plugin
Getting started with building your own standalone Gradle plugin
 
Apache DeltaSpike: The CDI Toolbox
Apache DeltaSpike: The CDI ToolboxApache DeltaSpike: The CDI Toolbox
Apache DeltaSpike: The CDI Toolbox
 
Apache DeltaSpike the CDI toolbox
Apache DeltaSpike the CDI toolboxApache DeltaSpike the CDI toolbox
Apache DeltaSpike the CDI toolbox
 
Hello, Android Studio 3.2 & Android App Bundle @ I/O Extended Bangkok 2018
Hello, Android Studio 3.2 & Android App Bundle @ I/O Extended Bangkok 2018Hello, Android Studio 3.2 & Android App Bundle @ I/O Extended Bangkok 2018
Hello, Android Studio 3.2 & Android App Bundle @ I/O Extended Bangkok 2018
 
Idiomatic gradle plugin writing
Idiomatic gradle plugin writingIdiomatic gradle plugin writing
Idiomatic gradle plugin writing
 
"How to Use Bazel to Manage Monorepos: The Grammarly Front-End Team’s Experie...
"How to Use Bazel to Manage Monorepos: The Grammarly Front-End Team’s Experie..."How to Use Bazel to Manage Monorepos: The Grammarly Front-End Team’s Experie...
"How to Use Bazel to Manage Monorepos: The Grammarly Front-End Team’s Experie...
 
Javaone - Gradle: Harder, Better, Stronger, Faster
Javaone - Gradle: Harder, Better, Stronger, Faster Javaone - Gradle: Harder, Better, Stronger, Faster
Javaone - Gradle: Harder, Better, Stronger, Faster
 
Implementation of SAST for Android Application
Implementation of SAST for Android ApplicationImplementation of SAST for Android Application
Implementation of SAST for Android Application
 
Making the Most of Your Gradle Build
Making the Most of Your Gradle BuildMaking the Most of Your Gradle Build
Making the Most of Your Gradle Build
 
Creating, debugging and deploying extension packages for Microsoft Visual Stu...
Creating, debugging and deploying extension packages for Microsoft Visual Stu...Creating, debugging and deploying extension packages for Microsoft Visual Stu...
Creating, debugging and deploying extension packages for Microsoft Visual Stu...
 
Infinum Android Talks #17 - Testing your Android applications by Ivan Kust
Infinum Android Talks #17 - Testing your Android applications by Ivan KustInfinum Android Talks #17 - Testing your Android applications by Ivan Kust
Infinum Android Talks #17 - Testing your Android applications by Ivan Kust
 
Android build tools - Nimble
Android build tools - NimbleAndroid build tools - Nimble
Android build tools - Nimble
 
BMO - Intelligent Projects with Maven
BMO - Intelligent Projects with MavenBMO - Intelligent Projects with Maven
BMO - Intelligent Projects with Maven
 
Rene Groeschke
Rene GroeschkeRene Groeschke
Rene Groeschke
 

More from tobiaspreuss

State of EventFahrplan 2021 - NO/WHERE edition
State of EventFahrplan 2021 - NO/WHERE editionState of EventFahrplan 2021 - NO/WHERE edition
State of EventFahrplan 2021 - NO/WHERE editiontobiaspreuss
 
State of EventFahrplan 2021
State of EventFahrplan 2021State of EventFahrplan 2021
State of EventFahrplan 2021tobiaspreuss
 
35C3: EventFahrplan - Lightning Talk - Day 2
35C3: EventFahrplan - Lightning Talk - Day 235C3: EventFahrplan - Lightning Talk - Day 2
35C3: EventFahrplan - Lightning Talk - Day 2tobiaspreuss
 
CycleHack 2017 Berlin - How to continue
CycleHack 2017 Berlin - How to continueCycleHack 2017 Berlin - How to continue
CycleHack 2017 Berlin - How to continuetobiaspreuss
 

More from tobiaspreuss (6)

State of EventFahrplan 2021 - NO/WHERE edition
State of EventFahrplan 2021 - NO/WHERE editionState of EventFahrplan 2021 - NO/WHERE edition
State of EventFahrplan 2021 - NO/WHERE edition
 
State of EventFahrplan 2021
State of EventFahrplan 2021State of EventFahrplan 2021
State of EventFahrplan 2021
 
35C3: EventFahrplan - Lightning Talk - Day 2
35C3: EventFahrplan - Lightning Talk - Day 235C3: EventFahrplan - Lightning Talk - Day 2
35C3: EventFahrplan - Lightning Talk - Day 2
 
CycleHack 2017 Berlin - How to continue
CycleHack 2017 Berlin - How to continueCycleHack 2017 Berlin - How to continue
CycleHack 2017 Berlin - How to continue
 
Wo ist Markt?
Wo ist Markt?Wo ist Markt?
Wo ist Markt?
 
WhereWhat
WhereWhatWhereWhat
WhereWhat
 

Recently uploaded

Gas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxGas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxDr.Ibrahim Hassaan
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Jisc
 
Science 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptxScience 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptxMaryGraceBautista27
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceSamikshaHamane
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPCeline George
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Celine George
 
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYKayeClaireEstoconing
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...Nguyen Thanh Tu Collection
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Celine George
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
 
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxBarangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxCarlos105
 
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxAshokKarra1
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
ENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomnelietumpap1
 
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSJoshuaGantuangco2
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
 

Recently uploaded (20)

Gas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxGas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptx
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...
 
Science 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptxScience 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptx
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in Pharmacovigilance
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERP
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
 
OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...
 
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
 
Raw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptxRaw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptx
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
 
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxBarangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
 
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptxYOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
 
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptx
 
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptxLEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
ENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choom
 
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
 

How to setup unit testing in Android Studio

  • 1. Tobias Preuss – 26.03.2014 – GDG Android in Berlin – v.1.0.1 http://www.flickr.com/photos/johnhaydon/5161176888/ How to setup unit testing in Android Studio Testing
  • 2. Tobias Preuss – 26.03.2014 – GDG Android in Berlin – v.1.0.1 What changed at the slides Changelog v.1.0.1 Removed duplicate slide v.1.0.0 Initial version
  • 3. Tobias Preuss – 26.03.2014 – GDG Android in Berlin – v.1.0.1 A tiny piece of structure The presentation Part 1: General project setup Part 2: IDE integration
  • 4. Tobias Preuss – 26.03.2014 – GDG Android in Berlin – v.1.0.1 Part 1: General project setup The easy part
  • 5. Tobias Preuss – 26.03.2014 – GDG Android in Berlin – v.1.0.1 Expecting the default project structure of Android Studio / Gradle Project structure ├── build.gradle └── app ├── build.gradle └── src └── main ├── AndroidManifest.xml ├── java └── res
  • 6. Tobias Preuss – 26.03.2014 – GDG Android in Berlin – v.1.0.1 Robolectric and jUnit 4 to app/build.gradle Dependencies dependencies { androidTestCompile 'org.robolectric:robolectric:2.+' androidTestCompile 'junit:junit:4.+' }
  • 7. Tobias Preuss – 26.03.2014 – GDG Android in Berlin – v.1.0.1 Add novoda/robolectric-plugin to /build.gradle Gradle plugin buildscript { repositories { mavenCentral() // Add this repository: maven { url 'https://oss.sonatype.org/content/repositories/snapshots' } } dependencies { classpath 'com.android.tools.build:gradle:0.8.+' // And this dependency: classpath 'com.novoda.gradle:robolectric-plugin:0.0.1-SNAPSHOT' } } allprojects { repositories { mavenCentral() // And finally this repository again. maven { url 'https://oss.sonatype.org/content/repositories/snapshots' } } }
  • 8. Tobias Preuss – 26.03.2014 – GDG Android in Berlin – v.1.0.1 Apply the plugin to app/build.gradle Gradle plugin apply plugin: 'robolectric' Now sync ...
  • 9. Tobias Preuss – 26.03.2014 – GDG Android in Berlin – v.1.0.1 Create a test folder: app/src/test/java/com/example/app/test Create a test package com.example.app.test; import org.junit.Test; import org.junit.runner.RunWith; import org.robolectric.RobolectricTestRunner; import static org.junit.Assert.*; @RunWith(RobolectricTestRunner.class) public class RoboTest { @Test public void testTrueIsTrue() throws Exception { assertEquals(true, true); } }
  • 10. Tobias Preuss – 26.03.2014 – GDG Android in Berlin – v.1.0.1 Android Studio does not recognize app/src/test/java as source directory Run the test (from the shell) $ ./gradlew robolectric Should look like this … ... :app:assemble :app:compileRobolectricJava :app:processRobolectricResources UP-TO-DATE :app:robolectricClasses :app:robolectric BUILD SUCCESSFUL
  • 11. Tobias Preuss – 26.03.2014 – GDG Android in Berlin – v.1.0.1 The confusing part Part 2: IDE integration
  • 12. Tobias Preuss – 26.03.2014 – GDG Android in Berlin – v.1.0.1 Add a task to app/build.gradle Register the test folder task addTest { description "Registers the test folder in the .iml file so Java tooling works." def src = ['src/test/java'] def file = file("app.iml") // Must match module file name doLast { try { def parsedXml = (new XmlParser()).parse(file) def node = parsedXml.component[1].content[0] src.each { def path = 'file://$MODULE_DIR$/' + "${it}" def set = node.find { it.@url == path } if (set == null) { new Node(node, 'sourceFolder', ['url': 'file://$MODULE_DIR$/' + "${it}", 'isTestSource': "true"]) def writer = new StringWriter() new XmlNodePrinter(new PrintWriter(writer)).print(parsedXml) file.text = writer.toString() } } } catch (FileNotFoundException e) { // nop, iml not found } } } // always do the addtest on prebuild gradle.projectsEvaluated { preBuild.dependsOn(addTest) }
  • 13. Tobias Preuss – 26.03.2014 – GDG Android in Berlin – v.1.0.1 The test folder is recognized by Android Studio Register the test folder
  • 14. Tobias Preuss – 26.03.2014 – GDG Android in Berlin – v.1.0.1 Pick it from the context menu ... Run All Tests
  • 15. Tobias Preuss – 26.03.2014 – GDG Android in Berlin – v.1.0.1 Test were not started Failed to run tests !!! JUnit version 3.8 or later expected: java.lang.RuntimeException: Stub! at junit.runner.BaseTestRunner.<init>(BaseTestRunner.java:5) at junit.textui.TestRunner.<init>(TestRunner.java:54) at junit.textui.TestRunner.<init>(TestRunner.java:48) at junit.textui.TestRunner.<init>(TestRunner.java:41) Process finished with exit code 253 Copy everything printed to the output!
  • 16. Tobias Preuss – 26.03.2014 – GDG Android in Berlin – v.1.0.1 Before ... Some text editor work /usr/lib/jvm/jdk1.7.0/bin/java -ea -Didea.launcher.port=7532 -Didea.launcher.bin.path=/opt/android-studio/bin -Dfile.encoding=UTF-8 -classpath /opt/android-studio/lib/idea_rt.jar:/opt/android-studio/plugins/junit/lib/junit-rt.jar:/media/data/SDKs/android-sdk-linux_x86/platforms/android-19/android.jar:/ media/data/SDKs/android-sdk-linux_x86/platforms/android-19/data/res:/media/data/SDKs/android-sdk-linux_x86/tools/support/annotations.jar:/media/data/Development _Ubuntu/TestRobolectricHome/app/build/classes/debug:/home/tobias/.gradle/caches/modules-2/files-2.1/classworlds/classworlds/1.1-alpha-2/5adf2e681c57d7f48038b602 f3ca2254ee82d47/classworlds-1.1-alpha-2.jar:/home/tobias/.gradle/caches/modules-2/files-2.1/org.codehaus.plexus/plexus-utils/1.5.15/c689598ce1eb94c304817877ed15 911099972526/plexus-utils-1.5.15.jar:/home/tobias/.gradle/caches/modules-2/files-2.1/org.objenesis/objenesis/1.3/dc13ae4faca6df981fc7aeb5a522d9db446d5d50/objene sis-1.3.jar:/home/tobias/.gradle/caches/modules-2/files-2.1/org.apache.maven/maven-artifact-manager/2.2.1/ec355b913c34d37080810f98e3f51abecbe1572b/maven-artifac t-manager-2.2.1.jar:/home/tobias/.gradle/caches/modules-2/files-2.1/nekohtml/nekohtml/1.9.6.2/2d960be7b62ae6622dbbbe49ab4ffdc609f85c80/nekohtml-1.9.6.2.jar:/hom e/tobias/.gradle/caches/modules-2/files-2.1/org.ow2.asm/asm-tree/4.1/51085abcc4cb6c6e1cb5551e6f999eb8e31c5b2d/asm-tree-4.1.jar:/home/tobias/.gradle/caches/modul es-2/files-2.1/org.ow2.asm/asm/4.1/ad568238ee36a820bd6c6806807e8a14ea34684d/asm-4.1.jar:/home/tobias/.gradle/caches/modules-2/files-2.1/org.xerial/sqlite-jdbc/3 .7.2/7a3d67f00508d3881650579f7f228c61bfc1b196/sqlite-jdbc-3.7.2.jar:/home/tobias/.gradle/caches/modules-2/files-2.1/org.apache.ant/ant/1.8.0/7b456ca6b93900f96e5 8cc8371f03d90a9c1c8d1/ant-1.8.0.jar:/home/tobias/.gradle/caches/modules-2/files-2.1/org.apache.maven/maven-repository-metadata/2.2.1/98f0c07fcf1eeb213bef8d9316a 9935184084b06/maven-repository-metadata-2.2.1.jar:/home/tobias/.gradle/caches/modules-2/files-2.1/org.apache.maven/maven-ant-tasks/2.1.3/b09be554228d66d208e5fef 5266844aacf443abc/maven-ant-tasks-2.1.3.jar:/home/tobias/.gradle/caches/modules-2/files-2.1/org.apache.maven/maven-error-diagnostics/2.2.1/e81bb342d7d172f23d108 dc8fa979a1facdcde8e/maven-error-diagnostics-2.2.1.jar:/home/tobias/.gradle/caches/modules-2/files-2.1/org.apache.maven.wagon/wagon-http-lightweight/1.0-beta-6/b 3815078570c3b1f0667e123d59717c6b726c6c2/wagon-http-lightweight-1.0-beta-6.jar:/home/tobias/.gradle/caches/modules-2/files-2.1/commons-codec/commons-codec/1.3/fd 32786786e2adb664d5ecc965da47629dca14ba/commons-codec-1.3.jar:/home/tobias/.gradle/caches/modules-2/files-2.1/org.apache.maven.wagon/wagon-http-shared/1.0-beta-6 /ccd70d7e0d8c085e648a83f072da06ca9a53be94/wagon-http-shared-1.0-beta-6.jar:/media/data/Development_Ubuntu/TestRobolectricHome/app/build/exploded-aar/com.android .support/appcompat-v7/19.0.1/res:/media/data/Development_Ubuntu/TestRobolectricHome/app/build/exploded-aar/com.android.support/appcompat-v7/19.0.1/classes.jar:/ home/tobias/.gradle/caches/modules-2/files-2.1/org.robolectric/robolectric/2.2/af902024b55e3b41732a7d9f41c32f90c065be2f/robolectric-2.2.jar:/home/tobias/.gradle /caches/modules-2/files-2.1/org.codehaus.plexus/plexus-container-default/1.0-alpha-9-stable-1/94aea3010e250a334d9dab7f591114cd6c767458/plexus-container-default- 1.0-alpha-9-stable-1.jar:/home/tobias/.gradle/caches/modules-2/files-2.1/backport-util-concurrent/backport-util-concurrent/3.1/682f7ac17fed79e92f8e87d8455192b63 376347b/backport-util-concurrent-3.1.jar:/home/tobias/.gradle/caches/modules-2/files-2.1/org.apache.maven/maven-plugin-registry/2.2.1/72a24b7775649af78f3986b5aa 7eb354b9674cfd/maven-plugin-registry-2.2.1.jar:/home/tobias/.gradle/caches/modules-2/files-2.1/org.apache.maven/maven-settings/2.2.1/2236ffe71fa5f78ce42b0f5fc22 c54ed45f14294/maven-settings-2.2.1.jar:/home/tobias/.gradle/caches/modules-2/files-2.1/org.apache.maven.wagon/wagon-file/1.0-beta-6/6c53633505460caf49d2660de1e2 4744d915afb9/wagon-file-1.0-beta-6.jar:/home/tobias/.gradle/caches/modules-2/files-2.1/com.ximpleware/vtd-xml/2.11/ee5bcf62c1acf76434ee9f1c67a840bafef72a6d/vtd- xml-2.11.jar:/media/data/SDKs/android-sdk-linux_x86/extras/android/m2repository/com/android/support/support-v4/19.0.1/support-v4-19.0.1.jar:/home/tobias/.gradle /caches/modules-2/files-2.1/org.ow2.asm/asm-commons/4.1/f8b86f4ee6e02082f63a658e00eb5506821253c6/asm-commons-4.1.jar:/home/tobias/.gradle/caches/modules-2/files -2.1/org.hamcrest/hamcrest-core/1.3/42a25dc3219429f0e5d060061f71acb49bf010a0/hamcrest-core-1.3.jar:/home/tobias/.gradle/caches/modules-2/files-2.1/org.ow2.asm/a sm-analysis/4.1/73401033069e4714f57b60aeae02f97210aaa64e/asm-analysis-4.1.jar:/home/tobias/.gradle/caches/modules-2/files-2.1/junit/junit/4.11/4e031bb61df09069a eb2bffb4019e7a5034a4ee0/junit-4.11.jar:/home/tobias/.gradle/caches/modules-2/files-2.1/org.apache.maven/maven-artifact/2.2.1/23600f790d4dab2cb965419eaa982e3e84c 428f8/maven-artifact-2.2.1.jar:/home/tobias/.gradle/caches/modules-2/files-2.1/org.apache.maven/maven-profile/2.2.1/3950071587027e5086e9c395574a60650c432738/mav en-profile-2.2.1.jar:/home/tobias/.gradle/caches/modules-2/files-2.1/com.google.android/support-v4/r7/24d0f6da34c3a2bfcf736ab42d51c91ac821ee22/support-v4-r7.jar :/home/tobias/.gradle/caches/modules-2/files-2.1/org.ow2.asm/asm-util/4.1/6344065cb0f94e2b930a95e6656e040ebc11df08/asm-util-4.1.jar:/home/tobias/.gradle/caches/ modules-2/files-2.1/org.apache.maven/maven-model/2.2.1/c0a1c17436ec3ff5a56207c031d82277b4250a29/maven-model-2.2.1.jar:/home/tobias/.gradle/caches/modules-2/file s-2.1/org.easytesting/fest-util/1.2.5/c4a8d7305b23b8d043be12c979813b096df11f44/fest-util-1.2.5.jar:/home/tobias/.gradle/caches/modules-2/files-2.1/org.apache.an t/ant-launcher/1.8.0/8b53ba16fa62fb1034da8f1de200ddc407c8381/ant-launcher-1.8.0.jar:/home/tobias/.gradle/caches/modules-2/files-2.1/org.codehaus.plexus/plexus-i nterpolation/1.11/ad9dddff6043194904ad1d2c00ff1d003c3915f7/plexus-interpolation-1.11.jar:/home/tobias/.gradle/caches/modules-2/files-2.1/org.easytesting/fest-re flect/1.4.1/2b92d5275e92a49e16c7ce6bd7e46b9080db0530/fest-reflect-1.4.1.jar:/home/tobias/.gradle/caches/modules-2/files-2.1/org.apache.maven/maven-project/2.2.1 /8239e98c16f641d55a4ad0e0bab0aee3aff8933f/maven-project-2.2.1.jar:/home/tobias/.gradle/caches/modules-2/files-2.1/org.apache.maven.wagon/wagon-provider-api/1.0- beta-6/3f952e0282ae77ae59851d96bb18015e520b6208/wagon-provider-api-1.0-beta-6.jar:/home/tobias/.gradle/caches/modules-2/files-2.1/nekohtml/xercesMinimal/1.9.6.2 /d1c5e063683a0e6f77cd5f051a9d4af48346fa6/xercesMinimal-1.9.6.2.jar ... Remove everything before -classpath Find juni part and prepend it
  • 17. Tobias Preuss – 26.03.2014 – GDG Android in Berlin – v.1.0.1 After ... Some text editor work -classpath /home/tobias/.gradle/caches/modules-2/files-2.1/junit/junit/4.11/4e031bb61df09069aeb2bffb4019e7a5034a4ee0/junit-4.11.jar:/opt/android-studio/lib/idea_rt.jar:/op t/android-studio/plugins/junit/lib/junit-rt.jar:/media/data/SDKs/android-sdk-linux_x86/platforms/android-19/android.jar:/media/data/SDKs/android-sdk-linux_x86/p latforms/android-19/data/res:/media/data/SDKs/android-sdk-linux_x86/tools/support/annotations.jar:/media/data/Development_Ubuntu/TestRobolectricHome/app/build/c lasses/debug:/home/tobias/.gradle/caches/modules-2/files-2.1/classworlds/classworlds/1.1-alpha-2/5adf2e681c57d7f48038b602f3ca2254ee82d47/classworlds-1.1-alpha-2 .jar:/home/tobias/.gradle/caches/modules-2/files-2.1/org.codehaus.plexus/plexus-utils/1.5.15/c689598ce1eb94c304817877ed15911099972526/plexus-utils-1.5.15.jar:/h ome/tobias/.gradle/caches/modules-2/files-2.1/org.objenesis/objenesis/1.3/dc13ae4faca6df981fc7aeb5a522d9db446d5d50/objenesis-1.3.jar:/home/tobias/.gradle/caches /modules-2/files-2.1/org.apache.maven/maven-artifact-manager/2.2.1/ec355b913c34d37080810f98e3f51abecbe1572b/maven-artifact-manager-2.2.1.jar:/home/tobias/.gradl e/caches/modules-2/files-2.1/nekohtml/nekohtml/1.9.6.2/2d960be7b62ae6622dbbbe49ab4ffdc609f85c80/nekohtml-1.9.6.2.jar:/home/tobias/.gradle/caches/modules-2/files -2.1/org.ow2.asm/asm-tree/4.1/51085abcc4cb6c6e1cb5551e6f999eb8e31c5b2d/asm-tree-4.1.jar:/home/tobias/.gradle/caches/modules-2/files-2.1/org.ow2.asm/asm/4.1/ad56 8238ee36a820bd6c6806807e8a14ea34684d/asm-4.1.jar:/home/tobias/.gradle/caches/modules-2/files-2.1/org.xerial/sqlite-jdbc/3.7.2/7a3d67f00508d3881650579f7f228c61bf c1b196/sqlite-jdbc-3.7.2.jar:/home/tobias/.gradle/caches/modules-2/files-2.1/org.apache.ant/ant/1.8.0/7b456ca6b93900f96e58cc8371f03d90a9c1c8d1/ant-1.8.0.jar:/ho me/tobias/.gradle/caches/modules-2/files-2.1/org.apache.maven/maven-repository-metadata/2.2.1/98f0c07fcf1eeb213bef8d9316a9935184084b06/maven-repository-metadata -2.2.1.jar:/home/tobias/.gradle/caches/modules-2/files-2.1/org.apache.maven/maven-ant-tasks/2.1.3/b09be554228d66d208e5fef5266844aacf443abc/maven-ant-tasks-2.1.3 .jar:/home/tobias/.gradle/caches/modules-2/files-2.1/org.apache.maven/maven-error-diagnostics/2.2.1/e81bb342d7d172f23d108dc8fa979a1facdcde8e/maven-error-diagnos tics-2.2.1.jar:/home/tobias/.gradle/caches/modules-2/files-2.1/org.apache.maven.wagon/wagon-http-lightweight/1.0-beta-6/b3815078570c3b1f0667e123d59717c6b726c6c2 /wagon-http-lightweight-1.0-beta-6.jar:/home/tobias/.gradle/caches/modules-2/files-2.1/commons-codec/commons-codec/1.3/fd32786786e2adb664d5ecc965da47629dca14ba/ commons-codec-1.3.jar:/home/tobias/.gradle/caches/modules-2/files-2.1/org.apache.maven.wagon/wagon-http-shared/1.0-beta-6/ccd70d7e0d8c085e648a83f072da06ca9a53be 94/wagon-http-shared-1.0-beta-6.jar:/media/data/Development_Ubuntu/TestRobolectricHome/app/build/exploded-aar/com.android.support/appcompat-v7/19.0.1/res:/media /data/Development_Ubuntu/TestRobolectricHome/app/build/exploded-aar/com.android.support/appcompat-v7/19.0.1/classes.jar:/home/tobias/.gradle/caches/modules-2/fi les-2.1/org.robolectric/robolectric/2.2/af902024b55e3b41732a7d9f41c32f90c065be2f/robolectric-2.2.jar:/home/tobias/.gradle/caches/modules-2/files-2.1/org.codehau s.plexus/plexus-container-default/1.0-alpha-9-stable-1/94aea3010e250a334d9dab7f591114cd6c767458/plexus-container-default-1.0-alpha-9-stable-1.jar:/home/tobias/. gradle/caches/modules-2/files-2.1/backport-util-concurrent/backport-util-concurrent/3.1/682f7ac17fed79e92f8e87d8455192b63376347b/backport-util-concurrent-3.1.ja r:/home/tobias/.gradle/caches/modules-2/files-2.1/org.apache.maven/maven-plugin-registry/2.2.1/72a24b7775649af78f3986b5aa7eb354b9674cfd/maven-plugin-registry-2. 2.1.jar:/home/tobias/.gradle/caches/modules-2/files-2.1/org.apache.maven/maven-settings/2.2.1/2236ffe71fa5f78ce42b0f5fc22c54ed45f14294/maven-settings-2.2.1.jar: /home/tobias/.gradle/caches/modules-2/files-2.1/org.apache.maven.wagon/wagon-file/1.0-beta-6/6c53633505460caf49d2660de1e24744d915afb9/wagon-file-1.0-beta-6.jar: /home/tobias/.gradle/caches/modules-2/files-2.1/com.ximpleware/vtd-xml/2.11/ee5bcf62c1acf76434ee9f1c67a840bafef72a6d/vtd-xml-2.11.jar:/media/data/SDKs/android-s dk-linux_x86/extras/android/m2repository/com/android/support/support-v4/19.0.1/support-v4-19.0.1.jar:/home/tobias/.gradle/caches/modules-2/files-2.1/org.ow2.asm /asm-commons/4.1/f8b86f4ee6e02082f63a658e00eb5506821253c6/asm-commons-4.1.jar:/home/tobias/.gradle/caches/modules-2/files-2.1/org.hamcrest/hamcrest-core/1.3/42a 25dc3219429f0e5d060061f71acb49bf010a0/hamcrest-core-1.3.jar:/home/tobias/.gradle/caches/modules-2/files-2.1/org.ow2.asm/asm-analysis/4.1/73401033069e4714f57b60a eae02f97210aaa64e/asm-analysis-4.1.jar:/home/tobias/.gradle/caches/modules-2/files-2.1/org.apache.maven/maven-artifact/2.2.1/23600f790d4dab2cb965419eaa982e3e84c 428f8/maven-artifact-2.2.1.jar:/home/tobias/.gradle/caches/modules-2/files-2.1/org.apache.maven/maven-profile/2.2.1/3950071587027e5086e9c395574a60650c432738/mav en-profile-2.2.1.jar:/home/tobias/.gradle/caches/modules-2/files-2.1/com.google.android/support-v4/r7/24d0f6da34c3a2bfcf736ab42d51c91ac821ee22/support-v4-r7.jar :/home/tobias/.gradle/caches/modules-2/files-2.1/org.ow2.asm/asm-util/4.1/6344065cb0f94e2b930a95e6656e040ebc11df08/asm-util-4.1.jar:/home/tobias/.gradle/caches/ modules-2/files-2.1/org.apache.maven/maven-model/2.2.1/c0a1c17436ec3ff5a56207c031d82277b4250a29/maven-model-2.2.1.jar:/home/tobias/.gradle/caches/modules-2/file s-2.1/org.easytesting/fest-util/1.2.5/c4a8d7305b23b8d043be12c979813b096df11f44/fest-util-1.2.5.jar:/home/tobias/.gradle/caches/modules-2/files-2.1/org.apache.an t/ant-launcher/1.8.0/8b53ba16fa62fb1034da8f1de200ddc407c8381/ant-launcher-1.8.0.jar:/home/tobias/.gradle/caches/modules-2/files-2.1/org.codehaus.plexus/plexus-i nterpolation/1.11/ad9dddff6043194904ad1d2c00ff1d003c3915f7/plexus-interpolation-1.11.jar:/home/tobias/.gradle/caches/modules-2/files-2.1/org.easytesting/fest-re flect/1.4.1/2b92d5275e92a49e16c7ce6bd7e46b9080db0530/fest-reflect-1.4.1.jar:/home/tobias/.gradle/caches/modules-2/files-2.1/org.apache.maven/maven-project/2.2.1 /8239e98c16f641d55a4ad0e0bab0aee3aff8933f/maven-project-2.2.1.jar:/home/tobias/.gradle/caches/modules-2/files-2.1/org.apache.maven.wagon/wagon-provider-api/1.0- beta-6/3f952e0282ae77ae59851d96bb18015e520b6208/wagon-provider-api-1.0-beta-6.jar:/home/tobias/.gradle/caches/modules-2/files-2.1/nekohtml/xercesMinimal/1.9.6.2 /d1c5e063683a0e6f77cd5f051a9d4af48346fa6/xercesMinimal-1.9.6.2.jar ... The juni part is at the beginning now
  • 18. Tobias Preuss – 26.03.2014 – GDG Android in Berlin – v.1.0.1 Classpath goes into VM options Setup run configuration
  • 19. Tobias Preuss – 26.03.2014 – GDG Android in Berlin – v.1.0.1 Create a Gradle task Generate Robolectric classes
  • 20. Tobias Preuss – 26.03.2014 – GDG Android in Berlin – v.1.0.1 Add to JUnit configuration, Before launch Launch Robolectric configuration
  • 21. Tobias Preuss – 26.03.2014 – GDG Android in Berlin – v.1.0.1 Big thanks to Ilkka Laukkanen Credits Further information: http://blog.futurice.com/android_unit_testing_in_ides_and_ci_environments
  • 22. Tobias Preuss – 26.03.2014 – GDG Android in Berlin – v.1.0.1 http://www.flickr.com/photos/dopey/123646856/ Questions