Il y a 389 articles et 19 utilisateurs inscrits (ce bandeau est défini dans MediaWiki:Sitenotice)
« Documentation de Galen Framework » : différence entre les versions
Aucun résumé des modifications |
Aucun résumé des modifications |
||
| Ligne 211 : | Ligne 211 : | ||
* Java Test (Maven + TestNG + Galen) : http://galenframework.com/docs/reference-java-tests/ | * Java Test (Maven + TestNG + Galen) : http://galenframework.com/docs/reference-java-tests/ | ||
===== Support pour les IDE ===== | ===== Support pour les IDE ===== | ||
* | * IntelliJ : https://plugins.jetbrains.com/plugin/8302-galen-specs-language-support | ||
* | * Sublime : https://github.com/davidrv87/syntax-sublime-galen2 | ||
* | * Vim : https://github.com/galenframework/galen.vim | ||
* | * Visual Studio Code : https://marketplace.visualstudio.com/items?itemName=simonhdickson.galen | ||
===== Tutoriels ===== | ===== Tutoriels ===== | ||
* First Project : http://galenframework.com/docs/tutorial-first-project/ | * First Project : http://galenframework.com/docs/tutorial-first-project/ | ||
| Ligne 222 : | Ligne 222 : | ||
===== Page d'exemple pour effectuer des tests ===== | ===== Page d'exemple pour effectuer des tests ===== | ||
* Test app : http://testapp.galenframework.com/ | * Test app : http://testapp.galenframework.com/ | ||
Version du 16 février 2021 à 09:38
Prise en main de Galen Framework
Qu'est-ce que c'est Galen Framework ?
Galen Framework est un framework de tests fonctionnels responsive pour les sites web, il est écrit en Java et possède son propre langage GSPEC pour écrire les tests. Il est basé sur Selenium https://www.selenium.dev/
Installer Galen
Outils nécessaires
Installer avec NPM
Si vous utilisez NPM, vous pouvez installer Galen avec la commande suivante :
sudo npm install -g galenframework-cli
Installation manuelle
Installer dans Linux et OS X
Téléchargez le fichier depuis le site de téléchargement http://galenframework.com/download/ et décompressez le dans un répertoire. Placez vous dans le répertoire et tapez la commande suivante :
sudo ./install.sh
Pour vérifier que Galen est bien installé, tapez la commande suivante :
galen -v
Vous devriez visualiser la version installée de Galen.
Mettre a jour Galen dans Linux et OS X
Il n'existe pas de commande spéciale pour mettre a jour Galen, il suffit de taper la commande suivante et la dernière version disponible sera téléchargé sur votre machine. Suivez les étapes d'installation et vous devriez avoir la nouvelle version de Galen fonctionnelle :
sudo ./install.sh
Configuration
Configuration de projet
Galen vous permet de configurer chaque projet d'une manière différente. Il suffit de créer un fichier avec le nom galen.config dans votre répertoire de test ou sinon vous pouvez exécuter la commande suivante et Galen créera le fichier pour vous :
galen config
Configuration globale
Si vous souhaitez avoir une configuration globale pour tous vos projets de test, il suffit de taper la commande suivante :
galen config --global
La commande générera un fichier de configuration basique .galen.config dans votre répertoire. Il est important de configurer tous les pilotes externes que vous aurez besoin pour exécuter les tests dans différents navigateurs. Par exemple, si vous voulez utiliser Mozilla Firefox, il faudra déclarer le pilote geckodriver dans le fichier galen.config de cette façon :
$.webdriver.gecko.driver=/path/to/your/geckodriver
Voici quelques liens pour télécharger les differents pilotes pour les navigateurs :
- Mozilla Firefox : https://github.com/mozilla/geckodriver/releases
- Google Chrome : https://chromedriver.chromium.org/
- Microsoft Edge : https://developer.microsoft.com/fr-fr/microsoft-edge/tools/webdriver/
- Internet Explorer : https://github.com/SeleniumHQ/selenium/wiki/InternetExplorerDriver
- PhantomJS : https://phantomjs.org/
Une fois le pilote téléchargé, placez-le dans un répertoire et retenez son chemin pour le mettre dans le fichier de configuration galen.config.
$. ce préfixe signifie que cette propriété est défini au niveau du système, vous pouvez également l'utiliser pour configurer d'autres pilotes.
Exemple de configuration
# Range approximation
# ~~~~~~~~~~~~~~~~~~~~~
# Defines the approximation value for ranges when using "~" in galen page specs
# This value means how many pixels or percents should it take constructing a range
# e.g. if we define approximation as 5 then the following spec:
# height: ~ 50 px
# will actually be replaced by Galen with this:
# height: 45 to 55px
galen.range.approximation=3
# Custom Listeners
# ~~~~~~~~~~~~~~~~~~~~~~~
# A comma separated list of class paths to reporting listeners
# The defined listeners will be picked up by Galen and used for reporting
#
# galen.reporting.listeners=
# Headless Mode
# ~~~~~~~~~~~~~~~~~~~~
# In some browsers it is possible to use a headless mode where no UI is needed at runtime.
# Currently only supported on Chrome and Firefox.
galen.browser.headless = true
# Full screenshots
# ~~~~~~~~~~~~~~~~~~~~
# In some browsers it is not possible to create a complete screenshot of whole page.
# With this property enabled Galen will scroll page and make screenshots of parts of it.
# Then it will assemble it in a one big screenshot
galen.browser.screenshots.fullPage = false
# the following parameters can be used in case the upper parameter is set to true
# smart waiting for scroll position, but with a timeout, set to zero to turn off smart wait
galen.browser.screenshots.fullPage.scrollTimeout = 50
# it sets the amount of time in milliseconds needed for a check that the page was scrolled when taking full page screenshots
# hard wait during scroll
galen.browser.screenshots.fullPage.scrollWait = 20
# Default browser
# ~~~~~~~~~~~~~~~~~~~~~~~~
# A browser that should be used by default in case it was not specified in galen test
galen.default.browser=firefox
# Color scheme spec precision
# ~~~~~~~~~~~~~~~~~~~~~~~~
# A value between 8 and 256 for color spectrum accuracy.
spec.colorscheme.precision = 256
# Using page URLs from last checked page in HTML report
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# This property enables the use of last page URL in a page test
# Needed when for some pages on the website there is no way to open it by direct URL
# galen.reporting.html.useLastPageUrls = true
# Color scheme spec test color range
# ~~~~~~~~~~~~~~~~~~~~~~~~~
# A value between 0 and 256 which defined the range of nearby colors
# in spectrum which will be picked up for calculating the percentage of usage
spec.colorscheme.testrange = 6
# Running in Selenium Grid
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# You can run your tests in Selenium Grid without modifying the tests.
# Just enable the "galen.browserFactory.selenium.runInGrid" property
# and Galen will always choose a Selenium Grid instead of running tests against local browsers
# Also make sure you provide the proper URL to grid
galen.browserFactory.selenium.runInGrid = true
galen.browserFactory.selenium.grid.url = http://localhost:4444/wd/hub
galen.browserFactory.selenium.grid.browser = Firefox
galen.browserFactory.selenium.grid.browserVersion = 16
galen.browserFactory.selenium.grid.platform = XP
# Exit with fail code in case of any failures
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
galen.use.fail.exit.code = true
# Default value for tolerance in image spec
galen.spec.image.tolerance = 30
# Default value for error rate in image spec
galen.spec.image.error = 0px
# Testing visibility of each element in every spec
galen.spec.global.visibility = true
# Test file extension for standard test suite runner
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
galen.test.file.ext = .test
# Test file extension for JavaScript test suite runner
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
galen.test.js.file.ext = .test.js
Lancer Galen
Travailler dans la ligne de commande
Test d'une seule page
Si vous souhaitez tester une seule page, vous pouvez utiliser la commande check. Voici un exemple :
galen check homepage.gspec
--url "http://example.com"
--size "640x480"
--javascript "some.js"
--include "mobile,all"
--exclude "toexclude"
--section "Some section name"
--htmlreport "htmlreport-dir"
--testngreport "testng-report.xml"
--jsonreport "jsonreport-dir"
--junitreport "junit-report.xml"
--config "path/to/galen.config"
Arguments de ligne de commande :
- url - l'url de la page qui doit être testé
- javascript - chemin du fichier javascript que Galen doit injecter dans la page
- include -
- exclude
- section - filtre pour la section
- size - dimensions de la fenêtre du navigateur. La taille se compose de deux nombres séparés par le symbole
x - htmlreport - chemin du dossier ou Galen generera les rapports HTML
- testngreport - chemin du fichier XML ou Galen écrira le rapport du TestNG
- jsonreport - chemin du dossier ou Galen generera les rapports JSON
- junitreport - chemin du rapport junit
- config - chemin du fichier de configuration
Lancer une suite de tests
Une suite de tests ne sont qu'un ensemble de pages qui doivent être testés. Pour executer une suite de tests, il suffit de taper la commande suivante :
galen test mytest01.test
--htmlreport "htmlreport-dir"
--testngreport "report/testng.xml"
--jsonreport "jsonreport-dir"
--junitreport "junit-report.xml"
--parallel-tests 4
--config "path/to/galen.config"
Arguments de ligne de commande :
- htmlreport - chemin du dossier ou Galen generera les rapports HTML
- testngreport - chemin du fichier XML ou Galen écrira le rapport du TestNG
- junitreport - chemin du rapport junit
- parallel-tests - nombre de threads pour exécuter des tests en parallèle
- recursive - attribut qui est utilisé dans le cas où vous souhaitez rechercher tous les fichiers
.testde manière récursive dans le dossier - filter - un filtre pour le nom du test
- config - chemin du fichier de configuration
Configuration des navigateurs
Configurer un navigateur par défaut
Par défaut, Galen utilise firefox comme navigateur mais vous pouvez le modifier dans la propriété suivante du fichier de configuration de galen :
galen.default.browser=chrome
Voici la liste des navigateurs supportés :
- Mozille Firefox
- Google Chrome
- Internet Explorer
- PhantomJS
- Edge
References
Reference complete
- Guide du langage GSPEC : http://galenframework.com/docs/reference-galen-spec-language-guide/
- Syntaxe des suites de tests : http://galenframework.com/docs/reference-galen-test-suite-syntax/
- Galen extras : http://galenframework.com/docs/reference-galen-extras/
JavaScript Tests
- Documentation des tests en JavaScript : http://galenframework.com/docs/reference-javascript-tests-guide/
- Galen JavaScript API : http://galenframework.com/docs/reference-galen-javascript-api/
- GalenPages JavaScript API : http://galenframework.com/docs/reference-galenpages-javascript-api/
Java Tests
- Java Test (Maven + TestNG + Galen) : http://galenframework.com/docs/reference-java-tests/
Support pour les IDE
- IntelliJ : https://plugins.jetbrains.com/plugin/8302-galen-specs-language-support
- Sublime : https://github.com/davidrv87/syntax-sublime-galen2
- Vim : https://github.com/galenframework/galen.vim
- Visual Studio Code : https://marketplace.visualstudio.com/items?itemName=simonhdickson.galen
Tutoriels
- First Project : http://galenframework.com/docs/tutorial-first-project/
- Using Galen with gulp or grunt : http://galenframework.com/docs/tutorial-using-galen-with-a-task-runner/
- Running Tests on BrowserStack : https://github.com/browserstack/Galen-BrowserStack
- Other tutorials on mindengine.net : http://mindengine.net/category/galen/
Page d'exemple pour effectuer des tests
- Test app : http://testapp.galenframework.com/