28
 Testing Android Testing Android with with Open Source Open Source ~ Matthias Käppler ~ ~ Matthias Käppler ~ February 23rd, 2010

Testing With Open Source

Embed Size (px)

DESCRIPTION

A workshop on Android testing and build automation I did on the M2D2

Citation preview

Page 1: Testing With Open Source

  

Testing AndroidTesting Androidwith with Open SourceOpen Source

~ Matthias Käppler ~~ Matthias Käppler ~

February 23rd, 2010

Page 2: Testing With Open Source

  

1h Workshop1h Workshop(1) Writing Android tests 5m

(2) Writing Android tests: Example 15m

(3) Build management / Maven 5m

(4) Build management / Maven: Example 15m

(5) Build automation / Hudson 5m

(6) Build automation / Hudson: Example 15m

Page 3: Testing With Open Source

  

Europe's leading local review site

17M uniques

I'm the Android guy at Qype.com!

Page 4: Testing With Open Source

  

Android testingAndroid testing

How do we write tests for Android?

Page 5: Testing With Open Source

  

Android testingAndroid testing

As usual! Android uses JUnit 3

android.test:

AndroidTestCase < junit.framework.TestCase

InstrumentationTestCase < junit.framework.TestCase

Page 6: Testing With Open Source

  

Android testingAndroid testing

AndroidTestCase

ApplicationTestCase

ProviderTestCase2

ServiceTestCase

Page 7: Testing With Open Source

  

Android testingAndroid testing

InstrumentationTestCase

(SyncBaseInstrumentation)

(SingleLaunchActivityTestCase)

ActivityUnitTestCase

ActivityInstrumentationTestCase2

Page 8: Testing With Open Source

  

Android testingAndroid testing

How do we run tests for Android?

Page 9: Testing With Open Source

  

Android testingAndroid testing

Using Instrumentation.

Page 10: Testing With Open Source

  

Android testingAndroid testing

Work it!

Page 11: Testing With Open Source

  

Build managementBuild management

Nice, we have tests now.

But my build serverdoesn't click buttons.

Page 12: Testing With Open Source

  

Build managementBuild management

We need something that can runbuilds from the command line.

Page 13: Testing With Open Source

  

Build managementBuild management

Maven 2 does these sorts of things.

(and MUCH more, in fact)

Page 14: Testing With Open Source

  

Build managementBuild management

Maven 2 is a build system.

Page 15: Testing With Open Source

  

Build managementBuild management

Maven 2 is a dependencymanagement system.

Page 16: Testing With Open Source

  

Build managementBuild management

Maven 2 is a life-cyclemanagement system.

Page 17: Testing With Open Source

  

Build managementBuild management

Maven 2 is a report anddocumentation generator.

Page 18: Testing With Open Source

  

Build managementBuild management

In fact: Maven 2 is a platform.

Page 19: Testing With Open Source

  

Build managementBuild management

There's a plugin for Android!

maven-android-plugin

Page 20: Testing With Open Source

  

Build managementBuild management

Maven's central notion is the project.

It's described by the POM.

Page 21: Testing With Open Source

  

Android testingAndroid testing

Let's have a look at one...

Page 22: Testing With Open Source

  

Build automationBuild automation

Nice, we can now build and deploy our app from the command line.

But we still have to do it manually.

Page 23: Testing With Open Source

  

Build automationBuild automation

What we need is a build server, which automatically triggers builds.

Page 24: Testing With Open Source

  

Build automationBuild automation

Hudson does these sorts of things.

Page 25: Testing With Open Source

  

Build automationBuild automation

Hudson is a continuuous integration server. It can run builds when people commit pieces of work.

This is extremely helpful for discoveringsoftware regressions early on.

Page 26: Testing With Open Source

  

Build automationBuild automation

Hudson is a Java Web application.It consists of a single WAR.

$ java -jar hudson.war

Page 27: Testing With Open Source

  

Build automationBuild automation

Let's run it.

Page 28: Testing With Open Source

  

More informationMore information

maven.apache.org

code.google.com/p/maven-android-plugin

hudson-ci.org