robotium framework & jenkins ci tools - tdt@cluj #19
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: BeginnerTRANSCRIPT
![Page 1: Robotium framework & Jenkins CI tools - TdT@Cluj #19](https://reader034.vdocuments.mx/reader034/viewer/2022052410/554f4ef7b4c905524c8b4ce8/html5/thumbnails/1.jpg)
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](https://reader034.vdocuments.mx/reader034/viewer/2022052410/554f4ef7b4c905524c8b4ce8/html5/thumbnails/2.jpg)
![Page 3: Robotium framework & Jenkins CI tools - TdT@Cluj #19](https://reader034.vdocuments.mx/reader034/viewer/2022052410/554f4ef7b4c905524c8b4ce8/html5/thumbnails/3.jpg)
Content
It’s Demo time!
![Page 4: Robotium framework & Jenkins CI tools - TdT@Cluj #19](https://reader034.vdocuments.mx/reader034/viewer/2022052410/554f4ef7b4c905524c8b4ce8/html5/thumbnails/4.jpg)
![Page 5: Robotium framework & Jenkins CI tools - TdT@Cluj #19](https://reader034.vdocuments.mx/reader034/viewer/2022052410/554f4ef7b4c905524c8b4ce8/html5/thumbnails/5.jpg)
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](https://reader034.vdocuments.mx/reader034/viewer/2022052410/554f4ef7b4c905524c8b4ce8/html5/thumbnails/6.jpg)
![Page 7: Robotium framework & Jenkins CI tools - TdT@Cluj #19](https://reader034.vdocuments.mx/reader034/viewer/2022052410/554f4ef7b4c905524c8b4ce8/html5/thumbnails/7.jpg)
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](https://reader034.vdocuments.mx/reader034/viewer/2022052410/554f4ef7b4c905524c8b4ce8/html5/thumbnails/8.jpg)
![Page 9: Robotium framework & Jenkins CI tools - TdT@Cluj #19](https://reader034.vdocuments.mx/reader034/viewer/2022052410/554f4ef7b4c905524c8b4ce8/html5/thumbnails/9.jpg)
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](https://reader034.vdocuments.mx/reader034/viewer/2022052410/554f4ef7b4c905524c8b4ce8/html5/thumbnails/10.jpg)
![Page 11: Robotium framework & Jenkins CI tools - TdT@Cluj #19](https://reader034.vdocuments.mx/reader034/viewer/2022052410/554f4ef7b4c905524c8b4ce8/html5/thumbnails/11.jpg)
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](https://reader034.vdocuments.mx/reader034/viewer/2022052410/554f4ef7b4c905524c8b4ce8/html5/thumbnails/12.jpg)
![Page 13: Robotium framework & Jenkins CI tools - TdT@Cluj #19](https://reader034.vdocuments.mx/reader034/viewer/2022052410/554f4ef7b4c905524c8b4ce8/html5/thumbnails/13.jpg)
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](https://reader034.vdocuments.mx/reader034/viewer/2022052410/554f4ef7b4c905524c8b4ce8/html5/thumbnails/14.jpg)
![Page 15: Robotium framework & Jenkins CI tools - TdT@Cluj #19](https://reader034.vdocuments.mx/reader034/viewer/2022052410/554f4ef7b4c905524c8b4ce8/html5/thumbnails/15.jpg)
Jenkins
Create new job
![Page 16: Robotium framework & Jenkins CI tools - TdT@Cluj #19](https://reader034.vdocuments.mx/reader034/viewer/2022052410/554f4ef7b4c905524c8b4ce8/html5/thumbnails/16.jpg)
![Page 17: Robotium framework & Jenkins CI tools - TdT@Cluj #19](https://reader034.vdocuments.mx/reader034/viewer/2022052410/554f4ef7b4c905524c8b4ce8/html5/thumbnails/17.jpg)
Jenkins
Jenkins Job Dashboard
![Page 18: Robotium framework & Jenkins CI tools - TdT@Cluj #19](https://reader034.vdocuments.mx/reader034/viewer/2022052410/554f4ef7b4c905524c8b4ce8/html5/thumbnails/18.jpg)
![Page 19: Robotium framework & Jenkins CI tools - TdT@Cluj #19](https://reader034.vdocuments.mx/reader034/viewer/2022052410/554f4ef7b4c905524c8b4ce8/html5/thumbnails/19.jpg)
Jenkins
Jenkins Nodes
![Page 20: Robotium framework & Jenkins CI tools - TdT@Cluj #19](https://reader034.vdocuments.mx/reader034/viewer/2022052410/554f4ef7b4c905524c8b4ce8/html5/thumbnails/20.jpg)
![Page 21: Robotium framework & Jenkins CI tools - TdT@Cluj #19](https://reader034.vdocuments.mx/reader034/viewer/2022052410/554f4ef7b4c905524c8b4ce8/html5/thumbnails/21.jpg)
Jenkins
Reports:
– Test result
![Page 22: Robotium framework & Jenkins CI tools - TdT@Cluj #19](https://reader034.vdocuments.mx/reader034/viewer/2022052410/554f4ef7b4c905524c8b4ce8/html5/thumbnails/22.jpg)
![Page 23: Robotium framework & Jenkins CI tools - TdT@Cluj #19](https://reader034.vdocuments.mx/reader034/viewer/2022052410/554f4ef7b4c905524c8b4ce8/html5/thumbnails/23.jpg)
Jenkins & Emma
Reports:
– Code coverage report
![Page 24: Robotium framework & Jenkins CI tools - TdT@Cluj #19](https://reader034.vdocuments.mx/reader034/viewer/2022052410/554f4ef7b4c905524c8b4ce8/html5/thumbnails/24.jpg)
![Page 25: Robotium framework & Jenkins CI tools - TdT@Cluj #19](https://reader034.vdocuments.mx/reader034/viewer/2022052410/554f4ef7b4c905524c8b4ce8/html5/thumbnails/25.jpg)
It’s Demo Time!
![Page 26: Robotium framework & Jenkins CI tools - TdT@Cluj #19](https://reader034.vdocuments.mx/reader034/viewer/2022052410/554f4ef7b4c905524c8b4ce8/html5/thumbnails/26.jpg)
![Page 27: Robotium framework & Jenkins CI tools - TdT@Cluj #19](https://reader034.vdocuments.mx/reader034/viewer/2022052410/554f4ef7b4c905524c8b4ce8/html5/thumbnails/27.jpg)
Q&A
![Page 28: Robotium framework & Jenkins CI tools - TdT@Cluj #19](https://reader034.vdocuments.mx/reader034/viewer/2022052410/554f4ef7b4c905524c8b4ce8/html5/thumbnails/28.jpg)
![Page 29: Robotium framework & Jenkins CI tools - TdT@Cluj #19](https://reader034.vdocuments.mx/reader034/viewer/2022052410/554f4ef7b4c905524c8b4ce8/html5/thumbnails/29.jpg)
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](https://reader034.vdocuments.mx/reader034/viewer/2022052410/554f4ef7b4c905524c8b4ce8/html5/thumbnails/30.jpg)
![Page 31: Robotium framework & Jenkins CI tools - TdT@Cluj #19](https://reader034.vdocuments.mx/reader034/viewer/2022052410/554f4ef7b4c905524c8b4ce8/html5/thumbnails/31.jpg)
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