PAUG - Intégration Continue - Décembre 2013
-
Upload
aurelien-guillard -
Category
Technology
-
view
1.454 -
download
2
Transcript of PAUG - Intégration Continue - Décembre 2013
![Page 1: PAUG - Intégration Continue - Décembre 2013](https://reader033.fdocuments.us/reader033/viewer/2022052905/5586910bd8b42abd068b456e/html5/thumbnails/1.jpg)
Intégration continueHockeyApp - Robotium - Jenkins
Aurélien Guillard - @a_guillard
![Page 2: PAUG - Intégration Continue - Décembre 2013](https://reader033.fdocuments.us/reader033/viewer/2022052905/5586910bd8b42abd068b456e/html5/thumbnails/2.jpg)
HockeyAppBeta distribution et Crash report
![Page 3: PAUG - Intégration Continue - Décembre 2013](https://reader033.fdocuments.us/reader033/viewer/2022052905/5586910bd8b42abd068b456e/html5/thumbnails/3.jpg)
HockeyApp - Beta distribution
● APKs hébergés chez HockeyApp
● Alerte des beta testeurs○ par mail○ dans l’application
● Historique des versions ○ application Android○ page web
![Page 4: PAUG - Intégration Continue - Décembre 2013](https://reader033.fdocuments.us/reader033/viewer/2022052905/5586910bd8b42abd068b456e/html5/thumbnails/4.jpg)
HockeyApp - Crash report
● Basé sur le volontariat des utilisateurs● Remontée des crashs en temps réel● Regroupement des crashs similaires● Fonctionne avec Proguard● Rapport quotidien par mail
![Page 5: PAUG - Intégration Continue - Décembre 2013](https://reader033.fdocuments.us/reader033/viewer/2022052905/5586910bd8b42abd068b456e/html5/thumbnails/5.jpg)
HockeyApp - Statistiques
![Page 6: PAUG - Intégration Continue - Décembre 2013](https://reader033.fdocuments.us/reader033/viewer/2022052905/5586910bd8b42abd068b456e/html5/thumbnails/6.jpg)
HockeyApp - Intégration
● Intégration simple○ Un JAR à copier○ 2 méthodes à
appeler
@Overridepublic void onCreate(Bundle savedInstanceState) { checkForUpdates();}@Overridepublic void onResume() { super.onResume(); checkForCrashes();}private void checkForCrashes() { CrashManager.register(this, APP_ID);}private void checkForUpdates() { UpdateManager.register(this, APP_ID);}
![Page 7: PAUG - Intégration Continue - Décembre 2013](https://reader033.fdocuments.us/reader033/viewer/2022052905/5586910bd8b42abd068b456e/html5/thumbnails/7.jpg)
HockeyApp - Combien ça coûte ?
![Page 8: PAUG - Intégration Continue - Décembre 2013](https://reader033.fdocuments.us/reader033/viewer/2022052905/5586910bd8b42abd068b456e/html5/thumbnails/8.jpg)
RobotiumImplémentation de tests automatiques
![Page 9: PAUG - Intégration Continue - Décembre 2013](https://reader033.fdocuments.us/reader033/viewer/2022052905/5586910bd8b42abd068b456e/html5/thumbnails/9.jpg)
Robotium ?
● Extension du framework d’instrumentation Android
Objectif :Simplifier le
développement des tests
![Page 10: PAUG - Intégration Continue - Décembre 2013](https://reader033.fdocuments.us/reader033/viewer/2022052905/5586910bd8b42abd068b456e/html5/thumbnails/10.jpg)
Robotium - Exemple @Override
public void setUp() throws Exception {
solo = new Solo(getInstrumentation(), getActivity());
}
@Override
public void tearDown() throws Exception {
solo.finishOpenedActivities();
}
public void testLogin() {
ScreenshotsUtils.takeScreenshot(solo, getActivity());
solo.enterText((EditText)solo.getView(R.id.mail_editText), "[email protected]");
solo.enterText((EditText)solo.getView(R.id.password_editText), "xxxxxxxxxxx");
solo.clickOnView(solo.getView(R.id.connect_button));
assertTrue(solo.waitForActivity(HomeActivity.class));
}
![Page 11: PAUG - Intégration Continue - Décembre 2013](https://reader033.fdocuments.us/reader033/viewer/2022052905/5586910bd8b42abd068b456e/html5/thumbnails/11.jpg)
Robotium - Test report
![Page 12: PAUG - Intégration Continue - Décembre 2013](https://reader033.fdocuments.us/reader033/viewer/2022052905/5586910bd8b42abd068b456e/html5/thumbnails/12.jpg)
JenkinsServeur d’intégration continue
![Page 13: PAUG - Intégration Continue - Décembre 2013](https://reader033.fdocuments.us/reader033/viewer/2022052905/5586910bd8b42abd068b456e/html5/thumbnails/13.jpg)
Jenkins
3 jobs
![Page 14: PAUG - Intégration Continue - Décembre 2013](https://reader033.fdocuments.us/reader033/viewer/2022052905/5586910bd8b42abd068b456e/html5/thumbnails/14.jpg)
Jenkins - Job ‘viadeo android’
● Vérification toutes les 15 minutes si une modification a eu lieu sur le repository GIT
● Si oui, update du code● Compilation● Envoi d’un mail en cas d’erreur
![Page 15: PAUG - Intégration Continue - Décembre 2013](https://reader033.fdocuments.us/reader033/viewer/2022052905/5586910bd8b42abd068b456e/html5/thumbnails/15.jpg)
Jenkins - Job ‘push to HockeyApp’
● Exécution à la main● Update du code● Compilation● Envoi de l’APK sur HockeyApp
○ plugin : https://wiki.jenkins-ci.org/display/JENKINS/Hockeyapp+Plugin
![Page 16: PAUG - Intégration Continue - Décembre 2013](https://reader033.fdocuments.us/reader033/viewer/2022052905/5586910bd8b42abd068b456e/html5/thumbnails/16.jpg)
Jenkins - Job ‘viadeo android test’
● Vérification toutes les 15 minutes si une modification a eu lieu sur le repository GIT
● Si oui, update du code● Compilation● Démarrage d’un émulateur
○ plugin : https://wiki.jenkins-ci.org/display/JENKINS/Android+Emulator+Plugin
● Installation de l’application dans l’émulateur● Installation de l’application de test dans l’émulateur● Exécution des tests
![Page 17: PAUG - Intégration Continue - Décembre 2013](https://reader033.fdocuments.us/reader033/viewer/2022052905/5586910bd8b42abd068b456e/html5/thumbnails/17.jpg)
Jenkins - Récupération d’un rapport
● Utilisation d’un TestRunner alternatif○ android junit report
Plus d’info : http://zutubi.com/source/projects/android-junit-report/
manifest.xml
<instrumentation
android:name="com.zutubi.android.junitreport.JUnitReportTestRunner"
android:targetPackage="com.viadeo.android" />
ant.propertiestest.runner=com.zutubi.android.junitreport.JUnitReportTestRunner
![Page 18: PAUG - Intégration Continue - Décembre 2013](https://reader033.fdocuments.us/reader033/viewer/2022052905/5586910bd8b42abd068b456e/html5/thumbnails/18.jpg)
Jenkins - Récupération d’un rapport
● Création d’une nouvelle target Ant
● Copie du rapport en XML dans le projet
build.xml
<target name="fetch-test-report" >
<xpath
expression="/manifest/@package"
input="${tested.project.dir}/AndroidManifest.xml"
output="tested.manifest.package" />
<echo>Downloading XML test report...</echo>
<mkdir dir="junitreports" />
<exec
executable="${adb}"
failonerror="true" >
<arg line="${adb.device.arg}" />
<arg value="pull" />
<arg value="/data/data/${tested.manifest.package}/files/junit-report.xml" />
<arg value="junitreports/junit-report.xml" />
</exec>
</target>
![Page 19: PAUG - Intégration Continue - Décembre 2013](https://reader033.fdocuments.us/reader033/viewer/2022052905/5586910bd8b42abd068b456e/html5/thumbnails/19.jpg)
Jenkins - Récupération d’un rapport
● Création d’une nouvelle target Ant
● Copie du dossier de screenshots robotium dans le projet
build.xml
<target name="fetch-test-screenshots" >
<echo>Downloading test screenshots...</echo>
<mkdir dir="Robotium-Screenshots" />
<exec
executable="${adb}"
failonerror="true" >
<arg line="${adb.device.arg}" />
<arg value="pull" />
<arg value="/sdcard/Robotium-Screenshots" />
<arg value="Robotium-Screenshots" />
</exec>
</target>
![Page 20: PAUG - Intégration Continue - Décembre 2013](https://reader033.fdocuments.us/reader033/viewer/2022052905/5586910bd8b42abd068b456e/html5/thumbnails/20.jpg)
Jenkins - Résultats des tests
![Page 21: PAUG - Intégration Continue - Décembre 2013](https://reader033.fdocuments.us/reader033/viewer/2022052905/5586910bd8b42abd068b456e/html5/thumbnails/21.jpg)
Next Steps
● Ecrire plus de scénarios de tests● Exécuter les tests sur Genymotion ?● Passer de Ant à Gradle ?