Robotium framework & Jenkins CI tools - TdT@Cluj #19
-
Upload
tabara-de-testare -
Category
Technology
-
view
1.215 -
download
2
description
Transcript of 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
Content
It’s Demo time!
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
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");}
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”
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
Jenkins
Open-Source continuous integration server
Multiple jobs that can ran independently
Trying to avoid CI bugs
Jenkins Dashboard
Jenkins
Create new job
Jenkins
Jenkins Job Dashboard
Jenkins
Jenkins Nodes
Jenkins
Reports:
– Test result
Jenkins & Emma
Reports:
– Code coverage report
It’s Demo Time!
Q&A
Other tools
• Appium – http://appium.io/
• Calabash – http://calaba.sh/
• MonkeyTalk – http://www.gorillalogic.com/monkeytalk
• Testdroid – http://bitbar.com/
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