|
|
<table>
|
|
|
<thead>
|
|
|
<tr>
|
|
|
<th width="200px"><h6>[:rewind: Exo Précédent](/Exo04-JMeter/1%5D-Installation)</h6></th>
|
|
|
<th colspan="4" width="600px"><h1 align="center">05 - Tests - Gatling</h1></th>
|
|
|
<th width="200px"><h6 align="right">[:house: Index](/)</h6></th>
|
|
|
</tr>
|
|
|
</thead>
|
|
|
|
|
|
<tbody>
|
|
|
<tr>
|
|
|
<td> </td>
|
|
|
<td align="center">[:one:](/Exo05-Gatling/1%5D-Installation)<br/>Installation</td>
|
|
|
<td align="center">[:two:](/Exo05-Gatling/2%5D-Presentation)<br/>Présentation</td>
|
|
|
<td align="center">:white_check_mark:<br/>Tester les contrôleurs</td>
|
|
|
<td align="center">[:four:](/Exo05-Gatling/4%5D-Lancer-une-charge)<br/>Lancer une charge</td>
|
|
|
<td> </td>
|
|
|
</tr>
|
|
|
</tbody>
|
|
|
|
|
|
<tfoot>
|
|
|
<tr align="right">
|
|
|
<td colspan="6">
|
|
|
<h6>:copyright: 2019 - <a href="mailto:admin@ferretrenaud.fr">FERRET Renaud</a></h6>
|
|
|
</td>
|
|
|
</tr>
|
|
|
</tfoot>
|
|
|
</table>
|
|
|
|
|
|
***
|
|
|
|
|
|
# Installation de Gatling
|
|
|
|
|
|
Récupérez la version de JMeter sur [Gatling](https://gatling.io/).
|
|
|
|
|
|
Prenez la version *Open Source*.
|
|
|
|
|
|
Dé zippez l'archive où vous voulez (installez et utilisez [7-Zip](https://www.7-zip.org/) si besoin).
|
|
|
|
|
|
Vérifiez que vous avez bien une variable système **JAVA_HOME** qui pointe vers votre JDK. (ex: *JAVA_HOME=C:\Program Files\Java\jdk1.8.0_202*).
|
|
|
|
|
|

|
|
|
|
|
|
Allez dans le dossier d'installation de Gatling, puis *bin* et double cliquez sur *recoder.bat* (ou .sh sous Unix).
|
|
|
|
|
|

|
|
|
|
|
|
# Paramétrage de Gatling
|
|
|
|
|
|
Gatling va nous permettre de rejouer un scénario sur notre site web.
|
|
|
|
|
|
Par exemple :
|
|
|
* J'arrive sur la première page du site
|
|
|
* Je m'authentifie (df/df)
|
|
|
* Je regarder la liste de mes comptes
|
|
|
* Je regarde le détail des opérations du comptes n°12
|
|
|
* Je reviens sur le menu
|
|
|
* Je vais sur la page des virements
|
|
|
* Je réalise un virement
|
|
|
* Je reviens sur la page menu
|
|
|
* Je me déconnecte
|
|
|
|
|
|
Gatling sait enregistrer les requête HTTP (et UNIQUEMENT les requêtes HTTP).
|
|
|
|
|
|
Pour ce faire il devra se comporter comme un [proxy](https://fr.wikipedia.org/wiki/Proxy).
|
|
|
|
|
|
Suivez les informations de votre support pour mettre en place un proxy avec Gatling. A noter qu'il est préférable d'utiliser [Firefox](https://www.mozilla.org/fr/firefox/new/) qui a, contrairement à *Chrome*, une configuration indépendante de *Internet Explorer*.
|
|
|
|
|
|
|
|
|
# Tester les contrôleurs
|
|
|
|
|
|
Démarrez
|
|
|
* votre proxy Gatling
|
|
|
* démarrez dans votre Eclipse votre serveur JEE
|
|
|
* prenez FireFox et allez sur la page login :http://localhost:8080/en04.jmeter.banque.mysql/
|
|
|
|
|
|
Jouez votre scénario, restez simple.
|
|
|
|
|
|
A la fin de votre scénario :
|
|
|
* fermez votre navigateur
|
|
|
* arrêtez le proxy Gatling
|
|
|
* n'arrêtez PAS votre serveur JEE.
|
|
|
|
|
|
Regardez dans le dossier `results` de Gatling, vous allez retrouver un fichier de code en [Scala](https://openclassrooms.com/fr/courses/409949-apprenez-la-programmation-avec-scala/409697-pourquoi-scala).
|
|
|
|
|
|
Copiez collez le fichier dans Eclipse, dans le dossier `src\test\scala` (celui qui est paramétré par notre Maven).
|
|
|
|
|
|
Vous pouvez utilisez Eclipse pour modifier le fichier, il installera automatiquement un plugin Scala pour vous simplifier l'écriture du code.
|
|
|
|
|
|
Suivez les indications de votre support afin d'ajuster vos paramétrages.
|
|
|
|
|
|
# Lancez ses tests
|
|
|
|
|
|
Pour lancez vos tests, faites usage du goal Maven `gatling:test`.
|
|
|
|
|
|
Faites un clic droit sur votre fichier `pom.xml` puis `Run As - Maven Build ...`.
|
|
|
|
|
|

|
|
|
|
|
|
Regardez votre console, Maven vous donne de manière littéraire les résultats de vos tests.
|
|
|
|
|
|

|
|
|
|
|
|
Pensez à faire un `Refresh` sur votre dossier `target`. Le résultat sera dans le dossier `target\gatling\recordedsimulation-xxxxx`, lancez votre navigateur web (ne prenez pas FireFox qui est branché sur votre proxy) sur la page `index.html`.
|
|
|
|
|
|

|
|
|
|
|
|
***
|
|
|
|
|
|
<table>
|
|
|
<thead>
|
|
|
<tr>
|
|
|
<th width="200px"><h6>[:rewind: Exo Précédent](/Exo04-JMeter/1%5D-Installation)</h6></th>
|
|
|
<th colspan="4" width="600px"><h1 align="center">05 - Tests - Gatling</h1></th>
|
|
|
<th width="200px"><h6 align="right">[:house: Index](/)</h6></th>
|
|
|
</tr>
|
|
|
</thead>
|
|
|
|
|
|
<tbody>
|
|
|
<tr>
|
|
|
<td> </td>
|
|
|
<td align="center">[:one:](/Exo05-Gatling/1%5D-Installation)<br/>Installation</td>
|
|
|
<td align="center">[:two:](/Exo05-Gatling/2%5D-Presentation)<br/>Présentation</td>
|
|
|
<td align="center">:white_check_mark:<br/>Tester les contrôleurs</td>
|
|
|
<td align="center">[:four:](/Exo05-Gatling/4%5D-Lancer-une-charge)<br/>Lancer une charge</td>
|
|
|
<td> </td>
|
|
|
</tr>
|
|
|
</tbody>
|
|
|
|
|
|
<tfoot>
|
|
|
<tr align="right">
|
|
|
<td colspan="6">
|
|
|
<h6>:copyright: 2019 - <a href="mailto:admin@ferretrenaud.fr">FERRET Renaud</a></h6>
|
|
|
</td>
|
|
|
</tr>
|
|
|
</tfoot>
|
|
|
</table> |
|
|
\ No newline at end of file |