Robotium framework & Jenkins CI tools - TdT@Cluj #19

31
Automated tests on Android Robotium framework and Jenkins CI tools Presenters: Dorel Natea and Mihai Băieșan

description

Meetup #19 @Cluj = Automated tests on Android - Robotium framework & Jenkins CI tools Presentation of how you can: • automate your tests for mobile platforms (O.S. Android) by using Robotium • run your tests by using Jenkins Knowledge level for the presentation: Beginner

Transcript of Robotium framework & Jenkins CI tools - TdT@Cluj #19

Page 1: Robotium framework & Jenkins CI tools - TdT@Cluj #19

Automated tests on Android –

Robotium framework and Jenkins CI tools

Presenters: Dorel Natea and Mihai Băieșan

Page 2: Robotium framework & Jenkins CI tools - TdT@Cluj #19
Page 3: Robotium framework & Jenkins CI tools - TdT@Cluj #19

Content

It’s Demo time!

Page 4: Robotium framework & Jenkins CI tools - TdT@Cluj #19
Page 5: Robotium framework & Jenkins CI tools - TdT@Cluj #19

Robotium

• Open-Source Test Automation Framework

• UI testing for Android

• Standalone jar

• Create automated tests for

– *Native applications

– *Hibrid applications

• Easy to develop automated tests

www.robotium.org * http://bit.ly/1cKYGWY

Page 6: Robotium framework & Jenkins CI tools - TdT@Cluj #19
Page 7: Robotium framework & Jenkins CI tools - TdT@Cluj #19

Robotium - structure Create a test class:

public class MyAndroidActivityTest extends android.test.ActivityInstrumentationTestCase2 {

Declare a Solo class instance private Solo solo;

Create a test class constructor public MyAndroidActivityTest() {

super("com.example", MyAndroidActivity.class); }

Override the setUp() and tearDown() methods. @Override

protected void setUp() throws Exception {

super.setUp();

solo = new Solo(getInstrumentation(), getActivity());

}

@Override

protected void tearDown() throws Exception {

solo.finishOpenedActivities();

getActivity().finish();

super.tearDown();

}

Create a test method public void testDisplayedText() throws InterruptedException {

solo.clickOnButton("Add blog hosted at WordPress.com");}

Page 8: Robotium framework & Jenkins CI tools - TdT@Cluj #19
Page 9: Robotium framework & Jenkins CI tools - TdT@Cluj #19

Robotium - methods

solo.clickOnButton("Add self-hosted WordPress blog");

// Click on the button that has the following text displayed

solo.waitForText("Account Details");

// Waiting for the text “Account Details” to be displayed on the screen

solo.typeText((EditText)solo.getCurrentActivity().findViewById(R.id.url), “www.test.te");

// Type text “www.test.te" in the text field with the following id=> “url”

Page 10: Robotium framework & Jenkins CI tools - TdT@Cluj #19
Page 11: Robotium framework & Jenkins CI tools - TdT@Cluj #19

WordPress

“Share with the world, your community, or your closest friends.”

Free and open-source blogging tool. A content-management system. WordPress mobile app: Write, Edit, Publish posts in your site, check stats

Page 12: Robotium framework & Jenkins CI tools - TdT@Cluj #19
Page 13: Robotium framework & Jenkins CI tools - TdT@Cluj #19

Jenkins

Open-Source continuous integration server

Multiple jobs that can ran independently

Trying to avoid CI bugs

Jenkins Dashboard

Page 14: Robotium framework & Jenkins CI tools - TdT@Cluj #19
Page 15: Robotium framework & Jenkins CI tools - TdT@Cluj #19

Jenkins

Create new job

Page 16: Robotium framework & Jenkins CI tools - TdT@Cluj #19
Page 17: Robotium framework & Jenkins CI tools - TdT@Cluj #19

Jenkins

Jenkins Job Dashboard

Page 18: Robotium framework & Jenkins CI tools - TdT@Cluj #19
Page 19: Robotium framework & Jenkins CI tools - TdT@Cluj #19

Jenkins

Jenkins Nodes

Page 20: Robotium framework & Jenkins CI tools - TdT@Cluj #19
Page 21: Robotium framework & Jenkins CI tools - TdT@Cluj #19

Jenkins

Reports:

– Test result

Page 22: Robotium framework & Jenkins CI tools - TdT@Cluj #19
Page 23: Robotium framework & Jenkins CI tools - TdT@Cluj #19

Jenkins & Emma

Reports:

– Code coverage report

Page 24: Robotium framework & Jenkins CI tools - TdT@Cluj #19
Page 25: Robotium framework & Jenkins CI tools - TdT@Cluj #19

It’s Demo Time!

Page 26: Robotium framework & Jenkins CI tools - TdT@Cluj #19
Page 27: Robotium framework & Jenkins CI tools - TdT@Cluj #19

Q&A

Page 28: Robotium framework & Jenkins CI tools - TdT@Cluj #19
Page 29: Robotium framework & Jenkins CI tools - TdT@Cluj #19

Other tools

• Appium – http://appium.io/

• Calabash – http://calaba.sh/

• MonkeyTalk – http://www.gorillalogic.com/monkeytalk

• Testdroid – http://bitbar.com/

Page 30: Robotium framework & Jenkins CI tools - TdT@Cluj #19
Page 31: Robotium framework & Jenkins CI tools - TdT@Cluj #19

References

• Robotium – https://code.google.com/p/robotium/ – http://code.google.com/p/robotium/wiki/RobotiumAPIDocumentation

• Zutubi Android junit report – http://zutubi.com/source/projects/android-junit-report/

• Jenkins CI – http://jenkins-ci.org/

• Emma coverage tool – http://emma.sourceforge.net/

• Emma Jenkins plugin – https://wiki.jenkins-ci.org/display/JENKINS/Emma+Plugin

• Genymotion – http://www.genymotion.com/

• Stackoverflow :D – http://stackoverflow.com/

• Wordpress – http://www.wordpress.com

• Useful blog: – http://dnlkntt.wordpress.com

• Hierarchy Viewer – http://developer.android.com/tools/help/hierarchy-viewer.html