Selen (IT)

Selen Popis obrázku Selenium.png. Popis obrázku Selenium IDE.png. Informace
Tvůrce Zachování svobody softwaru
Poslední verze 3141,59
Pokročilá verze 4.0.0-alfa-7
Vklad https://www.selenium.dev
Zajištění kvality Kontinuální integrace
Stav projektu Aktivní
Napsáno Jáva
Jazyky podpory PHP, Python, Ruby, .NET, Perl, Java, Rust and Go
Operační systém Microsoft Windows
životní prostředí multiplatformní
Typ Rámec
Licence Licence Apache 2.0
Dokumentace https://www.selenium.dev/documentation/en/grid/
webová stránka https://www.selenium.dev/

Selen je rámec pro počítačový test vyvinutý v Javě, ale poskytuje brány pro běh v různých jazycích, jako je Python a PHP.

Umožňuje vám komunikovat s různými webovými prohlížeči, jako je Google Chrome díky chromedriveru nebo Mozilla Firefox s Gecko, stejně jako by to udělal uživatel aplikace. Spadá tedy do kategorie dynamických testovacích nástrojů (na rozdíl od statických testů, které nevyžadují spuštění softwaru) usnadňující funkční testování.

Je spojena s

Příklady testů se selenem

V PHP  :

require_once 'PHPUnit/Extensions/SeleniumTestCase.php'; class CategoryModifTest extends PHPUnit_Extensions_SeleniumTestCase { protected function setUp() { $this->setBrowser("*firefox"); $this->setBrowserUrl("http://..."); } public function testCategoryModif() { $this->open("http://..."); $this->type("modlgn_username", "admin"); $this->type("modlgn_passwd", "password"); $this->click("link=Connexion"); $this->waitForPageToLoad("30000"); $this->open("http:.../administrator/index.php?..."); $this->waitForPageToLoad("30000"); $name = $this->getTable("//div[@id='element-box']/div[2]/form/table.2.2"); $this->click("link=".$name); $this->waitForPageToLoad("30000"); $this->type("name", "Ordinateurs portables modifié"); $this->click("//td[@id='toolbar-save']/a/span"); $this->waitForPageToLoad("30000"); try { $this->assertTrue($this->isTextPresent("Ordinateurs portables modifié")); } catch (PHPUnit_Framework_AssertionFailedError $e) { array_push($this->verificationErrors, $e->toString()); } $this->click("link=Ordinateurs portables modifié"); $this->waitForPageToLoad("30000"); $this->type("name", "Ordinateurs portables"); $this->click("//td[@id='toolbar-save']/a/span"); $this->waitForPageToLoad("30000"); $this->click("link=Déconnexion"); $this->waitForPageToLoad("30000"); } }

Nebo v Rustu  :

// ici on déclare le packet selenium_webdriver. use selenium_webdriver::*; // Le point de départ fn main() { // ici ça permet uniquement de créé une session et le navigateur indiqué est Chrome. let mut driver = Browser::start_session(BrowserName::Chrome, "--disable-popup-blocking", "--disable-extensions"); // selenium va s'en chargé d'ouvrir une nouvelle page. driver.open("https://www.wikipedia.org/").unwrap(); // ça permet uniquement de rechercher la barre de recherche. let search = driver.find_element(LocatorStrategy::CSS("#searchInput" as &'static str)).unwrap(); // ça permet uniquement de taper Selenium (informatique) dans la barre de recherche. let _ = search.send_keys(&"Selenium (informatique)"); // selenium va chercher le bouton. let btn = driver.find_element(LocatorStrategy::CSS("input[type=submit]" as &'static str)).unwrap(); // et il va clicker ! btn.click(); }

Interoperabilita

V PHP rozhraní Selenium s PHPUnit , nebo dokonce s Behat  (en) pomocí knihovny Mink.

Reference

  1. „  Selenium - Web Browser Automation  “ , na www.seleniumhq.org (přístup 20. dubna 2017 )
  2. Kompletní testovací řetězec se selenem IDE, selenem RC a PHPUnit
  3. (in) Junade Ali , Mastering PHP Design Patterns , Packt Publishing Ltd.28. září 2016( číst online )